??? 06/11/10 05:51 Modified: 06/11/10 06:46 Read: times |
#176595 - how to convert dword to IEEE754? |
Hello people,
I need to send data to PLC via Modbus in this float.point format. Microcontroller is programmed on assembler. IEE754 target is single precision 23 bit mantissa, 8 bit exponent ,one bit sign. My data is 4 bytes integer - let say grams. I'm wondering how to convert numbers. There are 2 issiues for me: A) I read some examples,but have troubles to understand how to do it. What i think: 1)clear second dword and counter. 2)check is first dword == 1 .If yes - exit to step 4 ,else continue to next step 2. 2)shift right first dword into second dword , increment counter 3)loop to step 2. 4)counter contains unshifted (as per IEE754) exponent so 0x80 should be added 5)shift right counter into second dword to get mantissa. B)If needed representation is in "kilogram" units i'll need to divide by 1000. How to do this easy? Hope in Your advises! regards Stefan |
Topic | Author | Date |
how to convert dword to IEEE754? | 01/01/70 00:00 | |
What environment hosts this? | 01/01/70 00:00 | |
Which format are you aiming for? | 01/01/70 00:00 | |
sorry | 01/01/70 00:00 | |
One thing to consider is C | 01/01/70 00:00 | |
You are going to have to load it. | 01/01/70 00:00 | |
thank You, | 01/01/70 00:00 |