- •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 |
147 |
|
|
Philips 8xC750, 8xC751, and 8xC752
The Philips 8xC750, 8xC751, and 8xC752 derivatives support a maximum of 2 KBytes of internal program memory. The CPU cannot execute LCALL and LJMP instructions. The following must be considered when using these devices:
A special library, 80C751.LIB, which does not use these instructions is necessary for these devices.
The Cx51 compiler must be set to avoid using LJMP and LCALL instructions. This is accomplished using the ROM(SMALL) directive.
Note that the following restrictions apply when creating programs for the 8xC750, 8xC751, and 8xC752:
Stream functions such as printf and putchar may not be used. These functions are usually not necessary for this chip because it is only equipped with a maximum of 2 KBytes and has no serial interface.
Floating-point operations may not be used. Only operations using char,
unsigned char, int, unsigned int, long, unsigned long, and bit data types |
5 |
are allowed. |
|
The Cx51 compiler must be invoked with the ROM(SMALL) directive. This |
control statement instructs the C51 compiler to use only AJMP and ACALL instructions.
The library file 80C751.LIB must be included in the input module list of the linker. For example:
BL51 myprog.obj, startup751.obj, 80C751.LIB
A special startup module, START751.A51, is required. This file contains startup code that is comparable to that found in STARTUP.A51, but contains no LJMP or LCALL instructions. Refer to “Customization Files” on page 150 for more information.
148 Chapter 5. 8051 Derivatives
Philips 80C51MX Architecture
The Philips 80C51MX architecture provides an extended instruction set and extended addressing modes to support up to 16MB memory space. The universal pointer registers and the related instructions give you hardware support for generic pointers. You may use the far memory type to place variables anywhere in the extended memory space. Programming examples for the Philips 80C51MX architecture are found in the folder C51\EXAMPLES\PHILIPS 80C51MX.
The Philips 80C51MX architecture is supported with the extended CX51 compiler, LX51 linker/locater, and AX51 macro assembler. These additiaonl components are available in the PK51 Professional Developers Kit.
Philips and Atmel WM Dual DPTR
Philips Semiconductors and Atmel Wireless and Microcontrollers provide several compatible 8051 variants with dual data pointers. Using multiple data pointers can improve the speed of library functions like memcpy, memmove, memcmp, strcpy, and strcmp.
5 |
The MODP2 directive instructs the Cx51 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 MODP2 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 |
|
NOMODP2 directive to prevent the Cx51 compiler from using the second data |
|
pointer. |
Keil Software — Cx51 Compiler User’s Guide |
149 |
|
|
Chapter 6. Advanced Programming
Techniques
This chapter describes advanced programming information that experienced software engineers will find invaluable. Knowledge of most of these topics is not necessary to successfully create an embedded 8051 target program using the Cx51 compiler. However, the following sections provide insight into how many non-standard procedures can be accomplished (for example, interfacing to PL/M-51).
This chapter discusses the following topics:
Files you may alter to customize the startup procedures
Files you may alter to customize run-time execution of library routines
The conventions the Cx51 compiler uses to name code and data segments
How to interface Cx51 functions to assembly and PL/M-51 routines
Data storage formats for the different Cx51 data types
Different optimizing features of the Cx51 optimizing compiler
6