08-30-2014 11:13 AM
Hi
I’m trying to read some serial data from a UUT using the NI-VISA read function. The data is mostly text but does include some control codes. The first of these appears after the ‘OK’ in the Serial Bytes window on the front panel. More text should follow but for some reason, the read function stops at the first zero character (index 144 in the Byte Array), and returns an 0xBFFF003E (-1073807298) error. I found another thread where someone had a similar problem and I’ve tried the fix for this plus a few other things, but nothing’s worked. If I use Hyperterminal, the entire data block is returned as it should be.
I wondered if this was anything to do with the 7.1 version of Labview I’m using (upgrade is on the cards). The version of NI VISA I’m running is 4.2.
Very much appreciate any thoughts.
Thanks
Bruce
08-30-2014 04:25 PM
09-01-2014 04:29 AM - edited 09-01-2014 04:30 AM
The error code itself is a generic VISA error which often happens with USB to RS-232 interfaces. Does your device connect to the PC through USB as a virtual COMM port? If so what chip and Windows driver is it using?
Also your function somehow looks wrong. The only criteria for the read loop to terminate is if there is an error on the VISA read or the Teststand termination status gets true. Generally if you use VISA Bytes at Serial Port you are almost always doing something wrong! That function does absolutely not synchronize with anything in your data. You will read whatever is there at that moment and that could be a partial message, no bytes at all (LabVIEW is typically many times faster than any serial device even if it is super high speed), or multiple messages.
09-01-2014 10:19 AM
Dennis & Rolf, thanks for your replies.
The Com port I’m using isn’t a USB-serial converter. It’s from a 4-port RS232 PXI card (a PXI-8420/4 which I think is obsolete now?). This sits in a 1045 chassis and connects to the PC via a MXI-4 link. I’ve installed the 4.4.1 version of NI-VISA which looks to be the last release compatible with LV 7.1, but it’s not made any difference.
The error does occur at same place. If I ignore it, the read continues and I get the rest of the control codes, followed by the remaining text so I guess this’ll be the workround.
The routine is just a cut down version of what I’m actually using and this does have other exit conditions. I call it via TestStand which is why the termination monitor is in there. The case statement includes a ‘0’ case to handle 'no Bytes at Port' and all I do when this occurs, is wait 250 milliseconds.
Thanks
Bruce