Keil Logo

C51: CONST VARIABLE BANKING WITH SILABS C8051F12X DEVICES


Information in this article applies to:

  • C51 Version 7

QUESTION

Can I use code banking and constant variable banking on Silicon Laboratories (former Cygnal)C80C51F120, C80C51F121, C80C51F122, and C80C51F123 devices?

ANSWER

Yes. You may easily configure the Keil C51 tools to use code banking and constant banking on these SiLabs devices. Additionally, the Keil µVision2 Debugger fully simulates code banking with these parts.

To begin, configure the L51_BANK.A51 file for Banking Mode 4.

It is important that the field IFBANK and COBANK have the same value, so, the SWITCH Macros should be set as follows:

SWITCH0         MACRO            ; Switch to Memory Bank #0
                MOV     PSBANK,#00H
                ENDM
;
SWITCH1         MACRO            ; Switch to Memory Bank #1
                MOV     PSBANK,#11H
                ENDM
;
SWITCH2         MACRO            ; Switch to Memory Bank #2
                MOV     PSBANK,#22H
                ENDM
;
SWITCH3         MACRO            ; Switch to Memory Bank #3
                MOV     PSBANK,#33H
                ENDM

Next, the startup code (STARTUP.A51) must be modified to call the ?B_SWITCH1 function.

; This code is required if you use L51_BANK.A51 with Banking Mode 4
 EXTRN CODE (?B_SWITCH1)
;               CALL    ?B_SWITCH1      ; init bank mechanism to code bank 1

Basically the SiLabs Banking mechanism is identical to the example hardware documented in the Code Banking section of the BL51 User's Guide. No code may be assigned to bank 0 since this hardware decoding is used for the common area.

With the extended LX51 Linker/Locater that is available in the PK51 Professional Developers Kit you can locate constants in code banks using the far const memory support. For more information take a look at the example in \KEIL\C51\EXAMPLES\FarMemory\1MB Constants on Classic 8051\.

When using the LX51 Linker/Locater you can directly generate the HEX file image using the LX51: GENERATING HEX FILES FOR BANKED APPLICATIONS directive.

MORE INFORMATION

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Monday, July 18, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.