Bank Type Qualifier

The __bank(n) type qualifier and the -maddrqual compiler option are used to place objects in a particular memory bank.

The data memory on PIC devices is arranged into memory banks. The compiler automatically allocates objects to one of the available banks, but there are times when you might require the object to be located in a particular bank, as might be the case if assembly code selects that bank prior accessing the object. They can be used to place objects in banks 0 through 3 (higher bank selection is not currently available).

This qualifier can be used with any variable with static storage duration, for example to following places playMode into bank 1:

__bank(1) unsigned char playMode;

These qualifiers are controlled by the compiler option -maddrqual, which determines their effect (see Addrqual Option). Based on this option’s settings, these qualifiers can be binding or ignored (which is the default operation). Qualifiers which are ignored will not produce an error or warning, but will have no effect.