LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem reading data from serial port

I have a problem reading data from serial port. In my program, first I try to write commands to the serial using VISA write function, then I read the data that come from serial port using VISA read function but I cant get all the information I need. I set the maximum byte count in VISA read but still give me the same results. If I set 300 they give me the same result. And again if I set 500 they give me the same results. And what happen is that if I run another VI like error query or other query VI, then this instrument give the rest information I need (For example: The data I must get is �This is SawNaingAye, I am from Singapore� but the data I got from serial port is when I run the [*IDN? VI] it sends me �This is SawNaingAye� and w
hen I run the: [SYST:ERR? VI], then I get �I am from Singapore� instead of giving me �0,No error�. I do not know how to solve. I just simply write my VI, like first I run VISA write then I run VISA read. The instrument I am using is Schaffner NSG438 ESD generator. The driver is not available from NI.com and Schaffner.com. Any suggestion how can I read the whole string from serial port.
And the same thing
Another problem is when I read my file that transfer from the scope, I only get the header of the file and the rest are missing. This is the same problem I think; I cannot read the entire data that send from the instrument. I may need to do something with this. I try to use while loop, but give me error. Thanks for any help.
SawNaingAye
0 Kudos
Message 1 of 5
(3,348 Views)
Hi,

Sounds like you may have a termination character set which appears in your string. Check to see if the termination character for the VISA port is set to "," or if you have any other possible characters in your string being sent (cr/lf is the default termination character).

Shane
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 5
(3,348 Views)
Actually, I'm sending binary data over the serial port and therefore could not have ANY termination characters.
The VISA Serial port properties has a boolean controlling whether a termination character is used or not.
0 Kudos
Message 3 of 5
(3,348 Views)
Try the "Serial Read with Timeout.vi" (in Serial Comm examples). Do remember to specifiy no. of bytes you are expecting from the Serial Port.

ian.
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 4 of 5
(3,348 Views)
I think you answered in the wrong thread?

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 5 of 5
(3,348 Views)