My source assembles with the following message:
Message[302] myfile.ASM 136 : Register in operand not in bank 0. Ensure that bank bits are correct.
What am I doing wrong? This isn't an error, but it obviously means that something doesn't look right to mpasm and I am not trying to do anything unusual at all.
Its just a warning that you need to select the correct bank since you are addressing a register over 0x7F, however, even if you have inserted the banksel command, you will still get the same warning (not an overly intellegent assembler here).
You can remove the warning message by inserting the following at the top of your file
ERRORLEVEL -302 ;remove message about using proper bank
But if you do make a mistake, the assembler will not catch it and this type of error can be very hard to debug.
Dwayne Reid of Trinity Electronics Systems Ltd Edmonton, AB, CANADA says
Not a problem - just a warning message that MPASM noticed that you were writing to a register with an address higher than 0x7F. The message is remind you to check that you have set the ram page bits correctly.I use macros to ensure that the message is generated only if I've been careless. I'll give a couple of them here - you can extend them to all the opcodes that you may use or email me privately and I'll send the whole lot to you. [If you] set the ram page bits, then use [for example]
movwf1 TRISB[rather than]
movwf TRISBNo more error message.
The reason for inverting the MSB in the following macros instead of just masking it is to make sure that I'm paying attention to what page I'm in - if I am in page 0 and use a page 1 macro, I get the warning message.
Macros follow:
rampg0 MACRO ;set RAM page 0 bcf _RP0 endm rampg1 MACRO ;set RAM page 1 bsf _RP0 endm rampg2 MACRO ;set RAM page 2 error Ram Page 2 not available on this part endm rampg3 MACRO ;set RAM page 3 error Ram Page 3 not available on this part endm bcf1 MACRO reg,bit ;diddle bits in RAM bank 1 bcf (reg^0x80),bit ;invert MSB endm bsf1 MACRO reg,bit ;diddle bits in RAM bank 1 bsf (reg^0x80),bit ;invert MSB endm movwf1 MACRO arg ;diddle regs in RAM bank 1 movwf (arg^0x80) ;invert MSB endm movfw1 MACRO arg ;diddle regs in RAM bank 1 movfw (arg^0x80) ;invert MSB endm swapf1 MACRO arg,d ;diddle regs in RAM bank 1 swapf (arg^0x80),d ;invert MSB endm andwf1 MACRO arg,d ;diddle regs in RAM bank 1 andwf (arg^0x80),d ;invert MSB endm
Also:
I am getting an MPASM Error [113] "Symbol not previously defined" on a simple GOTO statement. The assembler thinks my label is a variable. Other GOTOs in the program work fine but 3 GOTOs yield this error. Could it be a paging error where it is not finding the label elsewhere in the program? I am using a 16F873. I can't imagine I am running out of program memory! thanks vpl
Comments: