From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Read - Carriage return and monitoring

Hello,

 

I have 2 questions about the VISA Read VI;

First of all, is it possible to configure this VI not to stop reading after he finds a carriage return in the string? For example, when you want to read 30 bytes and after 10 bytes he finds a carriage return the VI ends, returning only the first 10 bytes.

 

And second, how can you use the VISA Read VI if you want to monitor a COM port, without knowing when to read and how much bytes to read? I want to use the VI for continuously polling the COM port.

 

Thanks in advance,
Dries

0 Kudos
Message 1 of 4
(3,716 Views)

dries22,

 

  1) I don't think that you will be able to split the string and read it but after reading the string you can split it and use it.

  2) You can use the Byte at the Port Property to check number of bytes of data available for reading.

-----

The best solution is the one you find it by yourself
Message 2 of 4
(3,701 Views)

Hi

 

If you disable 'End reading at termination character', you will get all 30 bytes including carriage return.

agadsg.png

 

The Visa read function will wait until it has the bytecount requested. If it has not got it when the timeout limit expires it produces an error.

But this error you could choose to ignore. It will return the contents of the buffer anyway.

 

Best Regards.

Message 3 of 4
(3,693 Views)

Both solutions work. Thank you for the help!

0 Kudos
Message 4 of 4
(3,678 Views)