English
Language : 

PIC18LF24K Datasheet, PDF (136/594 Pages) –
PIC18(L)F26/45/46K40
EXAMPLE 11-4: WRITING TO PROGRAM FLASH MEMORY (CONTINUED)
WRITE_BYTE_TO_HREGS
MOVF
MOVWF
TBLWT+*
POSTINC0, W
TABLAT
DECFSZ
BRA
PROGRAM_MEMORY
BCF
BSF
BSF
BCF
BCF
MOVLW
Required
MOVWF
Sequence
MOVLW
MOVWF
BSF
DCFSZ
BRA
BSF
BCF
COUNTER
WRITE_WORD_TO_HREGS
NVMCON1, NVMREG0
NVMCON1, NVMREG1
NVMCON1, WREN
NVMCON1, FREE
INTCON, GIE
55h
NVMCON2
0AAh
NVMCON2
NVMCON1, WR
COUNTER2
WRITE_BYTE_TO_HREGS
INTCON, GIE
NVMCON1, WREN
; get low byte of buffer data
; present data to table latch
; write data, perform a short write
; to internal TBLWT holding register.
; loop until holding registers are full
; point to Program Flash Memory
; point to Program Flash Memory
; enable write to memory
; enable write to memory
; disable interrupts
; write 55h
; write 0AAh
; start program (CPU stall)
; repeat for remaining write blocks
; re-enable interrupts
; disable write to memory
 2016 Microchip Technology Inc.
Preliminary
DS40001816C-page 136