Float_Read(ptr) /*Value to be stored to EEPROM */ char xdata *ptr; { union /* UNION to access the bytes of int */ { float i; char split[4]; }data_trans; data_trans.split[0] = Read_EEPROM(ptr); data_trans.split[1] = Read_EEPROM(ptr+1); data_trans.split[2] = Read_EEPROM(ptr+2); data_trans.split[3] = Read_EEPROM(ptr+3); printf("Float in Function=%\n",data_trans.i); return (data_trans.i); } when the function return the float then its zero but the value of float in same function is right, Is it any problem with return statment?
Assuming you wrote the value in the right order, you might want to check your printf statement.