So I've been playing around with this PIC 18F4520 IC I have and have been writing a pretty large program (in terms of pages). I've been frustrated for a whole day now on why a function won't work and has undesirable behaviour - returns 0 or crashes or resets the PIC... Then I realised something - the code was too long for one page and I've been coding in the next page without knowing it.
So (this is all reloctable code - NOT absolute) I read up on using BANKSEL and PAGESEL in GPUtils... Unfortunately, it appears to do buggar all, I'm not sure if I'm using it wrong or if features is bugged and just isn't working. This is the code I'm using (from the lst to see the addresses):
000288 0b0f andlw 0xf ANDLW b'00001111' PAGESEL 400h PAGESEL FUNC 00028a ec00 call 0x400, 0 CALL FUNC 00028c f002 PAGESEL $ 00028e 0100 movlb 0 BANKSEL d2 ..... org 0x400 000400 010f movlb 0xf FUNC BANKSEL PCL PAGESEL $ 000402 6e02 movwf 0x2, 0 movwf d1 000404 0e04 movlw 0x4 movlw b'00000100'And as can be seen - PAGESEL is doing nothing if I provide it with the function name or an address, I have to alter the PCLATH register manually as if I'm using absolute assembly which is a bit dumb and will always vary depending on what's added or what it's linked with or if anything is changed so I'm unsure if I'm doing something wrong or if I need to report a bug.
(Compiling using: gpasm -c 18f4520LCD.asm, linking using: gplink -m -c -s /usr/share/gputils/lkr/18f4520.lkr -o 18f4520LCD 18f4520LCD.o)
Anyone else got GPUtils, a programmer and can see if this is happening when they try this?