07-25-2012 10:26 AM
Hi everyboby,
I am a new LabViewer, now I am doing a project about serial communication. And I need to transmit hex command from the computer to the component and vice versa. However, I got some troubles with converting a hex string in normal display into a hex string with hex display. For example, my 10 bytes string now is "0A 00 00 A0 00 00 00 00 FF FF" in normal display, and I want to convert into hex display with the format: " 0A00 00A0 0000 0000 FFFF".
I very appreciate for anyone can help me solve this problem.
:))
07-25-2012 10:34 AM
Typing a hex string in normal display and then selecting hex display is not the correct way to enter hex data. What will happen is that each of those characters will be changed to it's hex value (i.e. 'A' = 0x41). Simply clear the control and enter your data as hex.
07-25-2012 10:36 AM - edited 07-25-2012 10:37 AM
Right click on the control or constant and select "Hex Display" and reenter your data. That would be the easiest way to handle it. Otherwise, you would need to take 2 characters at a time (use a for loop), use the Hex String to Number with a U8 data type (autoindex out the numbers), then use the Byte Array to String.