01-15-2014 02:50 AM
Hello,
I have a device that sends out the message by RS232. But the message package is a little different from normal operation. For example, if the message is FF 06 43 02 C1 02, the ninth bit of the first byte FF is set to '1' and the rest of bytes are set '0'. To send message to the device, I have to change parity between 'mark' and 'space'. But how to receive such data package with VISA? I use the normal receive routine, it said that there's frame error
Is there anybody got similar problem? Much thanks!
Solved! Go to Solution.
01-15-2014 08:38 AM
There's not really anything such as a "normal" receive routine. Your error indicates a mismatch in the com settings between the instrument and the pc. Impossible to say what you should be setting since you have not provided the instrument make and model, it's manual, or your code.
01-15-2014 07:57 PM
Thanks for reply!
But my device send out the data frame which the parity setting is different for each byte. How can I receive such message with VISA?
01-15-2014 10:28 PM
01-16-2014 12:29 AM - edited 01-16-2014 12:29 AM
Here is my device protocol document. In data layer section at page 6 there's description for the data frame. The ninth bit of one byte is called frame bit. It is set to '1' only for the fist byte of the message.
Actually I have implemented this protocol with win32 program. And made a dll file called in Labview program. Now I want to implement all with Labview, but I got such problem. Much thanks for reply!
01-16-2014 01:45 AM - edited 01-16-2014 01:47 AM
Hi,
You can implement the ninth bit protocol in LV. I use it all the time.
In my system the first byte has the ninth bit set and for all others bytes the ninth is zero. It looks like different parity for normal UART's, so you get a parity error.
You can use 'Mark' and 'Space' parity to force the parity bit to '1' or '0'. Send the first byte with a 'Mark' parity and the remaining bytes with a 'Space' parity.
Receiving byte with either parity will result in a parity error. Just ignore that error.
The downside is that you cannot see which byte is the first byte. But in a test-setup it works for me.
Normally this kind of interface is handled by a Microcontroller like the 80C31.
Kees
01-16-2014 10:19 AM
If you expand K C's solution a bit you should be able to identify the first byte: Set receiving parity to Space. If you get a parity error, it was a first byte - sent with Mark parity. Check for that specific error and when found process as a first byte. All others should not generate a parity error. This assumes that the Read returns the 8 data its even if a parity error has occurred, which I have no easy way to check. It sounds like it does from what K C reportred doing. Of course if your transmission path is noisy and you get real parity errors, this will not work.
Lynn
02-25-2014 09:35 PM
Thanks for your help!
I always got problem on receiving data. I'm going to try ignore the parity error in my program. But now I build dll by C code using WinAPI to work with LV:)