EEDATA - EE Data Register

Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Bit 2

Bit 1

Bit 0

-

-

-

-

-

-

-

-

This register is used to hold data being sent to, or read from the EEPROM. If you are writing to the EEPROM you put the value to be written into this register. If you are reading the PICmicro will put the value it has read into this register for you to collect.

EEADR - EE Address Register

Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Bit 2

Bit 1

Bit 0

-

-

-

-

-

-

-

-

You use this register to tell the PICmicro which location in the EEPROM you wish to interact with. The register is 8 bits wide, which implies 256 locations. However, in the PICmicro we are using only the bottom 32 locations are available.

EECON1 - EE Control Register 1

Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Bit 2

Bit 1

Bit 0

-

-

-

EEIF

WREER

WREN

WR

RD

Bits 7, 6 and 5 are not used in this register.

EEIF - EEPROM write operation Interrupt Flag

If this flag is set it indicates that a write operation on the EEPROM has completed. If you have enabled interrupts from the EEPROM write operation you will need to clear this bit in your interrupt handler to allow another interrupt to be generated from the next write. If you are not using interrupts you can still look at this bit to see if an EEPROM write has completed.

WREER - WRite Eeprom ERror

This bit is set if a write failed. A write could fail if the PICmicro is reset or a watchdog timeout occurs during the write operation. In either of these cases this bit is set to indicate that the write did not succeed. You should check this bit after a write to ensure that it completed OK.

WREN - WRite ENable

This bit must be set to enable a write operation. You must set this bit at the start of the write sequence. You should clear the bit at the end of your writes, to prevent inadvertent writes to EEPROM. The PICmicro automatically clears this bit on reset and also each time the watchdog timer times out (if it is enabled).

WR - WRite

You set this bit when you want to write to the EEPROM. You can't clear the bit, it is cleared by the hardware when the write is complete. Note that because writing to EEPROM is rather slow, this bit is not cleared immediately after it being set.

RD - ReaD

You set this bit when you want to read the EEPROM memory. As with the write bit, you do not clear the bit, it is cleared for you by the PICmicro when the read has been performed. Note that unlike the write operation, read operations complete in time for the next instruction.

EECON2 - EE Control Register 2

Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Bit 2

Bit 1

Bit 0

-

-

-

-

-

-

-

-

Individual bits in this register are not used, instead it is used as part of the write protection process.