i'm trying to read the saved value from eeprom, reading eeprom as a char is easily done after convert the read data into integer is not working here my code is :
char AM[];
int per,vt,vtt;
AM[0]=eeprom_read(ecur[0]);
__delay_ms(50);
AM[1]=eeprom_read(ecur[1]);
__delay_ms(50);
AM[2]=eeprom_read(ecur[2]);
__delay_ms(50);
AM[3]=0;
vcur=atoi(AM);
per=0,vt=0;vtt=0;
per=vcur/100;
vt=vcur+(per*30);
vtt=vcur-(per*30);
LCD_Clear();
LCD_Set_Cursor(1, 1);
LCD_Write_String(vcur);
}
char AM[];
int per,vt,vtt;
AM[0]=eeprom_read(ecur[0]);
__delay_ms(50);
AM[1]=eeprom_read(ecur[1]);
__delay_ms(50);
AM[2]=eeprom_read(ecur[2]);
__delay_ms(50);
AM[3]=0;
vcur=atoi(AM);
//per=AM1;
//vt=AM2;
//vtt=AM3;
//vcur=per*100;
//vcur=vcur+(vt*10);
//vcur=vcur+vtt;
per=0,vt=0;vtt=0;
per=vcur/100;
vt=vcur+(per*30);
vtt=vcur-(per*30);
LCD_Clear();
LCD_Set_Cursor(1, 1);
LCD_Write_String(vcur);
ive already tried atoi,xtoi, not working also tried to read the value from eeprom as int not woking
The user Active watersaver seems very new to creating code for an embedded controller as resource limited as the PIC16F866.
Reading the Microchip documentation and analyzing the implementation of the
eeprom_write();function would likewise be helpful.What the user does not appear to understand is that the EEPROM in the PIC16F866 will only store data in octets (8-bit chunks). Larger data types like
intandlongmust be separated into octets, each octet written to several EEPROM addresses. For reading, all the EEPROM addresses of the octets associated with anintorlongmust be read from the EEPROM, then reassembled in to the associated data type.