LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert 8 bit Binary numeric to 1 byte string

Solved!
Go to solution

Hello..

 

I want to convert a 8 bit binary number to hex string.

 

Examples;

 

binary- 00000000  -> 00 (Hex)

binary- 11110000  -> F0 (Hex)

binary- 01110000  -> 70 (Hex)

 

And the Hex STRING should be 1 Byte.

 

I tried but its not showing the exact string as above.

Please help.

I have attached the VI.

0 Kudos
Message 1 of 7
(6,262 Views)
Solution
Accepted by Nayan

Hi Nayan,

 

can't open your VI here, but your question translates to this snippet:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(6,256 Views)
Thanx Buddy.. Thank you very Much..
0 Kudos
Message 3 of 7
(6,248 Views)

@GerdW wrote:

Hi Nayan,

 

can't open your VI here, but your question translates to this snippet:

check.png


Can you please specify the 2nd node used(between numeric control and  byte array to string converter) 

0 Kudos
Message 4 of 7
(5,368 Views)

Hi sajipk,

 

what I posted is a snippet: you can drag it onto a block diagram to get real code!

 

What does that node?

Let's look at the snippet:  At the input it gets an array of U8 (depicted in the function icon by "[U8]") and at the output you get a string. Obviously it's a conversion function… (Hint: search for "U8 array to String"…)

Edit/correction: you are talking about this function, which converts a scalar item into an array? 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(5,360 Views)

The second block is a function 'Build Array'.

0 Kudos
Message 6 of 7
(5,355 Views)

@SPK91 wrote:

@GerdW wrote:

Hi Nayan,

 

can't open your VI here, but your question translates to this snippet:

check.png


Can you please specify the 2nd node used(between numeric control and  byte array to string converter) 


This solution proves that sometimes there's just no substitute for experience.  I'm pretty sure it isn't obvious to a beginner that you would have to convert the number into an array of numbers first so you can use the byte array to string node.  Even less obvious is that you can use the "build array" node with just one input and output.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 7 of 7
(5,341 Views)