Re: Working with HEF

Originally Posted by
mpgmike
Code:
Cyls var byte
Start:
GOSUB Write_HEF
GOSUB Read_HEF
Write_HEF:
ASM
BANKSEL PMADRH
MOVLW 1Fh
MOVWF PMADRH ;PMADRH = $1F, 1st HEF Address is 1F80h
MOVLW 80h
MOVWF PMADRL ;PMADRL = $80
BCF PMCON1,CFGS
BSF PMCON1,WREN
BSF PMCON1,LWLO
???? MOVIW _Cyls see below
MOVWF PMDATL
ENDASM
GOSUB UnlockHef
@ BCF PMCON1,LWLO
GOSUB UnlockHef
@ BCF PMCON1,WREN
RETURN
What am I missing?
start here I think
1st HEF Address is 0x1F80h not 0x0f80
MOVIW _Cyls
this won't work that's an indirect load of wreg but a fsr has not been loaded or selected
Code:
BANKSEL _Cyls
movf _Cyls,w
BANKSEL PMDATL
movwf PMDATL
clrf PMDATH ? ; a write is 1 word
does writecode not work for these chips ?
Last edited by richard; - 16th August 2017 at 10:13.
Reason: a few typos
Warning I'm not a teacher
Bookmarks