Erasecode,Writecode,Readcode - again
Can someone tell me why the code below doesn't work?
I'm using an 18F8722. All variables are WORDs.
I do get the proper output for 4 words, starting at
$1F38, but all the other bytes are $FF. I'm on an even word boundary, and $1F00 divides evenly by 64, so I should also be on a block boundary.
For AA = $1F00 to $1F3F STEP 2
ERASECODE AA
NEXT AA
For BB = $1F00 to $1F3F STEP 2
WRITECODE BB,$5555
NEXT BB
For CC = $1F00 to $1F3F STEP 2
READCODE CC,DD
HSEROUT [HEX4 CC," ",HEX4 DD,13,10]
NEXT CC
Re: Erasecode,Writecode,Readcode - again
Good golly, this works. I fussed around with PBP WRITECODE for way too long and gave up, modified Darrel's code slightly, and it works! Here's my code. Thanks Darrel!
Code for PIC18F8722:
FOR IX = 0 TO 63 ' for DEBUG
FLASH_WRITE_BUFF[IX] = IX + 64 ' for DEBUG
NEXT IX ' for DEBUG
' DEBUG WRITE FLASH PROGRAM MEM TEST
ERASECODE FLASH_MEM_START
FOR IX = 0 TO 63 ' load TBLAT
TABLAT = FLASH_WRITE_BUFF[IX]
@ tblwt*+
NEXT IX
TBLPTRL = FLASH_MEM_START
EECON1 = $84
EECON2 = $55
EECON2 = $AA
ASM
BSF EECON1, WR
NOP
BCF EECON1, WREN
ENDASM
TBLPTRL = TBLPTRL + 1
' DONE WRITING FLASH PROGRAM MEM TEST