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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA bug

Firstly, I'm using LabVIEW 5.1.1
I have a program which continually talks to the serial port, using the VISA
vi's. My program talks to a device through the com port, requesting a
"status packet" of 9 bytes to be sent back.

This all works well, I recieve all the right values, etc, until one case
occurs. When the 4th byte returned by the device is a 10, (the first three
are 0's), the VISA read vi doesn't read the rest of the data in. (I
definately asked it for 9 bytes), but only 4 get read.

Can somebody tell me if this is a known bug in LabVIEW, or what, cause its
confusing the hell outta me!
I looked for any possible explaination, without success, (but I'm a mere
novice!).

Any help would be greatly appreciated!

--
Slade Squire
Programmer
Rectifier Technolo
gies Pacific
Melbourne, Australia
SladeSquire@rtp.com.au
0 Kudos
Message 1 of 5
(2,647 Views)
Hi,

No, this is the default terminate character.
You will need to set to terminator chararter to something else.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 2 of 5
(2,647 Views)
Hi,
the problem is the VISA termination character, which defaults to 10. If you want to change the termination character to another value, you need to create a property node and change the value (preferably to something that doesn't occur often, I have used 255 in the past). Theoretically you can disable the termination character (there is an option to do this under the VISA properties), but that doesn't always work (certainly under NT I have never been able to disable the termination character).

If you want to avoid these problems with termination characters all together, use the basic serial drivers with LabView. They are not as comprehensive as the VISA drivers, but they don't have this trouble with termination characters.

Hope that helps,
Jonathan
0 Kudos
Message 3 of 5
(2,647 Views)
Slade:

The way to disable the termchar in Serial is to set the Serial End In Mode to none (0). You use a property node to do this. The VISA driver treats that character as an End indicator (similar to EOI in GPIB) by default, not just as termchar. That is why setting the Termchar Enable to false does not help.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
0 Kudos
Message 4 of 5
(2,647 Views)
Hi Slade,
A workaround is to do another reading when receive less bytes than expected ... this will give you the remaining string. Concatenate them including that “10” and you will have the valid string. Anyway, if you receive less than 9, check if there are more before reading again (in order to avoid interpreting a possible error as a “10” occurence).
Hope this helps
0 Kudos
Message 5 of 5
(2,647 Views)