LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I define more than one termination character for RS-232 interface communication?

Solved!
Go to solution

Hi,

 

I have to communicate through the PC's RS-232 interface with a microprocessor board. I am using the "Advanced Serial Write and Read.vi" out of the LabVIEW examples and it works on principle.
My problem is the termination character: It looks like I just can set one termination character, EITHER 0xA (so LF / newline) OR 0xD (CR / carriage return), but I have the need to react on various termination characters like "<CR> <LF> <CR> <LF> OK <CR> <LF>" or "<CR> <LF> <LF>"; which I would like to set in a control (this VI will be used in a TestStand sequence).
Is there a way to do that, so that I can set wichever termination character(s) I need? The property node in "VISA configure serial port" just accepts an unsigned integer, nothing else. Sure I can get it running with the timeout - but this is not very nice and extends testing time unnecessarily.

 

Thanks & Regards!

Regards,
gedi
0 Kudos
Message 1 of 4
(3,347 Views)

Hi gedi,

switch off the "normal" termination character and add what ever you need to the end of your string. Smiley Wink

 

Mike

0 Kudos
Message 2 of 4
(3,340 Views)
Solution
Accepted by topic author gedi
That would be for the write. The poster is asking about the read. For the read you will need to write your own read routine. You will basically need to use a loop and inside the loop use the VISA Bytes at Serial Port to see if there's any bytes available. Read that many bytes, and append them to a string that you build up in a shift register. After concatenation check to see if you've got the termination characters. If so, the read is done. Fairly simple. Be sure to turn off the termination character enable in the VISA Configure.
Message 3 of 4
(3,329 Views)
Thanks so far, I will try that!
Regards,
gedi
0 Kudos
Message 4 of 4
(3,303 Views)