How to Data Write into Internal EEPROM of PIC16F877A
The following code demonstrate how to write data on internal EEPROM. The built-in library function is used. The code is written in “mikroC PRO for PIC v.6.6.3” IDE and simulation is done with Proteus 8.0 SP0. At the end of code, you can find complete project files for download.
Note: Pause the simulation, and click on the following option.
Code in mikroC
sbit LED_Dir at TRISC.B0;
sbit LED at PORTC.B0;
void main()
{
char write_buffer[] = {“This data is written to internal EEPROM“};
unsigned short addr = 0;
LED_Dir = 0;
LED = 0;
for(addr=0;addr<strlen(write_buffer);addr++)
{
EEPROM_Write(addr,write_buffer[addr]);
}
LED = 1;
while(1)
{
}
}
sbit LED at PORTC.B0;
void main()
{
char write_buffer[] = {“This data is written to internal EEPROM“};
unsigned short addr = 0;
LED_Dir = 0;
LED = 0;
for(addr=0;addr<strlen(write_buffer);addr++)
{
EEPROM_Write(addr,write_buffer[addr]);
}
LED = 1;
while(1)
{
}
}
Download Files
For download “mikroC PRO for PIC” project and “Proteus 8.0” simulation files, click here.
Comments
Post a Comment