Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5365

Strings That Contain an IEEE-Format Real Number to a Real Variable

$
0
0

Hello all,

 

I'm struggling with the soft trying to convert the measured value from a peripheral in format IEEE 32 bit float that I have in a unsigned char string[200] (bytes 56, 57, 58 and 59) into a double freq variable to show the value on a numeric control and save it on a csv file.

 

What I do is to get my 4 bytes in a separate unsigned char array unsigned char LatY[4] and then:

 

I have seen other related forums here but it doesn't work for me:

1)  Scan (LatY, "%1f[z]>%f", &freq); -> error trying to read beyond the array

2)  Fmt(freq, "%1f[z]", *(float*)LatY); -> no compatible format error

 

Can anyone please tell me if there is a direct way to do this? better than handling bit by bit in operations...

 


Viewing all articles
Browse latest Browse all 5365

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>