NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

enter hex value in string value test

In teststand string value test, in Limits- Expected String Value: I would like to enter the Ascii hex value: ex: 0xAA0x060x10... for comparison with a string I received at the comport. how do I type those in the Expected value string field.
0 Kudos
Message 1 of 7
(4,648 Views)
a) Set a pre-expression of:

Step.Limits.String = "\xAA\x06\x10"

b) At any breakpoint, enter a watch expression of "\xAA\x06\x10". Select Copy Value. Terminate execution, paste into the Expected String Value field and remove the surrounding quotes.
Message 2 of 7
(4,648 Views)
I will try it now, thanks for a fast response
0 Kudos
Message 3 of 7
(4,648 Views)
Just to clarify, (a) and (b) are alternate solutions. Not two steps in a single solution.
0 Kudos
Message 4 of 7
(4,648 Views)
I tried and TestStand only get first byte (character) back.
In a LabVIEW vi, I connect a string "Hello" to Teststand String Measurement. In TestStand Message box, I do a check for string length, I get 5.
but when I replace "Hello" with an array of hex, 0xAA, 0x00, 0x01,0x70, 0x55 and used a Unsigned byte array to string and connect the string to TestStand String measurement. In LabView, the length is still 5 bytes, but by the time, it gets to TestStand message Box, only one byte received. What happens to the rest?
0 Kudos
Message 5 of 7
(4,648 Views)
In TestStand, as in many environments (but not LV), the end of a string is marked by a zero byte. In your example, the second byte is zero so the string appears to contain only one character. If you might have zero bytes in your data, you can't put the data in TestStand strings unless you devise your own encoding to escape the zero bytes.

"Escaping" means that you reserve a character to be a flag character, for example the pound ("#") character. You could write a VI in LV to filter your string before returning it to TestStand, replacing zero bytes with "#0" and the pound character bytes with "##" (or any other scheme that you like). If you did this, the expected string measurement in TestStand for your example would be "\xAA#0\x01\x70\x55".
Note that a future version of TestStand will have a feature to escape binary data from LV for you.
0 Kudos
Message 6 of 7
(4,648 Views)
Thank very much for the reply. It helps me a lot.
0 Kudos
Message 7 of 7
(4,648 Views)