Hi Keil,
I have written the follwing code for writing the byte in EEPROM in ED2. The Problem is BUSY flag is not being cleared.
while(!(EECON & 0x01)) ; EA = 0; EECON |= 0x02; XBYTE[0X0055] = 'C'; EECON |= OxOO; EA = 1;
Please provide the suggesion.
hi,
First of all, you should wait till EEBUSY has been set to zero. Your while() waits for the flag will be set to '1' -- that's wrong. Another issue is: to disconnect EEPROM you should use AND but your code shows OR. In sum:
while(EECON & 0x01) ; EA = 0; EECON = 0x02; XBYTE[0X0055] = 'C'; EECON = OxOO; EA = 1;
If the code above is still not work please post assembly code generated by compiler.
Regards, Oleg