Dec 28, 2013 #1 Raady Here Full Member level 5 Joined Jun 8, 2013 Messages 242 Helped 26 Reputation 52 Reaction score 26 Trophy points 28 Location India Activity points 1,571 Hi, I am unable to read the exact values from EEPROM, I am getting negative values when read ! Please suggest me, if my syntax had gone wrong ! View attachment EEPROM.rar Zipping the code in attachments Code: ptr = (unsigned char*)&Voltage_Low ; Write_String_EEPROMx(2,ptr, EE_CUTOFF_LOW); ptr1= (unsigned char*)&Voltage_Low ; Read_String_EEPROMx(2,(unsigned char*)&ptr1, EE_CUTOFF_LOW); Voltage_Low1 = ConvertSTRING_Int(ptr1,2); printf("\n Voltage_Low: %d",Voltage_Low1); ptr = (unsigned char*)&MUL_R; Write_String_EEPROMx(4, ptr, EE_MULT_FACT_R); Read_String_EEPROMx(4, ptr, EE_MULT_FACT_R);
Hi, I am unable to read the exact values from EEPROM, I am getting negative values when read ! Please suggest me, if my syntax had gone wrong ! View attachment EEPROM.rar Zipping the code in attachments Code: ptr = (unsigned char*)&Voltage_Low ; Write_String_EEPROMx(2,ptr, EE_CUTOFF_LOW); ptr1= (unsigned char*)&Voltage_Low ; Read_String_EEPROMx(2,(unsigned char*)&ptr1, EE_CUTOFF_LOW); Voltage_Low1 = ConvertSTRING_Int(ptr1,2); printf("\n Voltage_Low: %d",Voltage_Low1); ptr = (unsigned char*)&MUL_R; Write_String_EEPROMx(4, ptr, EE_MULT_FACT_R); Read_String_EEPROMx(4, ptr, EE_MULT_FACT_R);
Dec 28, 2013 #2 alexan_e Administrator Joined Mar 16, 2008 Messages 11,888 Helped 2,021 Reputation 4,158 Reaction score 2,031 Trophy points 1,393 Location Greece Activity points 64,371 The question without mention of the controller and IDE can't be answered properly
Dec 28, 2013 #3 FvM Super Moderator Staff member Joined Jan 22, 2008 Messages 52,491 Helped 14,757 Reputation 29,796 Reaction score 14,124 Trophy points 1,393 Location Bochum, Germany Activity points 298,396 You are writing an reading an integer in binary format. Performing ConvertSTRING_Int() makes no sense. Why do you think that the operations with float value goes wrong?
You are writing an reading an integer in binary format. Performing ConvertSTRING_Int() makes no sense. Why do you think that the operations with float value goes wrong?
Dec 29, 2013 #4 Raady Here Full Member level 5 Joined Jun 8, 2013 Messages 242 Helped 26 Reputation 52 Reaction score 26 Trophy points 28 Location India Activity points 1,571 Sorry forgot mentioning details PIC30F5011, MPLAB8.8V In the example I quoted I have written 200 (int value), but when reading int I am getting it as -360 and when convert to int it shows some block. It similar when with float it shows 0.0000 what ever value is inserted !
Sorry forgot mentioning details PIC30F5011, MPLAB8.8V In the example I quoted I have written 200 (int value), but when reading int I am getting it as -360 and when convert to int it shows some block. It similar when with float it shows 0.0000 what ever value is inserted !
Dec 30, 2013 #5 Raady Here Full Member level 5 Joined Jun 8, 2013 Messages 242 Helped 26 Reputation 52 Reaction score 26 Trophy points 28 Location India Activity points 1,571 Thanks FVM, I get what you said. I wrote in binary format and again making conversion !