PICkit™ 3 Starter Kit User’s Guide
DS41628B-page 94 2012 Microchip Technology Inc.
3.14.4 New Registers
3.14.4.1 BOTH
3.14.4.1.1 EECON2
In order to write to EEPROM, a special sequence must be performed on EECON2. This
register is only used for EEPROM writes and nothing else.
3.14.5 New Instructions
3.14.5.1 BOTH
3.14.5.1.1 SLEEP
When the SLEEP instruction is executed, the processor is put into Sleep mode with the
oscillator stopped. While sleeping, the processor consumes minimal current (uA lev-
els). During Sleep, some peripherals and interrupts continue to operate.
Upon entering Sleep mode, the following conditions exist:
1. CPU clock is disabled.
2. 31 kHz LFINTOSC is unaffected and peripherals that operate from it may con-
tinue operation in Sleep.
3. Timer1 external oscillator is unaffected, and peripherals that operate from it may
continue operation in Sleep.
4. ADC is unaffected, if the dedicated FRC clock is selected.
5. I/O ports maintain the status they had before.
6. SLEEP was executed (driving high, low or high-impedance).
7. Resets other than WDT are not affected by Sleep mode.
The reader should refer to individual peripheral chapters for more details on peripheral
operation during Sleep.
The interrupt-on-change that both devices utilize in this lesson will wake the processor
from Sleep to perform the EEPROM write and ADC reading.
3.14.6 Assembly Language
3.14.6.1 BOTH
The code only reads and writes one byte from EEPROM. The address, 0x00, is defined
in the first few lines of the program. Much like the previous lesson,
EECON1/EEADRL/EEDAT is used throughout for all memory writes/reads.
An EEPROM write requires that a unique sequence is written to the EECON2 virtual
register.
TABLE 3-44: NEW REGISTERS FOR BOTH DEVICES
Register Purpose
EECON2 Performs the required write sequence
TABLE 3-45: NEW INSTRUCTIONS FOR BOTH DEVICES
Instruction English Purpose
SLEEP Go to Sleep Low-power operation