This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EEPROM emulation and floating point values



I'm running a TMS320C28035 MCU and have looked over this: SPRAB69 application report. It is clearly written for storing 16bit values, and I can think of how to modify it for 32bit integers, but I want to store the binary value of a floating point, then be able to read it back.

Is there a simple method of acheiving this?

Specifically in my application I have arrays of floats, ints, and longs and am logging data. On an error I would like to copy the data directly from these arrays and store it into flash to survive a power cycle.

 

  • I got something that seems like it will work for storing, and then I'll do the reverse to recover the data.

    float testvalue[] = {1.35, 3.45};

    float* dataPointer = testvalue;

    Write_Buffer[0] = (Uint16)(*(long*)(dataPointer));

    Write_Buffer[1] = (Uint16)(*(long*)(dataPointer)>>16);

    dataPointer++;

    And then increment to the end of the input array (2 elements in this example).

     

    Let me know if there is a better way of doing this.