PIc16f886 not convert string to int
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
Comments
Post a Comment