wannaBinventor
Member
I'm wondering if it is possible to enable some feature in MPLAB/use some external program to make my assembly code automatically select the correct bank for the register which I am trying to read from or write to.
The way I figure it, all 16F PICs select banks through either the status register or the bank select register (with a MOVLB command), and W is global, so it doesn't seem like it would be hard to make the assembler automatically insert bank selection commands. In my opinion, the biggest pain of coding in assembly is having to constantly refer to your datasheet to see what bank the register you are operating on is in, and then using BANKSEL or changing the status/BSR to get to it. I think if something could do this for you, it would speed up asm coding at least 20% or 25%.
Here's an example:
Say ADRESH is in bank 2 and I want to copy its contents to a user file called ADRES_HOLD that I created in bank 0.
Is there anything out there that can do this for me?
Thanks!
The way I figure it, all 16F PICs select banks through either the status register or the bank select register (with a MOVLB command), and W is global, so it doesn't seem like it would be hard to make the assembler automatically insert bank selection commands. In my opinion, the biggest pain of coding in assembly is having to constantly refer to your datasheet to see what bank the register you are operating on is in, and then using BANKSEL or changing the status/BSR to get to it. I think if something could do this for you, it would speed up asm coding at least 20% or 25%.
Here's an example:
Say ADRESH is in bank 2 and I want to copy its contents to a user file called ADRES_HOLD that I created in bank 0.
Code:
I'd like to be able to do this:
MOVF ADRESH,W
MOVWF ADRES_HOLD
And have something that auto generates this:
MOVLB 0x02 ;select BANK 2
MOVF ADRESH,W
MOVLB 0x00 ;select BANK 0
MOVWF ADRES_HOLD
Is there anything out there that can do this for me?
Thanks!