From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.


Showing results for 
Search instead for 
Did you mean: 

concatenate user defined hex code for serial communication

Go to solution

Hi.. I am a beginner to LAbView. I am trying to communicate with an AC power Source. for which My command will be in the format of 4 to five bytes; e.g. for setting a voltage of 220VAC, it is 1509 0898 in Hex, in which 15 is fix for all commands for hand shaking, 09 is for different operations like setting Volatge or Freq. and last four digits 0898 is an Hex code of 2200 (for 220.0VAC).


While sending the full command 1509 0898 in Hex to Serail port my source is communicating, even by giving the them using concatenation of strings like 1509 is first string and 0898 in second, it is working fine.


But these last two bytes would be user defined and hence can vary in numeric, so I have put a Number to Hex code conversion there before concatenation. which is not sending the Hex code 0898 as reqd.  but sending this garbage value...3038 3938


Please Help.. Thanks in advance....

0 Kudos
Message 1 of 16
You can set the string inputs or constant to display its contents in hex. Then you can type the data in hex. Alternately, you can create a 1D array of U8s and set the radix to hex. You can then convert the array to a string.


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 16
Accepted by topic author Ermani

Hi Ermani,


here's the step-by-step long way:


Best regards,

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 16

Hi.. GredW.. Thanks.. But can u please give the name and properties of 3th and 5th Function?? I could not find the same.

0 Kudos
Message 4 of 16

Starting from left to right

1. Multiplication

2. Round to nearest

3. Convert to U16

4. Split number

5. Build array


All of them can be found in Numeric pallet.

With Regards

Kudos is better option to thank somebody on this forum
Message 5 of 16

Dear GerdW, Thanks a lot it is working for me.. 🙂

0 Kudos
Message 6 of 16

Thanks Miraz.. 🙂


It is working..


But it wud be better if you can let me know about the same that what is going on behind the code..

0 Kudos
Message 7 of 16


Ideally CTRL + H  should work for you, it will open help menu and explain each function for you.


For this time let me give you details.......


1. You are multiplying 220.0 and 10.0 which results in 2200.0 (fraction)

2. If it is not round number then you are rounding it to nearest (In this case it is already rounded value)

3. Then you are converting it to U16, that means you are converting value to be represented using 16 bits(2 bytes)

4. Then split number is spliting upper 8(1 byte) and lower 8(1 byte) bits  for you

5. These upper and lower bytesyou are then adding to array using build array function

With Regards

Kudos is better option to thank somebody on this forum
Message 8 of 16

but where the Hex conversion is done for this upper & lower byte?

0 Kudos
Message 9 of 16

The final function Byte array to string converter.

With Regards

Kudos is better option to thank somebody on this forum
0 Kudos
Message 10 of 16