gnupic: Re: [gnupic] function pointers? (was Re: [gnupic] Relocation problems with gplink)
Subject:
Re: [gnupic] function pointers? (was Re: [gnupic] Relocation
problems with gplink)
From:
Peter Onion ####@####.####
Date:
21 May 2005 08:53:28 +0100
Message-Id: <1116661982.6300.25.camel@HP.RoomLan>
On Sat, 2005-05-21 at 12:54 +0000, Iain Dooley wrote:
> loop:
> ;load the value of the function table into fsr
> lfsr FSR0,function_table
> ;load the count into WREG
> movf count,W
> ;execute the function using PLUSW0
> movff PLUSW0,PCL ;??????? THIS IS THE STEP THAT I'M NOT SURE OF!!!
> ;have we executed all our functions?
> decfsz count
> ;nope, go and do it again
> bra loop
> ;yep, finish the program
> end
I think this is 18F code ? Sorry but I've not moved onto these yet, so
I only have a solution for 16F devices, and I'm not 100% sure it is
correct as I just discovered it doesn't work if some of the code is NOT
in the first bank ! Looks like a PCLATH problem.
But here is the "nearly working code I use"
decode:
banksel EEADR
movwf EEADR
banksel EEADRH
movlw high ASCIITable
movwf EEADRH
banksel EECON1
bsf EECON1 & 0x7F,EEPGD
bsf EECON1 & 0x7F,RD
nop
nop
banksel EEDATH
movf EEDATH,W
movwf PCLATH
movf EEDATA,W
movwf PCL
Maybe this will help
you
Peter