naseeam
asked on
How to manipulate floating point number in ARM 7 ?
How do I manipulate floating point numbers in ARM 7 based target ?
Our embedded application is based on ARM 7 Microcontroller. This microcontroller does not have floating point unit.
We are using Keil's compiler, assembler, linker, and Real-Time Operating System.
I'm getting unsigned32 minutes over modbus. I need to convert them to hours and send over USB to PC application.
i.e.
Given: 5351 minutes
My embedded application needs to: 5351 / 60 = 89.18333...
Then, I would send 891 or 892 to PC application. They would divide by 10 to display 891 or 892 hours.
What are my options ?
1) Does Keil provide any floating point library ?
2) Floating point math is usually eliminated in embedded systems. Instead, fixed-point math is used. Does Keil provide fixed point math library?
3) Use shift operations to achieve my goal?
What would be the best way to convert minutes to hours in my embedded application?
Our embedded application is based on ARM 7 Microcontroller. This microcontroller does not have floating point unit.
We are using Keil's compiler, assembler, linker, and Real-Time Operating System.
I'm getting unsigned32 minutes over modbus. I need to convert them to hours and send over USB to PC application.
i.e.
Given: 5351 minutes
My embedded application needs to: 5351 / 60 = 89.18333...
Then, I would send 891 or 892 to PC application. They would divide by 10 to display 891 or 892 hours.
What are my options ?
1) Does Keil provide any floating point library ?
2) Floating point math is usually eliminated in embedded systems. Instead, fixed-point math is used. Does Keil provide fixed point math library?
3) Use shift operations to achieve my goal?
What would be the best way to convert minutes to hours in my embedded application?
ASKER
Thank you very much for great answer. If I use Keil's floating point library, I'll get floating point hours. I need integer hours because I need to send them to PC application as integer.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
IOW, even though your CPU does not have a FPU, the compiler supplied runtime will take care of that.
See also http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471j/pge1358786964007.html ("1.8 ARM and Thumb floating-point build options (ARMv7 and later)")