ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

取消
显示结果 
搜索替代 
您的意思是: 

Convert 8 bit Binary numeric to 1 byte string

已解决!
转到解答

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 项奖励
1 条消息(共 7 条)
7,901 次查看
解答
接受人 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
2 条消息(共 7 条)
7,895 次查看
Thanx Buddy.. Thank you very Much..
0 项奖励
3 条消息(共 7 条)
7,887 次查看

@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 项奖励
4 条消息(共 7 条)
7,007 次查看

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 项奖励
5 条消息(共 7 条)
6,999 次查看

The second block is a function 'Build Array'.

0 项奖励
6 条消息(共 7 条)
6,994 次查看

@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.
7 条消息(共 7 条)
6,980 次查看