Internal EEPROM read write operation of microcontroller use Mikcro C compiler
Internal EEPROM in PIC16F877A
PIC16F877A Microcontroller has three type memory.
Memory Map of EEPROMPIC16F877A Microcontroller has three type memory.
- Flash program memory ( 8kB)
- Data Merory(368 Byte)
- EEPROM Memory (256 Byte)
In this tutorial I am describe how to write and read operation of EEPROM Memory. The data EEPROM and Flash Program Memory are readable and writable during mormal operation over the entire Vdd range.EEPROM abbreviation is Electrically Erasable Programmable Read Only Memory. It is a Non-Volatile and Flash Memory. EEPROM design for high speed and high density at the expense of large erase blocks and number of write cycles.
EEPROM Library of Mikro C Pro For PIC
MikroC PRO for PIC includes library for comfortable work with EEPROM.
Library Routine
EEPROM Memory Write Opertation
Frist time I am write data, address at 080h to 09Fh and data 0x00 to 0x1F.
code: for(ii=0;ii<32;ii++){ // loop for write EEPROM Memory
EEPROM_Write(0x80,ii) ; // 0x80 is EEPROM Address & ii is data variable
}
Second time write data at address 002h and store data 0xAA.
Code: EEPROM_Write(0x02,0xAA);
Third time write data at address 050h and store data 0x55.
Code: EEPROM_Write(0x50,0x55);
EEEPROM Memory Read Operation
First time I read data on PORTB from Memory address 002h and location 2.
Code: EEPROM_Read(0x02);
Data (0xAA) |
Second time I read data on PORTC from Memory address 050h and location 80.
Code: EEPROM_Read(0x50);
Data ( 0x55) |
third time I read data on PORTD from Memory address (080h - 09Fh) and location (128 - 159).
Code: for(ii=0;ii<32;ii++){ // Read 32 bytes block from address0x80
PORTD = EEPROM_Read(0x80+ii); // and display data on PORTDdelay_ms(250);
}
Mikro C Code :
Program code file and proteus file downlaod For click download button.
download |
No comments