Datasheet

PICkitâ„¢ 3 Debug Express
DS41370C-page 58 © 2009 Microchip Technology Inc.
3.10 LESSON 10: USING INTERNAL EEPROM
The PIC18F45K20 microcontroller includes 256 bytes of on-chip EEPROM for data
storage. This lesson discusses reading and writing the internal EEPROM in software.
3.10.1 Reading a data byte from EEPROM
The EECON1 Special Function Register controls operations to both the internal
EEPROM as well as the program memory Flash array.
FIGURE 3-49: EECON1: EEPROM CONTROL REGISTER 1
Key Concepts
- The 4 SFRs that control EEPROM operations are EECON1, EECON2,
EEDATA and EEADR.
- The internal EEPROM is written and read one byte at a time.
- To write EEPROM, a short code sequence must be written to EECON2
immediately before starting the write operation. This is to prevent inadvertent
EEPROM writes.
- Writing a byte to EEPROM takes a period of time before the write cycle is
complete. The microcontroller will continue to execute code during an
EEPROM write cycle.