- •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
144 |
Chapter 5. 8051 Derivatives |
|
|
Arithmetic Accelerator
The Cx51 compiler uses the 32-bit and 16-bit arithmetic operations of the DS80C390, DS80C400 and DS5240 to improve performance of a number of math-intensive operations. C language programs execute considerably faster when using either of these CPUs.
Use the following suggestions to help guarantee that only one thread of execution uses the arithmetic processor:
Use the MODDA directive to compile functions which are guaranteed to execute only in the main program or functions used by one interrupt service routine, but not both.
Compile all remaining functions with the NOMODDA directive.
5
Keil Software — Cx51 Compiler User’s Guide |
145 |
|
|
Infineon C517, C509, 80C537, and
Variants
The Infineon C517, C517A, and C509 perform high-speed 32-bit and 16-bit arithmetic operations which improve of many int, long, and float operations.
The C517, C517A, C509, and C515C provide 8 data pointers that may be used to increase the speed of memory to memory operations.
The MOD517 directive instructs the Cx51compiler to generate code that utilizes these advanced features.
Data Pointers
The Infineon C515C, C517, C517A, and C509 provide 8 data pointers which may be used to speed-up memory access. Using multiple data pointers can improve the execution of library functions such as: memcpy, memmove, memcmp, strcpy, and strcmp. The 8 data pointers of the C515C, C517, C517 and C509 may also reduce the stack load of interrupt functions.
The Cx51 compiler uses only 2 of the 8 data pointers at a time. In order to keep |
5 |
the stack load in the interrupt routines low, Cx51 switches to 2 unused data |
pointers when switching the register bank. The contents of the register DPSEL are saved on the stack and a new pair of data pointers is selected. Saving the data pointers on the stack is no longer required.
If an interrupt routine does not switch to another register bank (for example, the function is declared without the using attribute), the data pointers must be saved on the stack (using 4 bytes of stack space). To keep the size of the stack as small as possible, use the MOD517(NODP8) directive to compile the interrupt routine and the functions it calls. This generates code for the interrupt using only one data pointer and only 2 bytes of stack space.
146 |
Chapter 5. 8051 Derivatives |
|
|
High-speed Arithmetic
The Cx51 compiler uses the 32-bit and 16-bit arithmetic operations of the C517, C517A, and C509 to improve performance of a number of math-intensive operations. C language programs execute considerably faster when using either of these CPUs.
Use the following suggestions to help guarantee that only one thread of execution uses the arithmetic processor:
Use the MOD517 directive to compile functions which are guaranteed to execute only in the main program or functions used by one interrupt service routine, but not both.
Compile all remaining functions with the MOD517(NOAU) directive.
Library Routines
The extra features of the C517, C517A, and C509 are used in several library routines to enhance performance. These routines are listed below and are described in detail in “Chapter 8. Library Reference” on page 209.
5 |
acos517 |
log10517 |
sqrt517 |
asin517 |
log517 |
sscanf517 |
|
|
atan517 |
printf517 |
strtod517 |
|
atof517 |
scanf517 |
tan517 |
|
cos517 |
sin517 |
|
|
exp517 |
sprintf517 |
|