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.

TM4C123GH6PM: please help

Part Number: TM4C123GH6PM

Ima using the driver of tivac4m123g6pm in the eeprom section I have a small issue that the funtion that writes and reads from the eeprom takes a parmeter an array of unsigned intgers but i wanted to change it to take array of floats or may be doubles or even array of character and then convert it to floats lates i tried to adjust the function in the driver to do that but it was so hard for me(getting hard fault handler or the array is not rread)  and i cant do that also i used chta gpt but also it doesnt help me so could any one give me another driver or a function to use it .

iam working on a gps project and i want to save my array of latitudes and array of longitudes in the eeprom and they must be floats not intgers

here is my test function 

#include <stdbool.h>
#include <stdint.h>
#include "hw_flash.h"
#include "hw_ints.h"
#include "hw_sysctl.h"
#include "hw_types.h"
#include "debug.h"
#include "flash.h"
#include "interrupt.h"
#include "sysctl.h"
#include "eeprom.h"
#include "hw_eeprom.h"

int main()
{

float latRead[8];
float lat[8] = {
110235,
112348,
115012,
118322,
121521,
124732,
127945,
130015
};


EEPROMInit();

EEPROMMassErase();

//EEPROMRead(latRead, 0x0, sizeof(latRead));


EEPROMProgram(lat, 0x0, sizeof(lat));
EEPROMRead(latRead, 0x0, sizeof(latRead));

while(1)
{
}
}

thank you,

  • The only way I can think of is to first convert the floating point value to an array of char value and then write that char array to the EEprom. TivaWare SDK has a usprintf() function. This is a a lite version of the C runtime library function sprintf(). Refer to the usprintf() function in the C:\ti\TivaWare_C_Series-2.2.0.295\utils\ustlib.c file.