LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Convert decimal(12.51) to hex value??

Hi All,

 

I am using LabView 8.5.

I have to convert decimal to hex value to write the data into MCU.

But my value is decimal like 12.51.

How can I convert?

 

Thanks,

Cloud

0 Kudos
Message 1 of 8
(2,546 Views)

Hi All,

 

In additional information to my question,

I need to convert the decimal value 12.51 to byte[] to able to write into MCU through RS232.

 

Regards,

Jessie

0 Kudos
Message 2 of 8
(2,539 Views)

How many bytes do you want to represent this value?  (4 bytes for single representation, 8 for double).?

 

Use the typecast function.

0 Kudos
Message 3 of 8
(2,536 Views)

Hi Cloud5,

 Please see this http://digital.ni.com/public.nsf/allkb/DD5AFE8E829DC16D86256BDF005E1F95.

 

Regards,

SrikrishnaNF

Regards,
Srikrishna


0 Kudos
Message 4 of 8
(2,509 Views)

Hi Cloud05,

On the indicator, right click> select representation> select I16 (Word)

This will allow you to select display format in the properties dialog box.

 

Now press right click> select properties>Click display format> select Hexadecimal in the Types menu.

You should see small 'x' on the left of indicator indicating the value in Hexadecimal

 

Please see attached image.

157+ CLDs & 9 CLA Trained
LabVIEW Training resources
0 Kudos
Message 5 of 8
(2,492 Views)

How is the number supposed to be represented according to the manual? Some, e.g. the pump i'm working on right now, uses 1/100s as integer, i.e. 12.51 would be read/sent as 1251. Is the number supposed to be the hex representation or the text representing the hex? (Is it supposed to send 04E3 or the text '04E3')

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 8
(2,484 Views)

Please check attached VI.

 

One array shows 8 byte representation (When 12.51 is considered as double precision)

One array shows 4 byte representation (When 12.51 is considered as single precision)

 

 

This way u can convert it to array and then transfer to serial port.

 

If this is what u r looking for , pls dont forget to add Kudos.Smiley Wink

 

Miraz

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
0 Kudos
Message 7 of 8
(2,437 Views)

Please check attached image

 

One array shows 8 byte representation (When 12.51 is considered as double precision)

One array shows 4 byte representation (When 12.51 is considered as single precision)

 

 

This way u can convert it to array and then transfer to serial port.

 

If this is what u r looking for , pls dont forget to add Kudos.:smileywink:

 

Miraz

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
0 Kudos
Message 8 of 8
(2,431 Views)