From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Framing Error in LabVIEW7.1 and RS232-RS485

i am trying to communicate to a measurement board (is based on RS485 interface) using Labview7.1 and RS232-RS485 converter.  I'm using the same settings as the Board. I am able to read the data but at the end end of each serial read, every time I find 'Framing Error'.  And the data is corrupted. Please help out ...
 
Please go thru my code (attachment)  and let me know if i'm going wrong anywhere.
0 Kudos
Message 1 of 12
(9,202 Views)

Your code looks fine.  A framing error is almost always caused by a serial setting mismatch.  If your data is completely garbled, then baud rate is most likely the culprit.  I found a KB that talks more about this:

http://digital.ni.com/public.nsf/websearch/13A20C0F9DF265FB86256FC60066D9C2?OpenDocument

I hope this information helps.

0 Kudos
Message 2 of 12
(9,170 Views)
Mr. Michael,
 
I thank you for your reply.  But i found the settings what I used are same as the Board-settings. And the same settings work fine with a debugging tool (WindMill). Regarding the KB document what you have suugested me, I had already seen it and understood that noise might cause the Framing Error. But what is the level (amplitude and frequency) of the noise can actually create the problem, i dont know.
 
The best part of the Board is that it works perfect with the Debugging Tool.
 
 
I also have a doubt that the buffers used for Rx/Tx by Labview are not refereshing immediately (not even after 10 sec closing the Port). May i know the limitations if any.
0 Kudos
Message 3 of 12
(9,140 Views)
RS-232 is pretty robust, and it takes noise greater than +-3V to generate false transitions.  As long as you are using a cable specifically made for RS-232 and you know there is no large EM source nearby, then noise is not likely the cause.
 
The first step in trouble shooting this is to take LabVIEW out of the picture.  Try opening the Measurement & Automation Explorer (MAX) and selecting your COM port under Devices and Interfaces.  Select the "Port Settings" tab at the bottom and make sure they match your board settings.  Then select "Open VISA Test Panel" from the top.  This test panel will allow you to make read and write calls directly to the VISA driver.  If you are still getting an error here, then the issue must be cause by a setting mismatch.
0 Kudos
Message 4 of 12
(9,119 Views)

Mr. Michael,

I appreciate your help and ideas in this regard. May I know the Baud rate timing error, LabVIEW- Serial drivers can tolerate (in terms of some quantitave values) while decoding the read-data.

 

This is because the measurement board generates the baud rate using an on-board Crystal/Oscillator (in this case 40MHz) and it is suspected to have some error in clock generation.

 

I think you are the right person as you work for National Instruments to answer this query. Once again I thank you for your excellent support.

0 Kudos
Message 5 of 12
(9,064 Views)
1% should be the acceptable tolerance for the baud rate.
0 Kudos
Message 6 of 12
(9,052 Views)
Mr. Michael,
 
Thank you for your support. I still have a couple of questions regarding this.
 
is the error percentage (1%) you mentioned valid through out all the ranges of Baud rate?
 
is any integer value in between the standard baud rates acceptable by LabVIEW serial drivers?
(for ex: 37878 instead of 38400)
 
 
0 Kudos
Message 7 of 12
(8,983 Views)
As long as your device supports the baud rate, VISA should let you set the baud rate.

-Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 8 of 12
(8,958 Views)

I saw the last entry and have a question regarding setting baud rates.  I am trying to set the baud rate on my COM port to 56.7K and I am getting the following error (copied from "explain error" box).

Error -1073807330 occurred at Property Node (arg 2) in VISA Configure Serial Port (Instr).vi->Change baud rate.vi

Possible reason(s):

VISA:  (Hex 0xBFFF001E) The specified state of the attribute is not valid, or is not supported as defined by the resource.

Now I have gone and changed the baud rate (by force) through Device Manager and the baud rate is supported (I am assuming, since it gave me that baud rate as an option).  The only problem now if that when I try to configure my COM port for the parity and bit size with the Visa Cofnigure Serial Port, the default baud rate on that call is 9600.  I am assuming that this will change that COM port's baud rate to 9600, even though I have set it to 56.7K through Device Manager. 
 
I have included the sample code where the error is being generated on my system.
 
Why am I getting this error?
0 Kudos
Message 9 of 12
(8,815 Views)
Well, that's because there's a slight difference in numbers here. What you're actually trying to get is 56K, which is 56 x 1024 = 57344. If you try that baud rate you should not get that error(I ran your program with that baud and had no problems). Let me know what result you get.

Regards,
Matt S.

Message Edited by Matt_S. on 11-17-2005 02:32 PM


LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
Message 10 of 12
(8,797 Views)