Searching \ for 'Getting an "not in bank 0" error that I can not ge' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/mems.htm?key=bank
Search entire site for: 'Getting an "not in bank 0" error that I can not ge'.

Truncated match.
PICList Thread
'Getting an "not in bank 0" error that I can not ge'
1999\10\15@093748 by Mathew Cohen

flavicon
face
part 0 16 bytes
</x-html>

1999\10\16@021329 by paulb

flavicon
face
Hello Mathew.

> Getting an "not in bank 0" error that I can not get rid of.

 The assembler is brainless.  It has *no idea* what bank you may be in,
or even should be in.  It generates errors literally, just to keep you
on your toes!

 There is a way to do it, but for the moment I'd just forget it.  I
mailed a message with the commands to suppress that message and another
even sillier one IIRC.  Just use them and carefully set up the banks the
way *you* think they should be after careful consideration.  And do
learn to use the TRIS instruction that makes it all far easier in the
first place.

 I'll analyse your code much more carefully after I have a nap and feel
better.
--
 Cheers,
       Paul B.

1999\10\17@215430 by Chris Eddy

flavicon
face
Paul;  I remember this issue over safe use of high and low bank naming in
assembly, so I asked the supreme professor, Andrew Warren.  His answer to me
is below.
Chris Eddy


   Hi, Chris.

   Actually, I DISCOURAGED the practice of doing the XOR in the
   file-register equate; here are the four methods that are
   commonly used, along with my reasons for using Method #4 over
   the others:

   Note:  In the following examples, "XXX" is a register address
          on page 1 (i.e., between 0x80 and 0xFF).

   METHOD 1:

       REG     EQU     XXX-128         ;Generates no warnings, but
               ....                    ;also doesn't allow REG to
               MOVWF   REG             ;be viewed in MPASM watch
                                       ;windows.  Equivalent to:
                                       ;    REG EQU XXX & 0x7F
                                       ;    and
                                       ;    REG EQU XXX ^ 0x80
                                       ;both of which have the same
                                       ;problem.

   METHOD 2:

       REG     EQU     XXX             ;Generates an MPASM warning.
               ....                    ;
               MOVWF   REG             ;

   METHOD 3:

       REG     EQU     XXX             ;Generates no warning, EVEN
               ....                    ;when accidentally used with
               MOVWF   REG & 0x7F      ;a page-0 register.

   METHOD 4:

       REG     EQU     XXX             ;Generates no warning when
               ....                    ;used correctly (i.e., when
               MOVWF   REG ^ 0x80      ;REG is on page 1), but DOES
                                       ;generate a warning when
                                       ;accidentally used with a
                                       ;page-0 register.

1999\10\18@010502 by paulb

flavicon
face
Chris Eddy wrote:

> Paul;  I remember this issue over safe use of high and low bank naming
> in assembly, so I asked the supreme professor, Andrew Warren.  His
> answer to me is below.

 He didn't mention using the TRIS instruction and just doing it
properly?

 Since you ask.  The *really* neat way is to use a variable called,
say, RBANK, and using
       MOVWF   REG^RBANK

 RBANK is set to 0 at the start of the code, and you use two macros:

BANK0   MACRO
RBANK   SET     0
       BCF     STATUS,RB0
       ENDM

BANK1   MACRO
RBANK   SET     0x80
       BSF     STATUS,RB0
       ENDM

 And use them as commands to set and clear the RB bit where you think
they are needed in the code.  If you now get an error, it implies you
didn't set it right though this can be confused by program flow.
--
 Cheers,
       Paul B.

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...