|
|||||||||||||||||||||||||||||||||||||||||||||||||
Technical Support On-Line Manuals Cx51 User's Guide ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
XBANKING.A51This file provides routines for far (HDATA) and far const (HCONST) memory type support. The extended LX51 linker/locator manages the extended address spaces HDATA and HCONST that are addressed with far and far const. The Cx51 Compiler uses a 3-byte generic pointer to access these memory areas. Variables defined with the far memory type are placed in the memory class HDATA. Variables defined with const far get the memory class HCONST. The LX51 linker/locator allows you to locate these memory classes in the physical 16MB code or 16MB xdata spaces. To use far memory with the C51 Compiler for classic 8051 devices you must use the VARBANKING directive. The memory types far and far const provide support for the large code/xdata spaces of new 8051 devices. If the MCU you are using provides an extended 24-bit DPTR register, you may adapt the default version of the file XBANKING.A51 and define the symbols listed in the following table.
The far memory type allows you to address special memory areas like EEPROM space or strings in code banking ROM. Your application accesses these memory areas as if they are a part of the standard 8051 memory space. Example programs in the folder C51\EXAMPLES\FARMEMORY show how to use the C51 far memory type on classic 8051 devices. If an example that fulfills your requirements is not provided, you may adapt the access routines listed in the table below.
Each access routine gets as a parameter the memory address in a 3-byte pointer representation in the MCU registers R1/R2/R3. The register R3 holds the memory type value. For classic 8051 devices, the Cx51 Compiler uses the following memory type values:
The R3 values 0x00, 0x01, 0xFE and 0xFF are already handled within the run-time library. Only the values 0x02 - 0xFE are passed to the XPTR access routines described above. The AX51 macro assembler provides the MBYTE operator that calculates the R3 value that needs to be passed to the XPTR access function. Below is an AX51 Assembler example for using XPTR access functions: MOV R1,#LOW (variable) ; gives LSB address byte of variable MOV R2,#HIGH (variable) ; gives MSB address byte of variable MOV R3,#MBYTE (variable) ; gives memory type byte of variable CALL ?C?CLDXPTR ; load BYTE variable into A | ||||||||||||||||||||||||||||||||||||||||||||||||
|
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.