
- •Chapter 1. Introduction
- •Support for all 8051 Variants
- •Books About the C Language
- •Chapter 2. Compiling with the Cx51 Compiler
- •Environment Variables
- •Running Cx51 from the Command Prompt
- •ERRORLEVEL
- •Cx51 Output Files
- •Control Directives
- •Directive Categories
- •Reference
- •Chapter 3. Language Extensions
- •Keywords
- •Memory Areas
- •Program Memory
- •Internal Data Memory
- •External Data Memory
- •Far Memory
- •Special Function Register Memory
- •Memory Models
- •Small Model
- •Compact Model
- •Large Model
- •Memory Types
- •Explicitly Declared Memory Types
- •Implicit Memory Types
- •Data Types
- •Bit Types
- •Special Function Registers
- •sbit
- •Absolute Variable Location
- •Pointers
- •Generic Pointers
- •Pointer Conversions
- •Abstract Pointers
- •Function Declarations
- •Function Parameters and the Stack
- •Passing Parameters in Registers
- •Function Return Values
- •Specifying the Memory Model for a Function
- •Specifying the Register Bank for a Function
- •Register Bank Access
- •Interrupt Functions
- •Reentrant Functions
- •Chapter 4. Preprocessor
- •Directives
- •Stringize Operator
- •Predefined Macro Constants
- •Chapter 5. 8051 Derivatives
- •Analog Devices MicroConverter B2 Series
- •Atmel 89x8252 and Variants
- •Dallas 80C320, 420, 520, and 530
- •Arithmetic Accelerator
- •Data Pointers
- •Library Routines
- •Philips 8xC750, 8xC751, and 8xC752
- •Philips 80C51MX Architecture
- •Philips and Atmel WM Dual DPTR
- •Customization Files
- •STARTUP.A51
- •INIT.A51
- •XBANKING.A51
- •Basic I/O Functions
- •Memory Allocation Functions
- •Optimizer
- •General Optimizations
- •Options for Code Generation
- •Segment Naming Conventions
- •Data Objects
- •Program Objects
- •Interfacing C Programs to Assembler
- •Function Parameters
- •Parameter Passing in Registers
- •Parameter Passing in Fixed Memory Locations
- •Function Return Values
- •Using the SRC Directive
- •Register Usage
- •Overlaying Segments
- •Example Routines
- •Small Model Example
- •Compact Model Example
- •Large Model Example
- •Data Storage Formats
- •Bit Variables
- •Signed and Unsigned Long Integers
- •Generic and Far Pointers
- •Floating-point Numbers
- •Accessing Absolute Memory Locations
- •Absolute Memory Access Macros
- •Linker Location Controls
- •The _at_ Keyword
- •Debugging
- •Chapter 7. Error Messages
- •Fatal Errors
- •Actions
- •Errors
- •Syntax and Semantic Errors
- •Warnings
- •Chapter 8. Library Reference
- •Intrinsic Routines
- •Library Files
- •Standard Types
- •va_list
- •Absolute Memory Access Macros
- •CBYTE
- •CWORD
- •DBYTE
- •DWORD
- •FARRAY, FCARRAY
- •FVAR, FCVAR,
- •PBYTE
- •PWORD
- •XBYTE
- •XWORD
- •Routines by Category
- •Buffer Manipulation
- •Character Conversion and Classification
- •Data Conversion
- •Math Routines
- •Memory Allocation Routines
- •Stream Input and Output Routines
- •String Manipulation Routines
- •Miscellaneous Routines
- •Include Files
- •8051 Special Function Register Include Files
- •ABSACC.H
- •ASSERT.H
- •CTYPE.H
- •INTRINS.H
- •MATH.H
- •SETJMP.H
- •STDARG.H
- •STDDEF.H
- •STDIO.H
- •STDLIB.H
- •STRING.H
- •Reference
- •Compiler-related Differences
- •Library-related Differences
- •Appendix B. Version Differences
- •Version 6.0 Differences
- •Version 5 Differences
- •Version 4 Differences
- •Version 3.4 Differences
- •Version 3.2 Differences
- •Version 3.0 Differences
- •Version 2 Differences
- •Appendix C. Writing Optimum Code
- •Memory Model
- •Variable Location
- •Variable Size
- •Unsigned Types
- •Local Variables
- •Other Sources
- •Appendix D. Compiler Limits
- •Appendix E. Byte Ordering
- •Recursive Code Reference Error
- •Problems Using the printf Routines
- •Uncalled Functions
- •Using Monitor-51
- •Trouble with the bdata Memory Type
- •Function Pointers
- •Glossary
- •Index

Keil Software — Cx51 Compiler User’s Guide |
139 |
|
|
Chapter 5. 8051 Derivatives
A number of 8051 devices provide enhanced performance while remaining compatible with the 8051 core. These derivatives provide additional data pointers, very fast math operations, extended or reduced instruction sets.
The Cx51 compiler directly supports the enhanced features of the following 8051-based microcontrollers:
Analog Devices ADuC MicroConverter B2 series (2 data pointers and
extended stack space). |
|
Atmel 89x8252 and variants (2 data pointers). |
|
Dallas 80C320, 80C420, 80C520, 80C530, 80C550 an variants (2 data |
|
pointers). |
|
Dallas 80C390, 5240 and variants (contigious address mode, extended stack |
|
space, and arithmetic accelerator). |
|
Infineon C517, C517A, C509, and variants (high-speed 32-bit and 16-bit |
|
binary arithmetic operations, 8 data pointers). |
|
Philips 8xC750, 8xC751, and 8xC752 (maximum code space of 2 KBytes, no |
5 |
LCALL or LJMP instructions, 64 bytes internal, no external data memory). |
|
Philips 80C51MX architecture with extended instructions and memory space. |
Philips and AtmelWM support on several device variants 2 data pointers.
The Cx51 compiler provides you with support for these CPUs through the use of special libraries, library routines, or additional directives that enable the Cx51 compiler to generate object code that takes advantage of the device enhancements mentioned above. Refer to “Chapter 2. Compiling with the Cx51” on page 17 for more information about these additional directives.

