LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error reading serial port when hexadecimal value is 0D (carriage return)

Solved!
Go to solution

Hi,

 

I'm trying to read an 80 bytes string from the serial port but if one of those bytes is 0D (hexa) the rest of the bytes are not read because the Visa read node sees the value 0D as ASCII for carriage return. How can I read the entire string and see the 0D as a value and not as an ASCII symbol?  

 

Manuel

0 Kudos
Message 1 of 5
(4,601 Views)
When you configure the serial port you can enable or disable the termination character. You can also choose which character to use for termination of reads.
=====================
LabVIEW 2012


0 Kudos
Message 2 of 5
(4,597 Views)

HI Steve,

 

The port is configured with the termination character as default. But I don't need a termination character, I know that the string will always be 80 bytes long. The thing is that I set the "byte count" of the Visa Read node to 80, and when a 0D value shows up the "return count" says that only the bytes before 0D were read. Do I make myself clear? For example what I need to see is this:

 

02 0A 03 05 1E 0C 02 0D 03 0F 05 0D 0A 01

 

And what the "Visa read" sees is:

02 0A 03 05 1E 0C 02 0D

03 0F 05 0D

0A 01

Because it takes 0D as carriage return.

0 Kudos
Message 3 of 5
(4,590 Views)
Solution
Accepted by topic author ManuP

Of course it sees it as a carriage return and terminates. That is what you have programmed it to do. Set the 'Enable Termination Character' to false with your VISA Configure Serial Port. Just what Steve has already said. Clear?

0 Kudos
Message 4 of 5
(4,586 Views)

Clear,  that solved the issue. I guess I missunderstood Steve. I thought the default termination character was 0A (line feed)

thank you both guys

0 Kudos
Message 5 of 5
(4,581 Views)