clrf TBLPTRU, 1 movlw 00000000b movwf TBLPTRH, 1 movlw 00000000b movwf TBLPTRL, 1 F_erase bsf EECON1, EEPGD, 1 ; Flash pointer bcf EECON1, CFGS, 1 ; Access Flash bsf EECON1, WREN, 1 ; Write enabled bsf EECON1, FREE, 1 ; Erase 64 byte row enable btfsc EECON1, WR, 1 ; Check to see if a write or goto $-2 ; erase is still in progress movlw 0x55 movwf EECON2, 1 movlw 0xAA movwf EECON2, 1 ; Required sequence bsf EECON1, WR, 1 ; Start erase cycle return