PIC18F2XXX/4XXX FAMILY
DS30009622M-page 28 2010-2015 Microchip Technology Inc.
3.3 Data EEPROM Programming
Data EEPROM is accessed one byte at a time via an Address Pointer (register pair: EEADRH:EEADR) and a data latch
(EEDATA). Data EEPROM is written by loading EEADRH:EEADR with the desired memory location, EEDATA, with the
data to be written and initiating a memory write by appropriately configuring the EECON1 register. A byte write
automatically erases the location and writes the new data (erase-before-write).
When using the EECON1 register to perform a data EEPROM write, both the EEPGD and CFGS bits must be cleared
(EECON1<7:6> = 00). The WREN bit must be set (EECON1<2> = 1) to enable writes of any sort and this must be done
prior to initiating a write sequence. The write sequence is initiated by setting the WR bit (EECON1<1> = 1).
The write begins on the falling edge of the 4th PGC after the WR bit is set. It ends when the WR bit is cleared by
hardware.
After the programming sequence terminates, PGC must still be held low for the time specified by Parameter P10 to allow
high-voltage discharge of the memory array.
FIGURE 3-6: PROGRAM DATA FLOW
Note: Data EEPROM programming is not available on the following devices:
PIC18F2410 PIC18F4410
PIC18F2450 PIC18F4450
PIC18F2510 PIC18F4510
PIC18F2515 PIC18F4515
PIC18F2610 PIC18F4610
Start
Start Write
Set Data
Done
No
Yes
Done?
Enable Write
Sequence
Set Address
WR bit
clear?
No
Yes
2010-2015 Microchip Technology Inc. DS30009622M-page 29
PIC18F2XXX/4XXX FAMILY
FIGURE 3-7: DATA EEPROM WRITE TIMING
n
PGC
PGD
PGD = Input
0000
BSF EECON1, WR
4-Bit Command
1234
1
21516
P5
P5A
P10
12
n
Poll WR bit, Repeat until Clear
16-Bit Data
Payload
1234
1
21516 123
P5
P5A
4
1 2 15 16
P5 P5A
0000
MOVF EECON1, W, 04-Bit Command
0000
4-Bit Command
Shift Out Data
MOVWF TABLAT
PGC
PGD
(see below)
(see Figure 4-4)
PGD = Input PGD = Output
Poll WR bit
P11A
PIC18F2XXX/4XXX FAMILY
DS30009622M-page 30 2010-2015 Microchip Technology Inc.
TABLE 3-7: PROGRAMMING DATA MEMORY
4-Bit
Command
Data Payload Core Instruction
Step 1: Direct access to data EEPROM.
0000
0000
9E A6
9C A6
BCF EECON1, EEPGD
BCF EECON1, CFGS
Step 2: Set the data EEPROM Address Pointer.
0000
0000
0000
0000
0E <Addr>
6E A9
OE <AddrH>
6E AA
MOVLW <Addr>
MOVWF EEADR
MOVLW <AddrH>
MOVWF EEADRH
Step 3: Load the data to be written.
0000
0000
0E <Data>
6E A8
MOVLW <Data>
MOVWF EEDATA
Step 4: Enable memory writes.
0000 84 A6 BSF EECON1, WREN
Step 5: Initiate write.
0000 82 A6 BSF EECON1, WR
Step 6: Poll WR bit, repeat until the bit is clear.
0000
0000
0000
0010
50 A6
6E F5
00 00
<MSB><LSB>
MOVF EECON1, W, 0
MOVWF TABLAT
NOP
Shift out data
(1)
Step 7: Hold PGC low for time P10.
Step 8: Disable writes.
0000 94 A6 BCF EECON1, WREN
Repeat Steps 2 through 8 to write more data.
Note 1: See Figure 4-4 for details on shift out data timing.

PIC18LF4510-I/PT

Mfr. #:
Manufacturer:
Microchip Technology
Description:
8-bit Microcontrollers - MCU 32KB 1536 RAM 36I/O
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union