|
CLRF TBLPTRU ; load TBLPTR with the base address of the memory block
MOVFF FlashDataPtrH,TBLPTRH ;
MOVFF FlashDataPtrL,TBLPTRL ;BSF EECON1,FREE ; enable Row Erase operation
BSF EECON1,EEPGD ; point to FLASH program memory
BSF EECON1,WREN ; enable write to memory
MOVLF 0x55,EECON2 ; write 55H
MOVLF 0xAA,EECON2 ; write AAH
BSF EECON1,WR ; start program (CPU stall)
NOP ;
MOVLF D'8',TmpCnt ; number of write buffer groups of 8 bytes
_PrgLoop: MOVLW D'8' ; number of bytes in holding register
_nw: MOVFF POSTINC2,TABLAT ; get low byte of buffer data present data to table latch
TBLWT *+ ; write data, perform a short write to internal TBLWT holding register.
DECFSZ WREG ;
BRA _nw ;
TBLRD *- ; Point back into the block__ProgrammMemory:
BSF EECON1,EEPGD ; point to FLASH program memory
BSF EECON1,WREN ; enable write to memory
MOVLF 0x55,EECON2 ; write 55H
MOVLF 0xAA,EECON2 ; write AAH
BSF EECON1,WR ; start program (CPU stall)
NOP ;BCF EECON1,WREN ; disable write to memory
TBLRD *+
DECFSZ TmpCnt ; loop until done
BRA _PrgLoop ;
E-mail: info@telesys.ru