mahm150
Full Member level 1
- Joined
- Dec 14, 2010
- Messages
- 98
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,288
- Location
- Cairo, Egypt, Egypt
- Activity points
- 2,001
I have error in reading from internal EEprom (2byte)as word and show this value in LCD,this error not
occur all the time but the word appear in lcd some times with the correct value and sometimes with un correct value ??, i test the function in simulation and simulator it work ok but in real word it work sometimes ... and sometimes.
my functions
if intialize count =0 it appear sometimes 4096 ?? and sometimes 0
and if count1 ================>4097
---------- Post added at 19:12 ---------- Previous post was at 19:10 ----------
unsigned int count;
occur all the time but the word appear in lcd some times with the correct value and sometimes with un correct value ??, i test the function in simulation and simulator it work ok but in real word it work sometimes ... and sometimes.
my functions
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 //////////////////////////////////////////////////////////////////////////////////// unsigned char string[25]; unsigned int EEprom_read_word(unsigned int address) { unsigned char x=0,data; unsigned int long_data; unsigned int local_address; local_address=address; local_address+=1; while(x<9) { data=EEprom_READ(local_address);// long_data = (long_data << x)|data ;//(unsigned int) x+=8; local_address-=1; } return long_data ; } ////////////////////////////////////////// unsigned char EEprom_READ(unsigned int address) { unsigned char data ; while(EECR & 1<<EEWE);//(0<<EEMWE|1<<EEWE |0<<EERE)); EEAR=address; // 16 bit EECR|=(1<<EERE); data=EEDR; return data; } //////////////////////////////////////////////// count = EEprom_read_word(count_address); ltoa(count,string);// lcd_puts (string); /////////////////////////////////////////////////
if intialize count =0 it appear sometimes 4096 ?? and sometimes 0
and if count1 ================>4097
---------- Post added at 19:12 ---------- Previous post was at 19:10 ----------
unsigned int count;