LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA only reads parts of buffer from serial device

Hello, 

 

I am rather unexperienced with serial communication and have encountered a problem trying to communicate with my RS-232 serial device.

 

When sending a command the reply is split  and I have to run again to read all.

For example: I send C0001\n to start a measurement and receive: 1. time C0001 and 2.d time \s00000137\s00000150\s00000000\06C0001\06 and I'd like to have it all in one reading operatiuon.

 

Sends finish with a \n and replies with a \06 (positive) or \15(negative). Replies are in the format C0001\[\sDATA]\06.

 

Do I need to define different TermChars for reads and writes? 

 

I am using labview 2014

 

Thanks in advance,

Marvin

0 Kudos
Message 1 of 2
(2,616 Views)

How long is your timeout value?  Perhaps it is not long enough.

 

You set termination characters for reads.  You don't set it for writes.  You just append the carriage return or linefeed at the end of the string you write.

 

(There is a propeerty node that will enable and set the value for a termination character for writes.  It just automatically appends that character to the end of every write.  It isn't necessary to use.  You are better off just putting the character in yourself on the write.)

 

Write now you don't have a termination character for the read.  You could try enabling it and set it for \06.  The only problem is that for those occasions where you might get teh NAK  (\15), you'll have to wait until the VISA read timesout because teh \06 is not coming.   That or begining every VISA read with 1 byte to see if it is the NAK, then if it isn't that or \06, read plenty more bytes as the rest of the string should be a response that will end in ACK.

0 Kudos
Message 2 of 2
(2,594 Views)