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.
Well, at least you've learned to use the 'pre' and '/pre' tags in the 3 days since you last posted this:
http://www.keil.com/forum/docs/thread8182.asp
But what do you suppose that this line would actually do:
EECON |= OxOO;
even if it did compile?
always use copy-and-paste from your actual source file when posting code; never manually re-type the code into the forum!
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