LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading ascii termination character

I am interfacing with an RS232 device.  When I read data from the device it is terminated with either the ascii ACK or NAK (depending on whether or not the operation was sucessful).  When I display the data the termination character looks like a box since these characters are not printable characters.  I want to be able to determine if the termination character is a ACK or a NAK.  The problem is I cannot figure out how to convert the character from ascii to something like decimal or hex so that I can check if it is an ACK (decimal 6) or NAK (decimal 21).  Does anybody know how to do this?

thanks
0 Kudos
Message 1 of 3
(2,866 Views)
String To Byte Array

Converts a string into an array of unsigned bytes. Each byte in the array has the ASCII value of the corresponding character in the string.

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 2 of 3
(2,861 Views)
To see it, change the string indicator to '\' Codes Display. For any non-printable character in the string the display will show \xx where the xx represents the hex value of the byte.

To handle it programmatically compare the character to the ACK or NACK characters using the comparison functions or the Match Pattern string function.

Lynn
0 Kudos
Message 3 of 3
(2,860 Views)