LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert u8 to decimal

Hello,

 

I'm using a custom command and I would like to have my response to a fill slide 

my problem is that the response is an u8 and it needs to be a number.

How do I need to do this?

 

Thanks in advance!

0 Kudos
Message 1 of 21
(7,926 Views)

You shouln't have any problem? What makes you think it doesn't work?

 

The U8 should be coerced to double automatically.

0 Kudos
Message 2 of 21
(7,917 Views)

A U8 is a number.  The "U" part means "Unsigned", the "8" means "8-bits".  Thus a U8 can represent numbers from 0 through 255 (in binary, from 00000000 to 11111111).  If you simply displayed it, you would see that it took on these numeric values.

 

Contrast this with I8, an 8-bit integer, with the highest bit being the "sign" bit.  Here, binary 11111111 will represent -1 (anything with the high bit set is negative).  Note that adding binary 00000001 (or "1") to binary 11111111 (or -1) gives 0 (as in -1 + 1 = 0).

 

Bob Schor

0 Kudos
Message 3 of 21
(7,916 Views)

Perhaps he has a string in hexadecimal format and doesn't know the proper vocabulary.

 

2015-05-01 14_58_03-Untitled 3 Block Diagram on ABT.lvproj_My Computer rev. 0.png

0 Kudos
Message 4 of 21
(7,906 Views)

joap wrote:

I'm using a custom command and I would like to have my response to a fill slide 

my problem is that the response is an u8 and it needs to be a number.

How do I need to do this?


As others have said, U8 is a number (for convenience, it can be displayed in many ways, decimal, hexadecimal, binary, etc. but that does not change the underlying data value).

 

Any scalar numeric source (control, diagram constant) can be wired to a fill slide. Make sure the fill slide is an indicator.

Do you get a broken wire? If so, what does it tell you when open the context help (ctrl+h) and hover over the broken wire?

 

Please explain what you mean by "response". Where does the value come from, how often?

 

Easiest would be if you could show us your code. Make a typical value of your U8 the default before saving.

0 Kudos
Message 5 of 21
(7,887 Views)

I don't have a broken wire.

response: I send a variable from my Arduino to labview, this variable is the response.

here is a part of my code:

schema.PNG

 

 

0 Kudos
Message 6 of 21
(7,850 Views)

Can you show us what this U8 looks like on the front panel? It's an array of U8, each element probably represents a char....

0 Kudos
Message 7 of 21
(7,848 Views)

response.PNG

0 Kudos
Message 8 of 21
(7,834 Views)

Try using the "Byte Array to String" function: http://zone.ni.com/reference/en-XX/help/371361L-01/glang/byte_array_to_string

Craig H. | CLA CTA CLED | Applications Engineer | NI Employee 2012-2023
0 Kudos
Message 9 of 21
(7,789 Views)
Define 'custom command'. What have you programmed the arduino to send? It's silly to try and guess when you should be able to provide such basic information.
0 Kudos
Message 10 of 21
(7,772 Views)