140 |
Chapter 5. 8051 Derivatives |
|
|
Analog Devices MicroConverter B2 Series
The Analog Devices B2 series of MicroConverters provide 2 data pointers which can be used for memory access. Using multiple data pointers can improve the speed of library functions like memcpy, memmove, memcmp, strcpy, and strcmp.
The MODAB2 directive instructs the the Cx51 compiler compiler to generate code that uses both data pointers in your program.
The Cx51 compiler uses at least one data pointer in an interrupt function. If an interrupt function is compiled using the MODAB2 directive, both data pointers are saved on the stack. This happens even if the interrupt function uses only one data pointer.
To conserve stack space, you may compile interrupt functions with the NOMODAB2 directive. The Cx51compiler does not use the second data pointer when this directive is used.
These devices offer also an extended stack space that is configured in startup file
START_AD.A51.
5

Keil Software — Cx51 Compiler User’s Guide |
141 |
|
|
Atmel 89x8252 and Variants
The Atmel 89x8252 and variants provide 2 data pointers which can be used for memory access. Using multiple data pointers can improve the speed of library functions like memcpy, memmove, memcmp, strcpy, and strcmp.
The MODA2 directive instructs the the Cx51 compiler compiler to generate code that uses both data pointers in your program.
The Cx51 compiler uses at least one data pointer in an interrupt function. If an interrupt function is compiled using the MODA2 directive, both data pointers are saved on the stack. This happens even if the interrupt function uses only one data pointer.
To conserve stack space, you may compile interrupt functions with the NOMODA2 directive. The Cx51compiler does not use the second data pointer when this directive is used.
5

142 Chapter 5. 8051 Derivatives
|
Dallas 80C320, 420, 520, and 530 |
|
|
The Dallas Semiconductor 80C320, 80C420, 80C520, and 80C530 provide 2 |
|
|
data pointers which may be used for memory access. Using multiple data |
|
|
pointers can improve the speed of library functions like memcpy, memmove, |
|
|
memcmp, strcpy, and strcmp. |
|
|
The MODDP2 directive instructs the Cx51compiler to generate code that uses |
|
|
both data pointers in your program. |
|
|
The Cx51compiler uses at least one data pointer in an interrupt function. If an |
|
|
interrupt function is compiled using the MODDP2 directive, both data pointers |
|
|
are saved on the stack—even if the interrupt function uses only one data pointer. |
|
|
To conserve stack space, you may compile interrupt functions with the |
|
|
NOMODDP2 directive. The Cx51compiler does not use the second data |
|
|
pointer when this directive is specified. |
|
|
The DS80C420 provides auto toggle, decrement, and auto increment features for |
|
|
the dual data pointers. The library \KEIL\C51\LIB\C51DS2A.LIB contains |
|
|
accelerated versions of the memcpy, memmove, memcmp, strcpy, and strcmp |
|
|
||
5 |
functions that use these features. Add this library to your project when you use |
|
the dual DPTR feature on this device. |
||
|
||
|
The DS80C550, DS80C390, and DS5240 provide auto toggle and decrement |
|
|
||
|
features for the dual data pointers. The library \KEIL\C51\LIB\C51DS2T.LIB |
|
|
contains accelerated versions of the memcpy, memmove, memcmp, strcpy, |
|
|
and strcmp functions that use these features. Add this library to your project |
|
|
when you use the dual DPTR feature on these devices. |

Keil Software — Cx51 Compiler User’s Guide |
143 |
|
|
Dallas 80C390, 80C400, 5240, and
Variants
The Dallas Semiconductor 80C390, 80C400, 5240, and variants provide additional CPU modes that are fully supported by the Keil compiler.
Contiguous mode allows you to create large programs that exceed the classic 8051’s 64K limit. The ROM(D512K) and ROM(D16M) directives instruct the Cx51 compiler to generate code for the contiguous mode. The far memory type is used to access variables and constants using 24-bit DPTR addressing mode (in contiguous mode).
NOTE
The contiguous mode requires the extended LX51 linker/locater and the extended AX51 macro assembler that are available only in the PK51 Professional Developers Kit.
In addition to the extended address space, the DS80C390, DS80C400, and DS5240 provide auto toggle and decrement features for the dual data pointers. The \KEIL\C51\LIB\C51DS2T.LIB library contains accelerated versions of the memcpy, memmove, memcmp, strcpy, and strcmp functions that use these
features. For non-contiguous mode (classic 8051 mode) applications, you must 5 add this library to your project to use the dual DPTR of these devices. The
contiguous mode C library already contains the library routines for the auto toggle and decrement features.
The DS80C390, DS80C400, and DS5240 offer an extended stack space that is configured in the START390.A51 startup file.