English
Language : 

PIC16F1847_13 Datasheet, PDF (110/440 Pages) Microchip Technology – 18/20/28-Pin Flash Microcontrollers with XLP Technology
PIC16(L)F1847
EXAMPLE 11-4: ERASING ONE ROW OF PROGRAM MEMORY -
; This row erase routine assumes the following:
; 1. A valid address within the erase block is loaded in ADDRH:ADDRL
; 2. ADDRH and ADDRL are located in shared data memory 0x70 - 0x7F
BCF
BANKSEL
MOVF
MOVWF
MOVF
MOVWF
BSF
BCF
BSF
BSF
MOVLW
MOVWF
MOVLW
MOVWF
BSF
NOP
NOP
BCF
BSF
INTCON,GIE
EEADRL
ADDRL,W
EEADRL
ADDRH,W
EEADRH
EECON1,EEPGD
EECON1,CFGS
EECON1,FREE
EECON1,WREN
; Disable ints so required sequences will execute properly
; Load lower 8 bits of erase address boundary
; Load upper 6 bits of erase address boundary
; Point to program memory
; Not configuration space
; Specify an erase operation
; Enable writes
55h
EECON2
0AAh
EECON2
EECON1,WR
; Start of required sequence to initiate erase
; Write 55h
;
; Write AAh
; Set WR bit to begin erase
; 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
EECON1,WREN
INTCON,GIE
; Disable writes
; Enable interrupts
DS40001453D-page 110
Preliminary
 2011-2013 Microchip Technology Inc.