clrf TBLPTRU, 1 movlw 00000000b movwf TBLPTRH, 1 movlw 00000000b movwf TBLPTRL, 1 F_write btfsc EECON1, WR, 1 ; Check to see if a write or goto $-2 ; erase is still in progress movlw d'32' movwf tmpctr, 0 ; 32 loop counter lptab movff POSTINC0, TABLAT ; Move RAM to table latch tblwt *+ ; Store and then increment pointer decfsz tmpctr, f, 0 ; Decrement loop counter goto lptab tblrd *- ; Dummy TBLPTR decrement bsf EECON1, EEPGD, 1 ; Flash pointer bcf EECON1, CFGS, 1 ; Access Flash bsf EECON1, WREN, 1 ; Write enabled movlw 0x55 movwf EECON2, 1 movlw 0xAA movwf EECON2, 1 ; Required sequence bsf EECON1, WR, 1 ; Start flash write cycle return