This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Does my embedded system have Floating Point Unit?

How do I find out if my embedded system has Floating Point Unit(FPU)? I'm using Keil tools.
Our target board uses NXP LPC2468 series Microcontroller ? Does this microcontroller have FPU? Looking in the microcontroller manual I couldn't find any information on FPU.

  • ARM7, No

    Even the Cortex-M4(F) only has one that supports 32-bit floats, and is still probably bigger than the CPU core.

  • By looking in the Datasheet (or "manual" or whatever the particular manufacturer calls it).

    "in the microcontroller manual I couldn't find any information on FPU"

    That'll be because it doesn't have one, then.

    Manufacturers document what is present on the chip - they don't tend to make an exhaustive list of all features that could ever possibly be included in any processor, and say "not fitted" to all the ones that aren't present!

  • Thank you for answering this question.

    How do I manipulate floating-point numbers in ARM7 based target?

    I'm getting unsigned32 minutes over modbus. I need to convert to hours and send over USB
    to a 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 and dispaly
    891 or 892 hours.

    What are my options ?

    1) Does Keil provide any floating point library.
    2) Usually floaing point math is usually eliminated in embedded systems. Instead, fixed-point math is used. Does Keil provide fixed point math routines?
    3) Use shift operations to achieve my goal?

    What would be best way to convert minutes to hours in my embedded application?

  • Why not just send minutes to the PC, and let the PC do the arithmetic?

  • They tell me it'll break their architecture and break other products.

    You are correct! This really needs to be done on the PC side but we are trying to do it on the embedded side. Please provide a possible solution.

  • Just try a float and see what happens. I should be a bit slower.

    But your situation only has 60 answers.
    So if you insist in eliminating floating point.
    (5351/60) - (int)(5351/60) = 11
    That is 11 times 1/60'th. You can create a lookup table with 60 pre-calculated ascii decimals values in required significance (say 4, a word).
    Just assemble your full integer as string when you send it to the pc.

    But that's just dirty...

  • My embedded application needs to: 5351/60 = 89.18333..

    No, it doesn't. You only think it does, based on insufficient analysis of the task.

    For starters, given what you actually want to calculate is 892:

    Then, I would send 891 or 892 to PC application.

    why on earth do you think you have to calculate 89.18333 instead?

  • This really needs to be done on the PC side

    Nonsense. And that's putting it mildly.

  • 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 and display
    891 or 892 hours.

    Not to appear retarded, but wouldn't (5351 + 3) / 6 do this

    Or more generally y = (x + 3) / 6

    To answer your other questions, yes Keil has software floating point libraries, ARM has had routines since inception. GNU/GCC also has math libraries (libm.a)

    Generally fixed point is implemented by a user who understands the range of the number space they plan on supporting, and they chose a representation which is appropriate. If you understand math, the methods to eliminate the use of floating point should be fairly apparent.

    Not sure shifting helps here, you're attempting to represent numbers in decimal, not binary, as you transmit them. Fixed point would shift the number and provided additional precision. You'd pull out the integer portion first, and then multiply by 10 to extract the fractional digits. Frankly scaling makes more sense here than shifting.

  • >> Not to appear retarded, but wouldn't (5351 + 3) / 6 do this
    >> Or more generally y = (x + 3) / 6

    Yes, it would. I can't understand how. Please explain how you arrived at this formula.

  • Basic math facts:

    60 / 10 = 6

    60 / 2 = 30

    1 / 2 = 0.5

    0.5 * 60 = 30 Multiply by reciprocal, it's computationally cheaper

    30 / 10 = 3

    0.5 * 6 = 3

    Done in floating point

    TenthsOfHours = (int)(((Mins / 60.0) * 10.0) + 0.5); // Rounding up

    In order to maintain precision with integer math we need to move the divide to the final operation
    = (((Mins * 10.0) / 60.0) + 0.5)
    = (((Mins * 1.0) / 6.0) + 0.5)
    = ((Mins / 6.0) + 0.5)
    = ((Mins + 3.0) / 6.0)
    = ((Mins + 3) / 6)

  • Thank you for explaining in detail.

    I already knew basic math facts.

    Thanks again! That was very helpful!

  • Somehow integer arithmetic is so often forgotten just because pocket calculators and PC:s can do floating point.