//EEPROM2.C//EEPROM2.c
//#include <16F628.h>
#include <16F648A.h>
#use delay(clock=4000000)
#fuses XT,PUT,BROWNOUT,MCLR,NOWDT,NOPROTECT,NOLVP
#use rs232(baud=9600, xmit=PIN_A0, rcv=PIN_A1)
#include <input.c>
#rom 0x2100={1,2,3,4}
void DumpEEPROM(void)
{
int vol,i,j,k;
k=0;
for(i=0; i<8; ++i)
{
printf("%4X: ",k); //EEPROM in hex
for(j=0;j<=15;++j)
{
printf( "%2X ",read_eeprom(i*16+j));
if(j==7)
printf("- ");
}
printf("\r\n");
k+=16;
}
printf("\r\n");
}
void main()
{
BYTE i, j, address, value;
do
{
DumpEEPROM();
printf("\r\Address to change: ");
address = gethex();
printf("\r\n");
printf("\r\n%2X:%2X New value:",address,read_eeprom(address));
value = gethex();
printf("\r\n");
write_eeprom( address, value );
} while (TRUE);
}