Notifications
Clear all
Topic starter
09/06/2016 6:59 pm
Hi,
we want to control this device and get result. (NF 5035)
We dont understand the data format.
we read start Frequency command : 20 01 00
Result : 20 00 00 00 00 3F
What can i do for read décimal value of 500 Hz?
We try some methode on your post but nothing work. We try the topic where address is under.
viewtopic.php?f=8&t=953
our code test is :
fred@ ~ $ cat test.c #include <stdio.h> uint32_t a = 0x44d5c000, b = 0x3f000000; void main(void) { printf(" a = %04x = %fn", a , (float) a); printf(" b = %04x = %fn", b , (float) b); } fred@ ~ $ make test cc test.c -o test fred@ ~ $ ./test a = 44d5c000 = 1154859008.000000 b = 3f000000 = 1056964608.000000
Thanks for give me an answer.
Hervé Lagosanto
LEIC
21/06/2016 2:35 am
You cannot use the value directly unfortunately. First you need to reverse the byte-order, then you need to do a bitlevel conversion to float (using the normal cast operator will do a numeric conversion), check the linked post for an example.
Share: