English
Language : 

PIC16F818_13 Datasheet, PDF (29/178 Pages) Microchip Technology – 18/20-Pin Enhanced Flash Microcontrollers with nanoWatt Technology
PIC16F818/819
EXAMPLE 3-4: ERASING A FLASH PROGRAM MEMORY ROW
BANKSEL EEADRH
MOVF ADDRH, W
MOVWF EEADRH
MOVF ADDRL, W
MOVWF EEADR
ERASE_ROW
BANKSEL EECON1
BSF
EECON1, EEPGD
BSF
EECON1, WREN
BSF
EECON1, FREE
;
BCF
INTCON, GIE
MOVLW 55h
MOVWF EECON2
MOVLW AAh
MOVWF EECON2
BSF
EECON1, WR
NOP
NOP
BCF
EECON1, FREE
BCF
EECON1, WREN
BSF
INTCON, GIE
; Select Bank of EEADRH
;
; MS Byte of Program Address to Erase
;
; LS Byte of Program Address to Erase
; Select Bank of EECON1
; Point to PROGRAM memory
; Enable Write to memory
; Enable Row Erase operation
; Disable interrupts (if using)
;
; Write 55h
;
; Write AAh
; Start Erase (CPU stall)
; Any instructions here are ignored as processor
; halts to begin Erase sequence
; processor will stop here and wait for Erase complete
; after Erase processor continues with 3rd instruction
; Disable Row Erase operation
; Disable writes
; Enable interrupts (if using)
 2001-2013 Microchip Technology Inc.
DS39598F-page 29