Am I using MPLAB's View EEPROM command wrong? I have written code for 16F876 to write a byte to EEPROM. After running it I refresh the View EEPROM window and nothing has changed. Am I using the tool wrong?
Or is there something wrong with my code? I've written it the hard way as well as the easy way, using BoostC's EEPROM lib.
The (not so) hard way:
Code:
#include "eep.h"
void main(void)
{
while(eecon1.WR){} //wait for write to finish
eeadr=5; //set address to write to
eedata=0x56; //set data to write
eecon1.EEPGD=0; //clear EEPGD - point to EEPROM data memory
eecon1.WREN=1; //enable writes
eecon2=0x55;
eecon2=0xaa;
eecon1.WR=1;
eecon1.WREN=0; //disable writes
while(1){}
}