Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from serial port

Dear all,
I've attached a simple Subvi that is meant to read
from serial port that has a sensor connected to
it.
the sensor can be puten into timed continous mode
and transfer at every 30Ms.
While the Vi is very simple and looks reasonable
to me, the results are odd. For example once I
expect 20 bytes at port sometimes it shows 40. and
it varies, each time.
Is there anything i've done wrong ?
0 Kudos
Message 1 of 4
(3,241 Views)
Hello,

I didn't see your attachment to the posting, so you might want to try that again. Without that, a good place to start is the Serial <-> GPIB.vi Example that ships with LabVIEW. You will probably have to modify the example to put the read in a loop if your device is constantly putting out serial data. I would have to know more about exactly what your VI is doing to interpret the 20/40 byte difference, but it seems likely that the serial device has put out two "packets" of information and both are waiting in the software serial port buffer.

Hope this helps; reply here if you need further clarification.

Scott B.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,241 Views)
Hi Scottie,
The number of the byte in the buffer differes each
time I run the code.
here is the code.
Thank you
0 Kudos
Message 3 of 4
(3,241 Views)
Farzad,

Please see my response to your other topic labelled "serial".

Scott B.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,241 Views)