U C51
U C51
U C51
ii
Keil Software
Information in this document is subject to change without notice and does not
represent a commitment on the part of the manufacturer. The software described
in this document is furnished under license agreement or nondisclosure
agreement and may be used or copied only in accordance with the terms of the
agreement. It is against the law to copy the software on any medium except as
specifically allowed in the license or nondisclosure agreement. The purchaser
may make one copy of the software for backup purposes. No part of this manual
may be reproduced or transmitted in any form or by any means, electronic or
mechanical, including photocopying, recording, or information storage and
retrieval systems, for any purpose other than for the purchasers personal use,
without written permission.
Copyright 1990-1998 Keil Elektronik GmbH and Keil Software, Inc.
All rights reserved.
Every effort was made to ensure accuracy in this manual and to give appropriate
credit to persons, companies, and trademarks referenced herein.
Preface
This manual is an introduction to the Keil Software 8051 and MCS 251
microcontroller software development tools. It introduces new users and
interested readers to our product line. With nothing more than this book, you
should be able to successfully run and use our tools. This users guide contains
the following chapters.
Chapter 1. Introduction gives an overview of this users guide.
Chapter 2. Installation describes how to install our software and how to setup
an operating environment for the tools.
Chapter 3. 8051/251 Product Line discusses the different products that we
offer for the 8051 and 251 microcontrollers. Read this chapter to determine
which product provides the tools you need.
Chapter 4. 8051 Development Tools describes the major features of our 8051
development tools including the C compiler, assembler, debugger, and integrated
development environment.
Chapter 5. 251 Development Tools describes the major features of our 251
development tools including the C compiler, assembler, debugger, and integrated
development environment.
Chapter 6. Using the 8051/251 tools describes the provided sample programs
along with a step-by-step guide that shows how to build them using our tools.
Chapter 7. Hardware Products introduces our hardware-based tools that you
can use to aid in development and debugging. Our evaluation boards for the
80C517A and 80C251SB and our EPROM emulator are discussed.
Chapter 8. Real-Time Kernels discusses the RTX-51 Tiny and RTX-51 Full
real-time operating systems. This chapter provides an overview of multitasking
systems, why they are desirable, and how they are used.
Chapter 9. Command Reference briefly describes the commands and controls
for our 8051 and 251 development tools.
NOTE
This manual assumes that you are familiar with Microsoft Windows and the
hardware and instruction set of the 8051 and MCS 251 microcontrollers.
iii
iv
Preface
Document Conventions
This document uses the following conventions:
Examples
Description
README.TXT
Bold capital text is used for the names of executable programs, data files,
source files, environment variables, and commands you enter at the
MS-DOS command prompt. This text usually represents commands that
you must type in literally. For example:
CLS
DIR
BL51.EXE
Note that you are not required to enter these commands using all capital
letters.
Courier
Variables
Text in italics represents information that you must provide. For example,
projectfile in a syntax string means that you must supply the actual project
file name.
Occasionally, italics are also used to emphasize words in the text.
Elements that
repeat
Omitted code
.
.
.
!Optional Items"
Keys
Text in this sans serif typeface represents actual keys on the keyboard.
For example, Press Enter to continue.
Point
Move the mouse until the mouse pointer rests on the item desired.
Click
Quickly press and release a mouse button while pointing at the item to be
selected.
Drag
Press the left mouse button while on a selected item. Then, hold the
button down while moving the mouse. When the item to be selected is at
the desired position, release the button.
Double-Click
Contents
Chapter 1. Introduction......................................................................................1
Manual Topics .............................................................................................................. 1
Evaluation and Demo Kits ............................................................................................ 2
Types of Users .............................................................................................................. 2
Changes to the Documentation ..................................................................................... 3
Requesting Assistance................................................................................................... 3
Chapter 2. Installation........................................................................................7
System Requirements.................................................................................................... 7
Backing Up Your Disks ................................................................................................ 8
Installing the Software .................................................................................................. 8
Directory Structure ....................................................................................................... 9
Environment Settings.................................................................................................. 10
Improving System Performance.................................................................................. 11
vi
Contents
Index ..................................................................................................................129
Chapter 1. Introduction
Thank you for allowing Keil Software to provide you with software development
tools for the 8051 and 251 family of microprocessors. With our tools, you can
generate embedded applications for the multitude of 8051 and 251 derivatives.
Our 8051 and 251 development tools are listed below:
!
These tools are combined into the kits described in Chapter 3. 8051/251
Product Line on page 13. The individual tools are described in detail in
Chapter 4. 8051 Development Tools on page 23.
In addition to the above development tools, we also provide real-time kernels,
evaluation boards, and debugging hardware. Refer to Chapter 8. Real-Time
Kernels on page 111 and Chapter 7. Hardware Products on page 107 for
more information about these products.
Our tools are designed for the professional software developer, but any level of
programmer can use them to get the most out of the 8051 and 251 hardware.
Manual Topics
This manual discusses a number of topics including how to:
!
Select the best tool kit for your application (see Chapter 3. 8051/251
Product Line on page 13),
Use the 8051 development tools (see Chapter 4. 8051 Development Tools
on page 23),
Chapter 1. Introduction
Run the included sample programs (see Chapter 6. Using the 8051/251
tools on page 63).
If you want to get started immediately, you may do so by installing the software
(refer to Chapter 2. Installation on page 7) and running the sample programs
(refer to Chapter 6. Using the 8051/251 tools on page 63). This is all you
need to do to begin using this kit.
Types of Users
This manual addresses three types of users: evaluation users, new users, and
experienced users.
Evaluation Users are those users who have not yet purchased the software but
have requested the evaluation package to get a better feel for what the tools do
and how they perform. The evaluation package includes evaluation copies of the
development tools. You may use the included sample programs to get real-world
experience with our 8051 and 251 development tools. Even if you are only a
evaluation user, take the time to read this manual. It explains how to install the
software, provides you with an overview of the development tools, and
introduces the sample programs.
New Users are those users who are purchasing our 8051 development tools for
the first time. The included software provides you with the latest development
tool versions as well as sample programs. If you are new to the 8051 or 251 or
the tools, take the time to review the sample programs described in this manual.
This manual provides a quick tutorial and helps new or inexperienced users
quickly get started with the tools.
Experienced Users are those users who have previously used our 8051
development tools and are now upgrading to the latest 8051 or 251 tools. The
software included with a product upgrade contains the latest development tools,
the sample programs, and a full set of manuals.
Requesting Assistance
We are dedicated to providing you with the best embedded development tools
and documentation available. If you have suggestions or comments regarding
any of the printed manuals accompanying this product, please contact us. If you
think you have discovered a problem with the software, do the following before
calling technical support.
1. Read the sections in this manual that pertain to the job or task you are trying
to accomplish.
2. Make sure you are using the most current version of the software and utilities.
3. Isolate the problem to determine if it is a problem with the assembler,
compiler, linker, library manager, or another development tool.
4. Isolate software problems by reducing your code to a few lines.
If, after following these steps, you are still experiencing problems, report them to
our technical support group. If you contact us by fax, be sure to include your
name, your product serial number and version number, and telephone numbers
(voice and fax) where we can reach you.
Chapter 1. Introduction
Try to be as detailed as possible when describing the problem you are having.
The more descriptive your example, the faster we can find a solution. If you
have a one-page code example demonstrating the problem, please fax it to us.
However, please try not send long listings as this slows down our response.
Chapter 2. Installation
This chapter explains how to setup an operating environment and how to install
the software on your hard disk. Before starting the installation program, you
must do the following:
!
NOTE
This chapter refers to various MS-DOS commands which may be used to
customize your operating environment. The SET and PATH commands, for
example, are used to initialize environment variables used by the compiler and
utilities. If you are not familiar with these commands and other MS-DOS
operations mentioned in this chapter, please refer to your DOS users guide.
System Requirements
There are minimum hardware and software requirements that must be satisfied to
ensure that the compiler and utilities function properly.
For our Windows-based tools, you must have the following:
!
4 MB RAM minimum,
Chapter 2. Installation
The C compiler and utilities require that you have at least 20 files and 20 buffers
defined in your CONFIG.SYS file. Additionally, you need enough environment
space for the environment variables used by the compiler and utilities (see
Environment Settings on page 10).
Your
CONFIG.SYS
BUFFERS=20
FILES=20
SHELL=C:\COMMAND.COM /e:1024 /p
If you receive the message Out of environment space from DOS, you can
increase the amount of environment space by increasing the number 1024 in the
above example. Refer to your DOS users guide for more information.
Select the Run command from the File menu in the Program Manager,
Directory Structure
The installation program copies the development tools into subdirectories of the
following base directories. The directory used depends on the kit being
installed.
Directory
Description
\C51
\C51EVAL
\C251
\C251EVAL
After creating the appropriate directory, the installation program copies the
development tools into the subdirectories listed in the following table.
Subdirectory
Description
\ASM
\BIN
Executable files.
\DS51
\EXAMPLES
Sample applications.
\RTX51
\RTX_TINY
\INC
\LIB
\MON51
\TS51
10
Chapter 2. Installation
This table lists a complete installation that includes the entire line of 8051 development
tools. Your installation may vary depending on the products you purchased.
Environment Settings
The compiler and utilities require entries in the DOS environment table that
specify the path to include files and libraries. In addition, you must include the
\BIN\ directory in your PATH.
The following table lists the environment variables, their default paths, and a
brief description.
Variable
Path
Description
PATH
\C51\BIN
PATH
\C51EVAL\BIN
PATH
\C251\BIN
PATH
\C251EVAL\BIN
TMP
C51INC
\C51\INC
C251INC
\C251\INC
C51LIB
\C51\LIB
Specifies the path where the standard C51 compiler library files
are located.
C251LIB
\C251\LIB
NOTE
This manual makes references to programs and files in the \C51\ directory.
This directory is equivalent to the \C51EVAL\, \C251\, and \C251EVAL\
directories.
11
PATH=C:\C51\BIN;...
PATH=C:\C51EVAL\BIN;...
SET C51INC=C:\C51\INC
SET C51INC=C:\C51EVAL\INC
SET C51LIB=C:\C51\LIB
SET C51LIB=C:\C51EVAL\LIB
PATH=C:\C251\BIN;...
PATH=C:\C251EVAL\BIN;...
SET C251INC=C:\C251\INC
SET C251INC=C:\C251EVAL\INC
SET C251LIB=C:\C251\LIB
SET C251LIB=C:\C251EVAL\LIB
Provide a RAM disk for the compiler and utilities to use for temporary files,
Use a disk cache to store the most recently accessed disk files.
VDISK.SYS
12
Chapter 2. Installation
A disk cache utilizes a large memory pool to temporarily store information read
from disk. When the computer accesses the disk, it first checks the cache to see
if the desired information is already in the cache. If it is, the information is read
from the cache memory instead of from the disk. This is significantly faster than
waiting for the disk drive to read the information.
Typically, software development involves an edit-compile-edit-compile cycle.
In these situations, a disk cache improves the performance of your editor,
assembler, compiler, and linker. The editor, the compiler, source file, and object
file can all be held in the cache, and disk accesses are kept to a minimum.
Version 5.0 and Version 6.0 of MS-DOS both come with a disk-caching utility
called SMARTDRV.SYS. Refer to your DOS manual to learn how to install and use
this program.
13
14
Vision/51
C51
Compiler
C
Library
A51 Macro
Assembler
LIB51
Library
Manager
RTX51
Real-Time
Operating
System
dScope-51
Source Leve -Debugger
Emulator &
PROM Programmer
CPU &
Peripheral
Simulator
The absolute object file created by the linker may be used to program EPROM or
other memory devices. The absolute object module may also be used with the
dScope-51 debugger/simulator or with an in-circuit emulator.
The dScope-51 source level debugger/simulator is ideally suited for fast, reliable
high-level-language program debugging. The debugger contains a high-speed
simulator and a target debugger that let you simulate an entire 8051 system
including on-chip peripherals. By loading specific I/O drivers, you can simulate
the attributes and peripherals of a variety of 8051 derivatives. In conjunction
with Monitor-51, the debugger is even able to do source-level debugging on your
target hardware.
The RTX-51 real-time operating system is a multitasking kernel for the 8051
family. The RTX-51 real-time kernel simplifies the system design,
programming, and debugging of complex applications where fast reaction to
time critical events is essential. The kernel is fully integrated into the C51
compiler and is easy to use. Task description tables and operating system
15
dScope-51 Simulator/Debugger,
In addition, the professional developers kit includes the following tools for
Windows users:
!
16
The professional developers kit can be configured for all 8051 derivatives. The
tools included in this kit run under DOS on any 100% IBM PC 386 or higher
compatible computer.
The DK51 C51 developers kit is designed for users who need a complete
DOS-based development system for the 8051. This kit lets you create
sophisticated embedded applications using a DOS-based development platform.
This tool kit includes the following components:
!
dScope-51 Simulator/Debugger,
The developers kit can be configured for all 8051 derivatives. The tools
included in this kit run under DOS on any 100% compatible IBM PC 386 or
higher computer.
17
dScope-51 Simulator/Debugger,
The simulator kit comes with drivers for most popular 8051 derivatives. The
tools included in this kit run under DOS on any 100% compatible IBM PC 386
or higher computer.
18
code. Following are descriptions of the 251 development tool kits that we
provide.
L251 Linker/Locator,
The developers kit can be configured for all modes of the 251. The tools
included in this kit run under Windows on any 100% IBM PC 386 or higher
compatible computer.
L251 Linker/Locator,
19
The compiler kit can be configured for every mode of the 251. The tools
included in this kit run under Windows on any 100% IBM PC 386 or higher
compatible computer.
L251 Linker/Locator,
The tools included in this kit run under Windows on any 100% IBM PC 386 or
higher compatible computer.
The simulator kit comes with drivers for most popular 8051 and 251 derivatives.
The tools included in this kit run under Windows on any 100% IBM PC 386 or
higher compatible computer.
20
Subscription Kits
To best support users who develop 8051 and 251 applications, we have added
the 8051/251 subscription kits to our product line. The subscription kits provide
the 8051 and 251 development tools as well as one year of free software
upgrades.
L251 Linker/Locator,
21
L251 Linker/Locator,
22
Support
PK51
DK51
A51
8051
251
DK251 CA251
Assembler
Compiler
Simulator
IDE
RTX
Windows
DOS
23
24
For information on the products which include these tools, refer to Chapter 3.
8051/251 Product Line on page 13.
NOTE
All of our 8051 tools utilize the Intel OMF51 object module format. The
development environment can be expanded with all Intel compatible tools such
as Intel PL/M-51 or iDCX-51 and with emulators from a wide range of
manufactures.
Register allocation and addressing mode details are managed by the compiler.
Keywords and operational functions that more nearly resemble the human
thought process can be used.
The library files that are supplied provide many standard routines (such as
formatted output, data conversions, and floating-point arithmetic) that may be
incorporated into your application.
The C language is very portable and very popular. C compilers are available
for almost all target systems. Existing software investments can be quickly
and easily converted from or adapted to other processors or environments.
25
Data Types,
Memory Types,
Memory Models,
Pointers,
Reentrant Functions,
Interrupt Functions,
26
Data Types
The C51 compiler supports the data types listed in the following table. In
addition to these scalar types, variables can be combined into structures, unions,
and arrays. Except as noted, you may use pointers to access these data types.
Data Type
Bits
Bytes
Value Range
bit
signed char
0 to 1
-128 to +127
unsigned char
0 to 255
enum
16
-32768 to +32767
signed short
16
-32768 to +32767
unsigned short
16
0 to 65535
signed int
16
-32768 to +32767
unsigned int
16
0 to 65535
signed long
32
-2147483648 to 2147483647
unsigned long
32
0 to 4294967295
float
32
1.175494E-38 to 3.402823E+38
sbit
sfr
0 to 255
sfr16
16
0 to 65535
0 to 1
The bit, sbit, sfr, and sfr16 data types are specific to the 8051 hardware and the C51 and C251
compilers. The are not a part of ANSI C and cannot be accessed through pointers.
The sbit, sfr, and sfr16 data types are included to allow access to the special
function registers that are available on the 8051. For example, the declaration:
sfr P0 = 0x80; declares the variable P0 and assigns it the special function
register address of 0x80. This is the address of PORT 0 on the 8051.
The C51 compiler automatically converts between data types when the result
implies a different data type. For example, a bit variable used in an integer
assignment is converted to an integer. You can, of course, coerce a conversion
by using a type cast. In addition to data type conversions, sign extensions are
automatically carried out for signed variables.
Memory Types
The C51 compiler supports the architecture of the 8051 and its derivatives and
provides access to all memory areas of the 8051. Each variable may be
explicitly assigned to a specific memory space.
Memory Type
27
Description
code
data
idata
bdata
xdata
pdata
Accessing the internal data memory is considerably faster than accessing the
external data memory. For this reason, you should place frequently used
variables in internal data memory and less frequently used variables in external
data memory.
By including a memory type specifier in the variable declaration, you can specify
where variables are stored.
As with the signed and unsigned attributes, you may include memory type
specifiers in the variable declaration. For example:
char data var1;
char code text[] = "ENTER PARAMETER:";
unsigned long xdata array[100];
float idata x,y,z;
unsigned int pdata dimension;
unsigned char xdata vector[10][4][4];
char bdata flags;
28
Memory Models
The memory model determines the default memory type used for function
arguments, automatic variables, and variables declared with no explicit memory
type. You specify the memory model on the command line using the SMALL,
COMPACT, and LARGE control directives. By explicitly declaring a variable
with a memory type specifier, you may override the default memory type.
SMALL
COMPACT
LARGE
NOTE
You should always use the SMALL memory model. It generates the fastest,
tightest, and most efficient code. You can always explicitly specify the memory
area for variables. Move up in model size only if you are unable to make your
application fit or operate using SMALL model.
29
Pointers
The C51 compiler supports pointer declarations using the asterisk character
(*). You may use pointers to perform all operations available in standard C.
However, because of the unique architecture of the 8051 and its derivatives, the
C51 compiler supports two different types of pointers: memory specific pointers
and generic pointers.
Generic Pointers
Generic pointers are declared in the same way as standard C pointers. For
example:
char *s;
int *numptr;
long *state;
/* string ptr */
/* int ptr */
/* long ptr */
Generic pointers are always stored using three bytes. The first byte is for the
memory type, the second is for the high-order byte of the offset, and the third is
for the low-order byte of the offset.
Generic pointers may be used to access any variable regardless of its location in
8051 memory space. Many of the library routines use these pointer types for this
reason. By using these generic untyped pointers, a function can access data
regardless of the memory in which it is stored.
Because the memory type is specified at compile-time, the memory type byte
required by untyped pointers is not needed by typed pointers. Typed pointers
can be stored using only one byte (idata, data, bdata, and pdata pointers) or
two bytes (code and xdata pointers).
30
Description
Idata Pointer
Xdata Pointer
Generic Pointer
Sample Program
char *p;
char val;
val = *p;
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
CALL
Pointer Size
1 byte data
2 bytes data
3 bytes data
Code Size
4 bytes code
9 bytes code
Execution Time
4 cycles
7 cycles
13 cycles
R0,ip
val,@R0
DPL,xp +1
DPH,xp
A,@DPTR
val,A
R1,p + 2
R2,p + 1
R3,p
CLDPTR
Reentrant Functions
A reentrant function can be shared by several processes at the same time. When
a reentrant function is executing, another process can interrupt the execution and
then begin to execute that same reentrant function. Normally, C51 functions
cannot be called recursively or in a fashion which causes reentrancy. The reason
for this limitation is that function arguments and local variables are stored in
fixed memory locations. The reentrant function attribute allows you to declare
functions that may be reentrant and, therefore, may be called recursively. For
example:
int calc (char i, int b) reentrant
{
int x;
x = table [i];
return (x * b);
}
31
NOTE
By selecting the reentrant attribute on a function by function basis, you can
select the use of this attribute where its needed without making the entire
program reentrant. Making an entire program reentrant may cause it to be
larger and consume more memory.
Interrupt Functions
The C51 compiler provides you with a method of calling a C function when an
interrupt occurs. This support allows you to create interrupt service routines in
C. You need only be concerned with the interrupt number and register bank
selection. The compiler automatically generates the interrupt vector and entry
and exit code for the interrupt routine. The interrupt function attribute, when
included in a declaration, specifies that the associated function is an interrupt
function. Additionally, you can specify the register bank used for that interrupt
with the using function attribute.
unsigned int interruptcnt;
unsigned char second;
void timer0 (void) interrupt 1 using 2 {
if (++interruptcnt == 4000) {
second++;
interruptcnt = 0;
}
}
/* count to 4000 */
/* second counter */
/* clear int counter */
Parameter Passing
The C51 compiler passes up to three function arguments in CPU registers. This
significantly improves system performance since arguments do not have to be
written to and read from memory. Argument passing can be controlled with the
REGPARMS and NOREGPARMS control directives. The following table
lists the registers used for different arguments and data types.
Argument
Number
char,
1-byte pointer
int,
2-byte pointer
long,
float
generic
pointer
R7
R6 & R7
R4 R7
R1 R3
R5
R4 & R5
R3
R2 & R3
32
If no registers are available for argument passing or too many arguments are
involved, fixed memory locations are used for those extra arguments.
Return Type
Register
Description
bit
Carry Flag
R7
R6 & R7
R4 R7
float
R4 R7
generic pointer
R1 R3
Register Optimizing
Depending on program context, the C51 compiler allocates up to 7 CPU registers
for register variables. Any registers modified during function execution are
noted by the C51 compiler within each module. The linker/locator generates a
global, project-wide register file which contains information of all registers
altered by external functions. Consequently, the C51 compiler knows the
register used by each function in an application and can optimize the CPU
register allocation of each C function.
33
Interfacing to Assembly
You can easily access assembly routines from C and vice versa. Function
parameters are passed via CPU registers or, if the NOREGPARMS control is
used, via fixed memory locations. Values returned from functions are always
passed in CPU registers.
You can use the SRC directive to direct the C51 compiler to generate a file
ready to assemble with the A51 assembler instead of an object file. For example,
the following C source file:
unsigned int asmfunc1 (unsigned int arg){
return (1 + arg);
}
generates the following assembly output file when compiled using the SRC
directive.
?PR?_asmfunc1?ASM1
SEGMENT CODE
PUBLIC
_asmfunc1
RSEG ?PR?_asmfunc1?ASM1
USING 0
_asmfunc1:
;---- Variable 'arg?00' assigned to Register 'R6/R7'
MOV
A,R7
; load LSB of
ADD
A,#01H
; add 1
MOV
R7,A
; put it back
CLR
A
ADDC A,R6
; add carry &
MOV
R6,A
---the int
into R7
R6
?C0001:
RET
You may use the #pragma asm and #pragma endasm preprocessor directives
to insert assembly instructions into your C source code.
Interfacing to PL/M-51
Intels PL/M-51 is a popular programming language that is similar to C in many
ways. You can easily interface routines written in C to routines written in
PL/M-51. You can access PL/M-51 functions from C by declaring them with the
alien function type specifier. All public variables declared in the PL/M-51
module are available to your C programs. For example:
extern alien char plm_func (int, char);
34
Since the PL/M-51 compiler and the Keil Software tools all generate object files
in the OMF51 format, external symbols are resolved by the linker.
35
Code Optimizations
The C51 compiler is an aggressive optimizing compiler. This means that the
compiler takes certain steps to ensure that the code generated and output to the
object file is the most efficient (smaller and/or faster) code possible. The
compiler analyzes the generated code to produce the most efficient instruction
sequences. This ensures that your C program runs as quickly and effectively as
possible in the least amount of code space.
The C51 compiler provides six different levels of optimizing. Each increasing
level includes the optimizations of levels below it. The following is a list of all
optimizations currently performed by the C51 compiler.
General Optimizations
!
Jump Optimizing: Jumps are inverted or extended to the final target address
when the program efficiency is thereby increased.
36
8051-Specific Optimizations
37
example input and output are external functions, which require only a few
registers.
With Global Register Optimization
main () {
unsigned char i;
unsigned char a;
while (1) {
i = input ();
?C0001:
LCALL
input
;- 'i' assigned to 'R6' MOV
R6,AR7
do {
a = input ();
?C0005:
LCALL
input
;- 'a' assigned to 'R7' MOV
R5,AR7
output (a);
LCALL
_output
DJNZ
R6,?C0005
SJMP
?C0001
} while (--i);
input
DPTR,#i
A,R7
@DPTR,A
input
DPTR,#a
A,R7
@DPTR,A
/* output value */
LCALL
_output
/* decrement values */
MOV
MOVX
DEC
MOVX
JNZ
DPTR,#i
A,@DPTR
A
@DPTR,A
?C0005
SJMP
?C0001
}
}
RET
RET
Debugging
The C51 compiler uses the Intel Object Format (OMF51) for object files and
generates complete symbol information. Additionally, the compiler can include
all the necessary information such as; variable names, function names, line
numbers, and so on to allow detailed and thorough debugging and analysis with
dScope-51 or Intel compatible emulators. All Intel compatible emulators may be
used for program debugging. In addition, the OBJECTEXTEND control
directive embeds additional variable type information in the object file which
allows type-specific display of variables and structures when using certain
emulators. You should check with your emulator vendor to determine if it is
38
compatible with the Intel OMF51 object module format and if it can accept Keil
object modules.
Library Routines
The C51 compiler includes seven different ANSI compile-time libraries which
are optimized for various functional requirements.
Library File
Description
C51S.LIB
C51FPS.LIB
C51C.LIB
C51FPC.LIB
C51L.LIB
C51FPL.LIB
80C751.LIB
Source code is provided for library modules that perform hardware-related I/O
and is found in the \C51\LIB directory. You may use these source files to help
you quickly adapt the library to perform I/O using any I/O device in your target.
Description
_crol_
_cror_
_irol_
_iror_
_lrol_
_lror_
_nop_
_testbit_
39
40
SAMPLE
07/01/95
08:00:00
PAGE 1
MOV
SCON,#052H
0003 758920
MOV
TMOD,#020H
0006 758869
MOV
TCON,#069H
0009 758DF3
000C
MOV
?C0001:
TH1,#0F3H
000C
000F
0011
0012
0013
120000
8F00
EF
F4
6008
E
R
LCALL
MOV
MOV
CPL
JZ
getchar
c,R7
A,R7
A
?C0002
0015 120000
0018 120000
E
E
LCALL
LCALL
_toupper
_putchar
001B 80EF
001D
SJMP
?C0002:
; SOURCE LINE # 12
; SOURCE LINE # 13
; SOURCE LINE # 14
; SOURCE LINE # 16
; SOURCE LINE # 17
; SOURCE LINE # 18
?C0001
; SOURCE LINE # 19
001D E4
001E F580
CLR
MOV
A
P0,A
; SOURCE LINE # 20
0020 22
RET
; FUNCTION main (END)
MODULE INFORMATION:
STATIC OVERLAYABLE
CODE SIZE
=
33
---CONSTANT SIZE
=
------XDATA SIZE
=
------PDATA SIZE
=
------DATA SIZE
=
---1
IDATA SIZE
=
------BIT SIZE
=
------END OF MODULE INFORMATION.
0 WARNING(S),
41
Functional Overview
The A51 assembler translates an assembler source file into a relocatable object
module. If the DEBUG control is used, the object file contains full symbolic
information for debugging with dScope or an in-circuit emulator. In addition to
the object file, the A51 assembler generates a list file which may optionally
include symbol table and cross reference information. The A51 assembler is
fully compatible with Intel ASM-51 source modules.
Configuration
The A51 assembler supports all members of the 8051 family. The special
function register (SFR) set of the 8051 is predefined. However, the NOMOD51
control lets you override these definitions with processor-specific include files.
The A51 assembler is shipped with include files for the 8051, 8051Fx, 8051GB,
8052, 80152, 80451, 80452, 80515, 80C517, 80C515A, 80C517A, 8x552,
8xC592, 8xCL781, 8xCL410 and 80C320 microcontrollers. You can easily
create include files for other 8051 family members.
42
Test Program
---0000
---0000
0003
0005
0008
000B
000E
---0000
0004
0008
000C
---0000
OBJ
LINE
1
2
3
4
5
6
7
8
9
10
11
12
020000
F 13
14
15
16
120000
F 17
18
19
20
C200
F 21
900000
F 22
120000
F 23
120000
F 24
80F5
25
26
27
54455354
28
2050524F
4752414D
00
29
30
31
32
33
34
35
SOURCE
$TITLE ('Test Program')
NAME
SAMPLE
EXTRN CODE (PUT_CRLF, PUTSTRING, InitSerial)
PUBLIC TXTBIT
PROG
CONST
BITVAR
Reset:
SEGMENT
SEGMENT
SEGMENT
CODE
CODE
BIT
CSEG
AT
JMP
Start
RSEG
; *****
Start: CALL
PROG
InitSerial ;Init Serial Interface
RSEG
TXTBIT: DBIT
BITVAR
1
END
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
T Y P E
V A L U E
ATTRIBUTES / REFERENCES
B
C
C
C
C
C
C
C
N
C
C
B
0001H
000DH
----0010H
--------0005H
0000H
----0000H
0000H
0000H.0
REL=UNIT
9# 32
REL=UNIT
8# 27
EXT
4# 17
REL=UNIT
7# 15
EXT
4# 23
EXT
4# 24
SEG=PROG
22# 25
13#
2
SEG=PROG
13 17#
SEG=CONST
22 28#
SEG=BITVAR
5 5 21 33#
SEG
SEG
ADDR
SEG
ADDR
ADDR
ADDR
ADDR
NUMB
ADDR
ADDR
ADDR
R
A
R
R
R
0 WARNING(S), 0 ERROR(S)
43
Code Banking
The BL51 code banking linker/locator supports the ability to create application
programs that are larger than 64 Kbytes. Since the 8051 does not directly
support more than 64 Kbytes of code address space, there must be external
hardware that swaps code banks. The hardware that does this must be controlled
by software running on the 8051. This process is known as bank switching.
44
The BL51 code banking linker/locator lets you manage 1 common area and 32
banks of up to 64 Kbytes each for a total of 2 Mbytes of bank-switched 8051
program space. Software support for the external bank switching hardware
includes a short assembly file you can edit for your specific hardware platform.
The BL51 code banking linker/locator lets you specify the bank in which to
locate a particular program module. By carefully grouping functions in the
different banks, you can create very large, efficient applications.
Common Area
The common area in a bank switching program is an area of memory that can be
accessed at all times from all banks. The common area cannot be physically
swapped out or moved around. The code in the common area is either duplicated
in each bank (if the entire program area is swapped) or can be located in a
separate area or EPROM (if the common area is not swapped).
The common area contains program sections and constants which must be
available at all times. It may also contain frequently used code. By default, the
following code sections are automatically located in the common area:
!
Code Constants,
45
Functions which are frequently invoked from multiple banks should be located in
the common area.
07/01/95
08:00:00
PAGE 1
SAMPLE (SAMPLE)
TYPE
BASE
LENGTH
RELOCATION
SEGMENT NAME
----------------------------------------------------* * * * * * *
D A T A
M E M O R Y
REG
0000H
0008H
ABSOLUTE
DATA
0008H
0001H
UNIT
DATA
0009H
0001H
UNIT
000AH
0016H
BIT
0020H.0
0000H.1
UNIT
0020H.1
0000H.7
IDATA
0021H
0001H
UNIT
* * * * * * *
"REG BANK 0"
?DT?GETCHAR
_DATA_GROUP_
*** GAP ***
?BI?GETCHAR
*** GAP ***
?STACK
* * * * * * *
CODE
0000H
CODE
0003H
CODE
0024H
CODE
0030H
CODE
0057H
CODE
0068H
CODE
0080H
* * * * * * *
C O D E
0003H
0021H
000CH
0027H
0011H
0018H
000AH
M E M O R Y
ABSOLUTE
UNIT
UNIT
UNIT
UNIT
UNIT
UNIT
?PR?MAIN?SAMPLE
?C_C51STARTUP
?PR?PUTCHAR?PUTCHAR
?PR?GETCHAR?GETCHAR
?PR?_TOUPPER?TOUPPER
?PR?_GETKEY?_GETKEY
SAMPLE (SAMPLE)
SEGMENT
DATA_GROUP
+--> CALLED SEGMENT
START
LENGTH
---------------------------------------------?C_C51STARTUP
--------+--> ?PR?MAIN?SAMPLE
?PR?MAIN?SAMPLE
+--> ?PR?GETCHAR?GETCHAR
+--> ?PR?_TOUPPER?TOUPPER
+--> ?PR?PUTCHAR?PUTCHAR
0009H
0001H
?PR?GETCHAR?GETCHAR
+--> ?PR?_GETKEY?_GETKEY
+--> ?PR?PUTCHAR?PUTCHAR
-----
-----
0 WARNING(S),
0 ERROR(S)
46
47
48
the features of an 8051 without actually having target hardware. You may use
dScope-51 to test and debug your embedded application before actual 8051
hardware is ready. dScope-51 simulates a wide variety of 8051 peripherals
including the internal serial port, external I/O, and timers.
NOTE
dScope-51 and dScope-251 are essentially the same product. The only
differences are the support for either 8051 or 251 development tools. dScope is
used throughout this book to refer to either debugger.
Refer to dScope Simulator/Debugger Overview on page 70 for examples that
show how to use dScope-51.
Application manager for adding external programs into the pull-down menu,
Integrated make facility for building target programs from your projects,
NOTE
Vision/51 and Vision/251 are essentially the same product. The only
differences are the support for either 8051 or 251 development tools. Vision is
used throughout this book to refer to either IDE.
Refer to Vision IDE Overview on page 64 for examples that show how to use
Vision/51.
49
50
51
In addition to these features, the 251 offers configuration options for binary
mode (8051 compatible instruction set) or source mode (251 instruction set),
page or non-page mode, and wait state generation.
52
For information on the products which include these tools, refer to Chapter 3.
8051/251 Product Line on page 13.
NOTE
All of our 251 tools utilize the Intel OMF251 object module format.
Additionally, the L251 linker/locator can combine OMF251 and OMF51 object
modules.
53
Data Types
The C251 compiler supports the following data types.
Data Type
Bits
bit
signed char
-128 to +127
unsigned char
0 to 255
signed int
16
-32768 to +32767
unsigned int
16
0 to 65535
signed long
32
-2147483648 to +2147483647
unsigned long
32
0 to 4294967295
float
32
1.175494E-38 to 3.402823E+38
double
64
1.7E-308 to 1.7E+308
1, 2, 3, or 4
Object address
pointer
Bytes
Value Range
0 or 1
sbit
0 or 1
sfr
0 to 255
sfr16
16
0 to 65535
Memory Selector
The C251 compiler provides full support for the 251 architecture and can access
all system components. Each variable can be explicitly located anywhere in the
251 address space. The linear 16 Mbyte address space can be accessed with
many addressing modes. In addition, all addressing modes of the 8051 are fully
supported by the 251.
Selector
near
far
huge
data
Direct memory addressing for on-chip RAM (128 bytes); fast 8-bit accesses.
bdata
ebdata, ebit
idata
Indirect memory addressing for on-chip RAM (256 bytes); access with
MOV @Ri.
pdata
xdata
code
54
Memory Models
The memory model determines the default memory selector used for automatic
variables and parameter passing areas. With the HOLD directive you can
specify additional memory selectors for small objects, for example, the following
command line:
C251 PROG.C HOLD (2, 4, 8)
directs the C251 compiler to locate global variables 2 bytes in size or smaller in
data memory; variables 3 or 4 bytes in size in near memory; and variables 5 to 8
bytes in size in xdata memory.
The following table lists the memory areas used for each memory model.
Memory
Model
Parameters &
Automatic
Variables
Global
Variables
Constant
Variables
Pointer
Definition
Pointer
Size
TINY
data
data
near
near *
2 bytes
SMALL
data
data
near
far *
3 / 4 bytes
COMPACT
pdata
pdata
near
far *
3 / 4bytes
MEDIUM
near
near
far
far *
3 / 4 bytes
LARGE
xdata
xdata
near
far *
3 / 4 bytes
Program Size
The MCS 251 microcontroller family allows program sizes up to 16 Mbytes.
The generated 251 code can be optimized by using specific JMP and CALL
instructions. The ROM directive lets you choose the combination of JMP and
CALL instructions that is used.
ROM Directive
JMP Instruction
CALL Instruction
SMALL
AJMP
ACALL
COMPACT
AJMP
LCALL
LARGE
LJMP
LCALL
HUGE
LJMP
ECALL
55
Register Optimization
Depending on the program context, the C251 compiler allocates up to 24 CPU
registers for register variables. Any registers modified during function execution
are noted within each module. The linker/locator generates a global,
project-wide register file which contains information about the registers altered
by external functions. Consequently, the C251 compiler knows the registers
used by each function in an application. With this information, the C251
compiler can optimize the overall CPU register allocation of those functions.
Registers R0-R7 are used for parameter passing. This technique yields very
efficient code that compares favorably to assembly programming. Additional
parameters are passed via fixed memory locations or the 251s hardware stack.
Reentrant Code
The 251 supports stack-based variable addressing. This permits the C251
compiler to support fast reentrant functions. The #pragma reentrant and
#pragma noreentrant preprocessor directives control code generation.
Non-reentrant code stores variables in directly addressable memory locations
and yields the fastest program execution. Data overlaying considerably reduces
the memory requirements in C applications of this type.
C Run-Time Library
The run-time libraries provided with the C251 compiler contain over 100
routines, all of which are reentrant. Source code for I/O and memory allocation
functions is also included.
56
SAMPLE
07/01/95
08:00:00
PAGE 1
#include <reg251sb.h>
return (result);
}
0004
0007
000B
0010
0014
0014
0016
0018
A56D55
A57A5500
R
A57E540001
A57A5500
R
?C0001:
E500
R
4500
R
6019
XRL
MOV
MOV
MOV
WR10,WR10
result,WR10
WR10,#01H
result+02H,WR10
MOV
ORL
JZ
A,power+01H
A,power
?C0002
001A
001E
0022
0025
A57E1D00
A57E0D00
120000
A57A1D00
R
R
E
R
MOV
MOV
LCALL
MOV
DR4,result
DR0,num
?C?LMUL
result,DR4
0029
002B
002D
002F
0031
0031
0033
E500
1500
7002
1500
R
R
MOV
DEC
JNZ
DEC
A,power+01H
power+01H
?C0005
power
SJMP
?C0001
MOV
DR4,result
; SOURCE LINE # 10
; SOURCE LINE # 11
R
?C0005:
80E1
?C0002:
; SOURCE LINE # 13
0033 A57E1D00
; SOURCE LINE # 14
0037
0037 22
?C0004:
RET
; FUNCTION OUTSQR (END)
MODULE INFORMATION:
STATIC OVERLAYABLE
CODE SIZE
=
56
---CONSTANT SIZE
=
------XDATA SIZE
=
------PDATA SIZE
=
------DATA SIZE
=
---10
IDATA SIZE
=
------BIT SIZE
=
------EDATA SIZE
=
------FDATA SIZE
=
------END OF MODULE INFORMATION.
0 WARNING(S),
0 ERROR(S)
57
the end of the listing file.
58
Functional Overview
The A251 assembler translates 251 assembly source file into relocatable object
modules. If the DEBUG control is used, object files contain full symbolic
information for debugging with dScope or an in-circuit emulator. The A251
assembler also generates a list file which may include symbol table and cross
reference listings.
Test Program
OBJ
---------------000000
000000 020000
-----000000 120000
LINE
SOURCE
1
2
3
4
5
6
7
8
9
10
11
12
13
F 14
15
16
17
E 18
19
PROG
SEGMENT
STRINGS SEGMENT
BITVAR SEGMENT
Reset:
CSEG
AT
JMP
Start
RSEG
; *****
Start: CALL
CODE
CODE
BIT
0
PROG
InitSerial ;Init Serial Interface
000003
000005
000008
00000B
00000E
C200
900000
120000
120000
8000
F
F
E
E
F
-----000000
000004
000008
00000C
54455354
2050524F
4752414D
00
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-----0000.0
59
; This is the main program. It is an endless
; loop which displays a text on the console.
CLR
TXTBIT
; read from CODE
Repeat: MOV
DPTR,#TXT
CALL PUTSTRING
CALL PUT_CRLF
SJMP Repeat
;
RSEG STRINGS
TXT:
DB
'TEST PROGRAM',00H
RSEG
TXTBIT: DBIT
END
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
T Y P E
V A L U E
ATTRIBUTES
B
C
C
C
C
C
C
-C
C
C
B
000001H
------000010H
------------0005H
0000H
------0000H
00000DH
0000H
0000H.0
REL=UNIT, ALN=BIT
EXT
REL=UNIT, ALN=BYTE
EXT
EXT
SEG=PROG
SEG=?CO?SAMPLE?4
SEG
ADDR
SEG
ADDR
ADDR
ADDR
ADDR
---ADDR
SEG
ADDR
ADDR
R
R
R
R
R
SEG=PROG
REL=UNIT, ALN=BYTE
SEG=STRINGS
SEG=BITVAR
0 WARNING(S), 0 ERROR(S)
5
The register banks used,
and the total number of
warnings and errors is
stated at the end of the
listing file.
60
Normally, you invoke the linker from the command line specifying the names of
the object modules to combine. The default command-line directives for the
linker have been chosen to accommodate most applications without the need to
specify additional directives. However, it is easy for you to specify custom
settings for your application.
The LIB251 library manager lets you create and maintain library files. A library
file is a formatted collection of one or more object files. Library files provide a
convenient method of combining and referencing a large number of object files.
Libraries can be effectively used by the L251 linker/locator.
The LIB251 library manager lets you create a library file, add object modules to
a library file, remove object modules from a library file, and list the contents of a
library file. The LIB251 library manager may be controlled interactively or from
the command line.
61
NOTE
dScope-51 and dScope-251 are essentially the same product. The only
differences are the support for either 8051 or 251 development tools. dScope is
used throughout this book to refer to either debugger.
Refer to dScope Simulator/Debugger Overview on page 70 for examples that
show how to use dScope-251.
Application manager for adding external programs into the pull-down menu,
Integrated make facility for building target programs from your projects,
NOTE
Vision/51 and Vision/251 are essentially the same product. The only
differences are the support for either 8051 or 251 development tools. Vision is
used throughout this book to refer to either IDE.
Refer to Vision IDE Overview on page 64 for examples that show how to use
Vision/251.
63
Sample programs,
The examples and descriptions in this chapter are illustrated using our
Windows-based tools. These are the same tools distributed with our 8051/251
Evaluation Kit. Contact sales/support if you would like a copy of our
DOS-based evaluation kit.
NOTE
The 8051/251 Evaluation Kit includes evaluation versions of our 8051/251 tools.
The evaluation tools are limited in functionality and the code size of the
application you can create. Refer to the Eval Kit Notes for more information
on the limitations of the evaluation tools. For larger applications, you need to
purchase one of our development kits. Refer to Chapter 3. 8051/251 Product
Line on page 13 for a description of the kits that are available.
64
Application manager for linking external program files into the pull-down
menu,
65
Menu bar
Tool bar
Source window
Vertical
scroll bar
6
Status bar
Horizontal
scroll bar
66
You can quickly access many of the features of Vision using the buttons on the
tool bar.
Print
Tile horizontally
Save
Tile vertically
Open
New file
Find
Repeat find
Compile
Update
Show occurrences
Help
Paste text
Copy selected text
Cut selected text
Build all
Vision lets you simultaneously open and view multiple source files. While
writing part of your C program in one window, you can refer to header file
information in another window. You can move and resize source windows using
the mouse or keyboard.
67
Editor
Visions built-in editor can be customized to emulate many popular text
editors. You can change key assignments for almost all editor functions. The
following table lists a few of the editor functions that are available:
Beginning of File
Beginning of Line
Beginning of Page
Cascade Windows
Close File
Copy to Clipboard
Cursor Down
Cursor Left
Cursor Right
Cursor Up
Cut to Clipboard
Delete
Delete Line
Delete to End of Line
Destructive Backspace
End of File
End of Line
End of Page
Exclusive Mark
Forward Quick Search
Forward Replace
Full Search
Insert Template
Mark Block
Mark Columns
Mark Lines
Move/Resize Window
New File
Next Error
Open File
Page Down
Page Up
Paste from Clipboard
Previous Error
Previous Window
Print File
Repeat Last Search
Reverse Quick Search
Undo
Word Left
Word Right
Menu Commands
Through pull-down menus on the menu bar and editor commands, you control
the Vision operations. You may use either the mouse or the keyboard to access
commands from the menu bar.
68
The menu bar provides you with access to menus for file operations, editor
operations, project maintenance, external program execution (such as running
the dScope debugger/simulator or another program), development tool option
settings, window selection and manipulation, and on-line help.
6
Project Manager
Most embedded programs are composed of several source files. This means that
a project includes a large collection of individual files. Some files may require
compilation with the C51 compiler, some files may require assembly, and some
files may require custom translation in order to create a target program.
To accommodate the intricacies of project maintenance, Vision includes a
project manager facility. The project manager gives you a method of creating
and maintaining a project so that the target program is always up-to-date. The
project manager can easily handle file-to-file dependencies, including file
nesting, as well as the exact sequence of operations required to build the target.
Use the project manager dialog box to define the source files that make up the
project; use the make commands from the Project menu to compile source files
69
and to generate the target; then, use the simulator and emulator commands from
the Run menu to execute, test, and debug your application.
All aspects of a project are saved in a project file. The project file includes: the
source files that make up the target program; the compiler, assembler, and linker
command line options; the debugger and simulator options; and the make facility
options.
70
Menu bar
Tool bar
6
Register
window
Debug
window
Command
window
Serial
window
71
CPU driver
Open object file
Reset
Help
Command window
Symbol browser
window
Debug window
Memory window
Register window
Performance
analyzer window
Serial window
Watch window
CPU Simulation
dScope simulates virtually every derivative of the 8051 and 251
microcontrollers. Support for each CPU is provided through the use of DLLs.
Before you load your target application, you must select the appropriate CPU
driver from the CPU driver drop-down box on the tool bar. You may also select
the Load CPU driver command from the File menu. The following CPU drivers
are included with dScope.
CPU Driver DLLs
Supported Derivatives
80251S.DLL
82930.DLL
MON51.DLL
MON251.DLL
RISM251.DLL
80320.DLL
8051.DLL
72
Supported Derivatives
80515.DLL
80515A.DLL
80517.DLL
80517A.DLL
8051FX.DLL
8052.DLL
80552.DLL
8xC552
80751.DLL
80410.DLL
8xCL410
80781.DLL
8xCL781
73
Three display formats are available from the Command menu in the debug
window. They are:
!
View High Level. This display format shows your original source text
exactly as it appears in your source files.
View Mixed. This display format shows your original source text mixed
with the assembly code generated by the compiler or assembler.
View Assembly. This display format shows only the assembly code
generated for your source.
In addition to target program, the debug window can display a trace history of up
to 512 previously executed instructions. To enable the trace history, select the
Record Trace command from the Command menu in the debug window.
74
Command Window
You interact with dScope by entering commands from the keyboard and
selecting options with the mouse. You can enter nearly all dScope commands in
the command window. dScope responds to the commands you enter at the
command prompt (>).
You can interactively display and change variables, registers, and memory
locations from the command window. You can also enter assembly code to
patch or test parts of your program.
For example, you can type the following text commands at the command prompt:
Text
Effect
DPTR
R7 = 12
time.hour
time.hour++
index = 0
You are not limited to using the command window to control dScope. You can
also use the mouse to select pull-down menus from the menu bar and invoke
commands from the tool bar.
75
Serial Window
dScope provides a serial window for serial input and output. Serial data output
from the simulated CPU is displayed in this window. Characters you type in this
window are input to the simulated CPU.
This lets you simulate the CPUs UART without the need for external hardware.
Watch Window
You can use the watch window to interactively display variables and complex
structures. This is useful when you want to see the effects or your program on a
buffer or data structure.
Not only can you watch the variables in your program, you can also change them
using standard C expressions you enter at the command prompt in the command
window.
76
The performance analyzer window shows the name of each function or memory
range of each block along with a bar graph showing the percentage of time spent
in that function or block. You may select a function to view statistics in the
bottom portion of the performance analyzer window. The following statistics are
maintained for each function or program block:
!
min time
max time
avg time
total time
count
77
Other Features
In addition to the features described above, dScope offers numerous other
functions that provide a robust debugging environment.
Functions
A powerful feature of dScope is its ability to let you define and use C-like
functions for a wide variety of applications. For example, you can create dScope
functions to manipulate the on-chip peripherals, extend the command set of
dScope, and generate digital and analog input to hardware ports. There are three
types of functions available to dScope:
!
Breakpoints
It is easy to set breakpoints on high-level statements, assembler instructions, and
conditional expressions. Simply move the mouse pointer to the line or
instruction and double-click. You can even set a breakpoint based on the type of
memory access type or repetition factor. When dScope reaches a breakpoint, it
can perform a wide range of operationsfrom simple probing to running macro
functions.
78
Code Coverage
dScope provides a code coverage function which marks the lines of code that
have been executed. In the debug window, lines of code which have been
executed are market with a plus sign (+) in the left column.
You can use this feature when you test your embedded application to determine
the sections of code that have not yet been exercised. The Code Coverage dialog
box also provides useful information and code coverage statistics.
79
Sample Programs
This section describes the sample programs that are included in our evaluation
kits and product kits. The sample programs are ready for you to run. You can
use the sample programs to learn how to use our tools. Additionally, you can
copy the code from our samples for your own use.
The sample programs are found in the \C51\EXAMPLES\ directory. Each sample
program is stored in a separate subdirectory along with project files and batch
files that help you quickly build and evaluate each sample program.
The following table lists the sample programs and their directories.
Directory
Description
\A51\
\BADCODE\
\BL51_EX1\
\BL51_EX2\
\BL51_EX3\
BL51_EX3 demonstrates a bank switching program that has only one module
with functions located in different banks. Build this program using the
BL51_EX3.PRJ project file.
\BL51_EX4\
\CSAMPLE\
\DHRY\
\FIB\
The FIB sample program generates fibonacci numbers and shows you how to
use the reentrant function attribute to declare recursive functions. Build this
sample program using the FIB.PRJ project file.
\HELLO\
The HELLO sample program is the embedded 8051 C Hello World program.
Use the HELLO.PRJ project file to build this program. Refer to HELLO: Your
First 8051/251 C Program on page 81 for more information about this sample
program.
\LSIEVE\
80
Directory
Description
\MEASURE\
\RTX_EX1\
\RTX_EX2\
\SAMPL517\
\SSIEVE\
The SSIEVE sample program demonstrates the small model version of the
sieve of Eratosthenes prime number generator. This example is mainly
provided for benchmark enthusiasts. Build this program using the
SSIEVE.PRJ project file.
\TDP\
The TDP sample program demonstrates how to use interrupt-driven serial I/O
to interface to an alarm clock driven by an interrupt-driven timer. Build this
program using the TDP.PRJ project file.
\TRAFFIC\
The TRAFFIC sample program shows how to control a traffic light using the
RTX-51 Tiny real-time executive. Build this program using the TRAFFIC.PRJ
project file.
\WHETS\
To begin using one of the sample files, you must switch to the directory in which
the sample resides. Then, you may use either the provided DOS batch files or
the Vision for Windows project file to build and test the sample program.
The following sections in this chapter describe how to use the tools to build the
following sample programs:
!
81
*/
*/
#include <reg51.h>
*/
*/
#include <stdio.h>
/****************/
/* main program */
/****************/
void main (void) {
SCON = 0x50;
TMOD |= 0x20;
TH1
= 0xf3;
TR1
= 1;
TI
= 1;
/*
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
*/
*/
while (1) {
; /* ... */
}
/*
/*
/*
/*
*/
*/
*/
*/
This small application helps you confirm that you can compile, link, and debug
an application. You can perform these operations from the DOS command line,
using batch files, or from Vision for Windows using the provided project file.
Hardware Requirements
The hardware for HELLO is based on the standard 8051CPU. The only on-chip
peripheral used is the serial port. You do not actually need a target CPU because
dScope lets you simulate the hardware required for this program.
82
Editing HELLO.C
You can now edit HELLO.C. Select the Open command from the File menu.
Vision prompts you with the Open File dialog box. Select HELLO.C from the
files list and select the OK button.
83
HELLO.C
in a window.
84
When the build is complete, Vision displays a message indicating the build is
finished.
85
NOTE
The first time you invoke dScope, you may need to change the fonts and colors
used for the different windows. Select the Colors and Fonts command from the
Setup menu to configure the different windows in dScope.
86
Running HELLO
To run the HELLO program, click on the Go button in the debug window or
enter g at the command prompt. The HELLO program executes and displays
the text Hello World in the serial window.
You can single-step through the HELLO program using the Step buttons in the
debug window.
First, make sure to reset the CPU driver. To do this, make sure program
simulation is halted, then type the following lines at the command prompt:
87
reset
g,main
The reset command resets the simulated 8051 CPU. The g,main command
begins executing the program and stops when it reaches the main C function.
To step through the HELLO program, click on the StepOver button in the debug
window. Each time you click on this button, the simulator executes one
statement. The current instruction is always highlighted, but the highlight moves
each time you step. You may continue stepping through your program by
clicking on the StepOver button.
You may exit dScope at any time. To do so, halt execution of HELLO and enter
at the command prompt.
exit
88
Hardware Requirements
The hardware for MEASURE is based on the 80517 CPU. This microcontroller
provides analog and digital input capability. Port 4 and port 5 are used for the
digital inputs and AN0 through AN3 are used for the analog inputs. You do not
actually need a target CPU because dScope lets you simulate all the hardware
required for this program.
89
The Project Manager dialog box shows the source files that compose the
MEASURE project. There are three source files in this project.
MEASURE.C
MCOMMAND.C
GETLINE.C
To open a source file from the Project Manager dialog box, double-click on the
filename. To close the Project Manager dialog box, press Esc or click on the
Cancel button.
90
91
The initialization file that Vision passes to dScope automatically loads the CPU
driver and MEASURE program. Once these are loaded, dScope displays the
following screen.
Serial Text
Description
Clear
Display
Time
T hh:mm:ss
Interval
I mm:ss.ttt
Start
92
Command
Serial Text
Description
Read
R [count]
Quit
6
dScope supports the drag and drop feature of Windows and lets you access the
symbols this way. Use the mouse to drag and drop the idx symbol from the
symbol browser window to the command window. The fully qualified symbol
name with module name and function name are inserted as shown. The
qualifiers are separated by the backslash character (\). Select the command
window and press Enter. dScope displays the value of idx.
You may filter the symbols displayed by selecting the memory space filter. If
you clear the data check box, all symbols in the data memory area are removed
from the display.
93
You can specify a search mask to limit the symbols displayed. To limit the
symbol list to those beginning with the letter I, enter I* and click the Apply
button.
Since the memory window cannot show the entire memory range at once, you
may use the scroll bars to scroll through the memory area. The bounds for
scrolling are defined by the address range specified, 0x0000 to 0xFFFF for this
example.
6
To display the on-chip data memory, enter the following in the command
window.
D I:0x0000, I:0xFF
dScope can dynamically update the memory window while your application is
running. To toggle dynamic updating, select the Update Memory window
command from the Setup menu. When Update Memory window is checked,
dynamic updating is enabled.
94
Program Execution
Before you begin simulating the MEASURE program, use the Debug, Register,
and Serial buttons on the tool bar to display the debug, register, and serial
windows. You may disable other windows if your screen is not large enough.
From the toolbar, select the reset button to reset dScope. In the debug window,
select the View Mixed command from the Commands menu. Then, click on the
StepInto button once.
95
The StepInto button lets you single-step through your application and into
function calls. Click on the StepInto button a few more times to get to the loop
which clears the on-chip data space of the CPU.
6
To skip the initialization code and go directly to the main function, select the
command window and enter G,main. dScope executes the startup code and
halts on the first statement in the main function.
96
initialization code and stop one instruction before the main function is called.
You can do this in one of two ways:
!
Variant 1: Move the cursor line to the LJMP main instruction. You can
use the cursor keys or you can click the mouse on that line. Click on the
GoTilCurs button in the debug window. dScope starts execution at the
current program counter and stops at the current cursor line.
Variant 2: Double-click, with the right mouse button, on the LJMP main
instruction. This makes the selected line the current cursor line, starts
execution from the current PC, and stops when the current line is reached.
6
NOTE
After performing this command, the current cursor line and the current program
counter (PC) line are the same. The background color used for the line is the
PC highlight color.
97
When viewing your application in high level mode, the meaning of a step
changes to mean one high-level statement instead of one assembly instruction.
Click on the StepInto button and watch as the current program counter line
moves down the screen.
NOTE
The StepOver button operates much like the StepInto button with the exception
that a function call is considered a single statement.
98
Click on the Go button and dScope starts execution from the current program
counter and stops when the breakpoint is reached. To remove a breakpoint,
double-click on the line containing the breakpoint.
Call Stack
dScope internally tracks function nesting as the program executes. You can view
the function nesting at any time by opening the Call Stack window. Use the Call
Stack button on the tool bar to display Call Stack window.
This dialog box lists all currently nested functions. Each line contains a nesting
level number, the numeric address of the invoked function, and the symbolic
name of the function if debug information is available.
You can display the caller of a function by selecting the function from the list.
Then, you can use the Show invocation button to display the function call in the
debug window.
99
Port Inputs
dScope provides two different ways to set digital and analog port inputs. You
can use the Peripheral menu in the main window to view and change the status of
input lines or you can enter I/O values in the command window. The following
commands change port values in the command window.
PORT4=0x23
AIN1=3.3
Signal Functions
dScope lets you create signal functions to provide an input signal for digital or
analog inputs. To load a signal function, halt program execution by clicking on
the Stop button in the debug window and enter the following command in the
command window.
INCLUDE analog.inc
This loads the analog function from the file ANALOG.INC. This file defines a
signal function that adjusts the analog value that appears on analog channel 0.
This function appears as follows.
SIGNAL void analog0 (float limit) {
float volts;
printf ("ANALOG0 (%f) ENTERED\n", limit);
while (1) {
volts = 0;
while (volts <= limit) {
ain0 = volts;
twatch (30000);
volts += 0.5;
}
volts = limit-0.5;
while (volts >= 0.5)
ain0 = volts;
twatch (30000);
volts -= 0.5;
}
/* forever */
/* analog input-0 */
/* 30000 Cycles Time-Break */
/* increase voltage */
{
/* 30000 Cycles Time-Break */
/* decrease voltage */
}
}
After loading the analog include file, enter the following commands in the
command window.
ANALOG0 (5.0)
G
100
These commands set the limit for analog channel 0 to 5.0 volts and start program
execution.
Select the serial window and type D Enter. You should see the analog channel 0
signal begin swinging from 0 to 5 volts.
Trace Recording
It is common during debugging to reach a breakpoint where you require
information like register values and other circumstances which led to the
breakpoint. dScope provides trace recording for this purpose.
To enable trace recording, select the Record trace command from the Commands
menu to toggle instruction trace recording. When trace recording is enabled,
dScope records up to 512 assembly instructions and register contents.
You can use trace recording with the MEASURE example. Start running the
MEASURE program (click on the Go button in the debug window) and select
the serial window. MEASURE displays a menu and waits for input after
displaying Command. In the serial window, enter d.
When you enter this command, MEASURE begins to display measurement
values, the record time, two port values, and finally the analog input values.
The serial window displays what you would see on a dumb terminal connected to
the 80517s serial port.
Click on the Stop button in the debug window. This halts program execution
immediately. Click on the View Trace button to view the trace buffer.
101
The upper portion of the debug window shows the trace history. The lower
portion of the debug window shows instructions from the program counter. The
program counter line is the delimiter between the trace history and instructions
not yet executed.
The trace history lines begin with negative numbers. The newest trace buffer
entry is 1. The oldest entry is 511. When the buffer overflows, the oldest
entries are removed to make space for new entries.
You may scroll into the trace buffer using the keyboard or the mouse. The
register window shows the register contents for the selected instruction in the
trace buffer.
NOTE
Program execution must be stopped before you can view the trace buffer.
Watchpoints
Watchpoints are used to view the contents of simple variables, structures, and
arrays. You may setup watchpoints using the Watchpoints dialog box. To
display this dialog box, select the Watchpoints command from the Setup menu.
102
Breakpoints
You use breakpoints to stop program execution on a given address or a specified
condition. Execution breakpoints are the simplest form; a function address or
line number specifies where to stop execution.
103
You may want to halt program execution when a variable contains a certain
value. The following example shows you how to stop program execution when
the current.time.sec structure member is set to 3.
Select the Breakpoints command from the Setup menu to display the Breakpoints
dialog box. In the Expression input line, enter current.time.sec==3. In the
Count input line, enter 1. Select the Write check box (this option specifies that
the break condition is tested only when the expression is written to).
When you are finished, click on the
Define button to set the breakpoint.
To test the breakpoint condition
perform the following steps:
1. Reset dScope,
2. Begin executing the MEASURE
sample program (click on the Go
button in the debug window),
3. Press Enter in the serial window
at the MEASURE command
prompt.
After a few seconds, dScope halts execution. The program counter line in the
debug window marks the line in which the breakpoint occurred.
/* Initialize PA */
104
These commands create the performance analyzer address ranges for timing
statistics. You may create or view the ranges with the Setup Performance
Analyzer command in the Setup menu.
Perform the following steps to watch the performance analyzer in action:
1. Open the performance analyzer window using the button on the tool bar. The
display shows the ranges defined above. The <unspecified> line
accumulates all execution time outside the defined ranges,
2. Reset dScope,
3. Start program execution by clicking on the Go button in the debug window,
4. Select the serial window and type S Enter D Enter.
The performance analyzer window shows a bar graph for each range.
6
The bar graph is dynamically updated and shows the percent of the time spent
executing code in each range. Click on the range to see timing statistics for each
individual range.
105
When the error window displays, it may cover a portion of the source window.
Use the tile vertical or tile horizontal button to display the windows side-by-side.
107
Users Manual,
PC parallel-port cable.
108
A51 assembler,
The 8051 monitor lets you download and execute 8051 applications you develop
using the tools included with the package. You can build applications using
Vision and the C51 compiler and A51 assembler, and you can test and debug
applications using dScope and the monitor.
109
The MCB251SB includes a users manual that describes the board and data
books that describe the 251 architecture. A 2 Kbyte size limited tool set is also
included with the MCB251SB. The tools provided include:
!
A251 assembler,
all the necessary utilities and example programs to help you get started.
The 251 monitor program comes installed on the board. The monitor lets you
download and execute 251 applications you develop using the tools included
with the package. You can build applications using Vision and the C251
compiler and A251 assembler, and you can test and debug applications using
dScope and the monitor.
110
111
RTX-51 Tiny which is a subset of RTX-51 Full. RTX-51 Tiny easily runs on
single-chip 8051 systems without any external data memory.
RTX-51 Tiny supports many of the features found in RTX-51
Full with the following exceptions:
1. Task switching is accomplished by round-robin multitasking
and signals.
2. Preemptive task switching is not supported.
3. No message routines are included.
4. No memory pool allocation routines are available.
The rest of this section uses RTX-51 to refer to RTX-51 Full and RTX-51 Tiny.
Differences between the two are stated where applicable.
Introduction
Many microcontroller applications require simultaneous execution of multiple
jobs or tasks. For such applications, a real-time operating system (RTOS) allows
112
/* repeat forever */
/* increment counter */
Round-Robin Program
A more sophisticated C program may implement what is called a round-robin
pseudo-multitasking scheme without using a RTOS. In this scheme, tasks or
functions are called iteratively from within an endless loop. For example:
int counter;
/* repeat forever */
/* process serial input */
113
}
}
8
/* mark task 1 as ready */
/* loop forever */
/* update the counter */
/* loop forever */
/* update the counter */
114
RTX-51 Events
Rather than waiting for a tasks time slice to be up, you can use the os_wait
function to signal RTX-51 that it can let another task begin execution. This
function suspends execution of the current task and waits for a specified event to
occur. During this time, any number of other tasks may be executing.
*/
*/
*/
*/
/* loop forever */
/* update the counter */
/* pause for 5 clock ticks */
In the above example, job0 enables job1 as before. But now, after
incrementing counter0, job0 calls the os_wait function to pause for 3 clock
ticks. At this time, RTX-51 switches to the next task, which is job1. After
job1 increments counter1, it too calls os_wait to pause for 5 clock ticks.
Now, RTX-51 has no other tasks to execute, so it enters an idle loop waiting for
3 clock ticks to elapse before it can continue executing job0.
The result of this example is that counter0 gets incremented every 3 timer ticks
and counter1 gets incremented every 5 timer ticks.
115
*/
*/
*/
*/
/* loop forever */
/* wait for a signal */
/* update the counter */
In the above example, job1 waits until it receives a signal from any other task.
When it does receive a signal, it increments counter1 and again waits for
another signal. job0 continuously increments counter0 until it overflows to 0.
When that happens, job0 sends a signal to job1 and RTX-51 marks job1 as
ready for execution. job1 does not start until RTX-51 gets its next timer tick.
116
You can modify the above function declaration for job1 to give it a higher
priority than job0. By default, all tasks are assigned a priority level of 0. This
is the lowest priority level. The priority level can be 0 through 3. The following
example shows how to define job1 with a priority level of 1.
void job1 (void) _task_ 1 _priority_ 1 {
while (1) {
os_wait (K_SIG, 0, 0);
counter1++;
}
}
/* loop forever */
/* wait for a signal */
/* update the counter */
Use the following command lines to compile and link with RTX-51.
C51 EXAMPLE.C
BL51 EXAMPLE.OBJ RTX51
Interrupts
Message Passing
RTX-51 Full supports message exchange between tasks with the following
functions: isr_recv_message, isr_send_message, os_send_message, and
os_wait.
117
CAN Communication
Controller Area Networks are easily implemented with RTX-51/CAN.
RTX-51/CAN is a CAN task integrated into RTX-51 Full. An RTX-51 CAN
task implements message passing via the CAN network. Other CAN stations can
be configured either with or without RTX-51.
BITBUS Communication
RTX-51 Full includes both master and slave BITBUS tasks supporting message
passing with the Intel 8044.
Events
RTX-51 supports the following events for the os_wait function:
!
A Timeout suspends the running task for a defined number of clock ticks.
118
RTX-51 Functions
The following table lists some of the RTX-51 functions along with a brief
description and execution timing (for RTX-51 Full).
Function
Description
CPU Cycles
isr_recv_message
71 (with message)
isr_send_message
53
isr_send_signal
46
os_attach_interrupt
119
os_clear_signal
57
os_create_task
302
os_create_pool
os_delete_task
172
os_detach_interrupt
96
os_disable_isr
81
os_enable_isr
80
os_free_block
160
os_get_block
148
os_send_message
os_send_signal
os_send_token
os_set_slice
67
os_wait
Additional debug and support functions in RTX-51 Full include the following:
Function
Description
oi_reset_int_mask
oi_set_int_mask
os_check_mailbox
os_check_mailboxes
os_check_pool
os_check_semaphore
os_check_semaphores
os_check_task
os_check_tasks
119
CAN Functions
The CAN functions are available only with RTX-51 Full. CAN controllers
supported include the Philips 82C200 and 80C592 and the Intel 82526. More
CAN controllers are in preparation.
CAN Function
Description
can_bind_obj
can_def_obj
can_get_status
can_hw_init
can_read
can_receive
can_request
can_send
can_start
can_stop
can_task_create
can_unbind_obj
can_wait
can_write
120
Technical Data
Description
RTX-51 Full
RTX-51 Tiny
Number of tasks
16
RAM requirements
40 .. 46 bytes DATA
20 .. 200 bytes IDATA (user stack)
min. 650 bytes XDATA
7 bytes DATA
3 * <task count> IDATA
Code requirements
6KB .. 8KB
900 bytes
Hardware requirements
timer 0 or timer 1
timer 0
System clock
Interrupt latency
< 50 cycles
< 20 cycles
Mailbox system
not available
up to 16 memory pools
not available
Semaphores
8 * 1 bit
not available
121
Invocation:
where
sourcefile
commandfile
directives
Meaning
CASE
DATE(date)
DEBUG
ERRORPRINT!(filename)"
INCLUDE(filename)
MACRO
MODBIN
MODSRC
MPL
NOAMAKE
NOCOND
NOGEN
NOLINES
122
Meaning
NOLIST
NOMACRO
NOMOD251
NOMOD51
NOSYMBOLS
NOSYMLIST
OBJECT!(filename)", NOOBJECT
PAGELENGTH(n)
PAGEWIDTH(n)
PRINT!(filename)", NOPRINT
REGISTERBANK(num, ),
NOREGISTERBANK
RESET (symbol, )
SET (symbol, )
TITLE(title)
XREF
C51/C251 Compiler
Invocation:
where
sourcefile
commandfile
directives
123
Meaning
CODE
COMPACT
DEBUG
DEFINE
FLOATFUZZY
HOLD(d,n,x)
INTERVAL
INTR2
INTVECTOR(n), NOINTVECTOR
LARGE
LISTINCLUDE
MAXARGS(n)
MOD517
MODBIN
MODDP2
MODSRC
NOAMAKE
NOAREGS
NOCOND
NOEXTEND
NOINTPROMOTE
NOREGPARMS
OBJECT!(filename)", NOOBJECT
OBJECTEXTEND
OPTIMIZE
ORDER
PAGELENGTH(n)
PAGEWIDTH(n)
PARM51
124
Meaning
PREPRINT!(filename)"
PRINT!(filename)", NOPRINT
REGFILE(filename)
REGISTERBANK
ROM({SMALL|COMPACT|LARGE})
SMALL
SRC
SYMBOLS
WARNINGLEVEL(n)
L51/BL51 Linker/Locator
Invocation:
where
inputlist
outputfile
commandfile
directives
BL51 Controls
Meaning
BANKAREA
125
BL51 Controls
Meaning
BANKx
BIT
CODE
COMMON
DATA
IDATA
IXREF
NAME
NOAMAKE
NODEBUGLINES
NODEBUGPUBLICS
NODEBUGSYMBOLS
NODEFAULTLIBRARY
NOLINES
NOMAP
NOOVERLAY
NOPUBLICS
NOSYMBOLS
OVERLAY
Directs the linker to overlay local data & bit segments and
lets you change references between segments.
PAGELENGTH(n)
PAGEWIDTH(n)
PDATA
PRECEDE
RAMSIZE
REGFILE(filename)
RTX51
RTX51TINY
STACK
XDATA
These controls are available only in the BL51 code banking linker/locator.
126
L251 Linker/Locator
L251 inputlist !TO outputfile" !directives"
Invocation:
L251 @commandfile
where
inputlist
outputfile
commandfile
directives
L251 Controls
Meaning
ASSIGN
CLASSES
IXREF
NAME
NOAMAKE
NOCOMMENTS
NODEFAULTLIBRARY
NOLINES
NOMAP
NOOVERLAY
NOPUBLICS
NOSYMBOLS
NOTYPES
Excludes type information from the listing file and the object
file.
OBJECTCONTROLS
L251 Controls
127
Meaning
OVERLAY
Directs the linker to overlay local data & bit segments and
lets you change references between segments.
PAGELENGTH(n)
PAGEWIDTH(n)
PRINTCONTROLS
PURGE
RAMSIZE
REGFILE(filename)
RESERVE
RTX251
RTX251TINY
SEGMENTS
SEGSIZE
WARNINGLEVEL(n)
OC51 banked_file
where
banked_file
where
absfile
hexfile
128
where
absfile
hexfile
HEX
H386
RANGE
start
end
LIB51 !command"
LIB251 !command"
where
command
Meaning
ADD
CREATE
DELETE
EXIT
HELP
LIST
129
Index
Vision
Editor ............................................59
Menu Commands ..........................59
Options..........................................60
Overview.......................................56
Project Manager............................60
Starting..........................................56
Vision/251 for Windows ..................54
Vision/51 for Windows ....................43
251 Development Tools .....................46
8051 Development Tools ...................21
8051 Microcontroller Family..............21
8051/251 Compiler Kit
Subscription.....................................19
8051/251 Developers Kit
Subscription.....................................18
8051/251 Development Tools .......21,45
8051/251 Product Line .......................11
A
A251 ...................................................17
A251 Assembler .................................51
Functional Overview.....................51
Listing File Example.....................51
A251 Macro Assembler Kit................17
A51 .....................................................15
A51 Assembler ...................................37
Configuration ................................37
Functional Overview.....................37
Listing File Example.....................37
A51 Macro Assembler Kit..................15
Additional items, document
conventions.......................................iv
alien ....................................................31
asm .....................................................31
AUTOEXEC.BAT ...............................9
B
Backing Up Your Disks........................6
C
C251 Compiler................................... 46
Data Types ................................... 47
Listing File Example .................... 49
Memory Models ........................... 48
Memory Selector .......................... 47
Program Size ................................ 48
Reentrant Code............................. 49
Register Optimization................... 49
Run-Time Library......................... 49
C251 Compiler Kit............................. 16
C251 Developers Kit ........................ 16
C51 Compiler..................................... 22
Code Optimizations...................... 32
Compact model ............................ 26
Data Types ................................... 24
Debugging .................................... 34
Function Return Values................ 30
Generic Pointers ........................... 27
Interfacing to Assembly ............... 30
Interfacing to PL/M-51................. 31
Interrupt Functions ....................... 29
Language Extensions.................... 23
Large model ................................. 26
Library Routines........................... 35
Listing File Example .................... 35
Memory Models ........................... 26
Memory Specific Pointers ............ 27
Memory Types ............................. 24
Parameter Passing ........................ 29
Pointers ........................................ 27
Real-Time Operating System
Support ...................................... 30
130
Index
D
DEBUG ........................................ 37,51
Demo Kit ............................................. 2
Directory Structure .............................. 7
Disk Cache......................................... 10
Displayed text, document
conventions ...................................... iv
DK251 ............................................... 16
DK51 ................................................. 14
Document conventions........................ iv
Documentation Changes ...................... 3
DOS-Based Product Installation .......... 6
DOS-based tool requirements .............. 5
double brackets, use of........................ iv
DS251 ................................................ 17
DS51 .................................................. 15
dScope
Breakpoints .................................. 69
E
ellipses, use of .....................................iv
ellipses, vertical, use of .......................iv
endasm ...............................................31
Environment Settings ...........................8
Evaluation Kit ......................................2
Evaluation Users ..................................2
Experienced Users................................3
F
Filename, document conventions ........iv
FR251.................................................18
FR51...................................................15
G
Global Register Optimization.............33
H
Help......................................................3
HOLD.................................................48
I
Improving System Performance ...........9
Installation............................................5
Installing the Software..........................6
interrupt..............................................29
Introduction..........................................1
isr_recv_message ......................106,108
isr_send_message ......................106,108
isr_send_signal .................................108
italicized text, use of............................iv
K
Key names, document
conventions.......................................iv
L
L251 linker/locator .............................52
LARGE..........................................25,26
LIB251 library manager .....................53
LIB51 library manager .......................42
M
Manual Topics......................................1
Map files.............................................41
MCB251SB Evaluation Board ...........99
MCB517A Evaluation Board .............98
MCS 251 Microcontroller
Family..............................................45
N
New Users ............................................2
NOMOD51.........................................37
NOOVERLAY ...................................39
NOREGPARMS............................29,30
O
OBJECTEXTEND .............................34
OC51 Banked Object File
Converter .........................................42
OH251 Object-Hex Converter............53
OH51 Object-Hex Converter..............42
oi_reset_int_mask.............................108
oi_set_int_mask................................108
OMF251 .............................................46
OMF51 .....................................22,31,34
Omitted text, document
conventions.......................................iv
Optional items, document
conventions.......................................iv
os_attach_interrupt ...........................108
os_check_mailbox ............................108
131
P
PK51 .................................................. 13
Printed text, document
conventions ...................................... iv
ProROM EPROM Emulator .............. 97
R
RAM Disk............................................ 9
README.TXT.................................... 3
reentrant ................................... 28,29,49
REGPARMS...................................... 29
Reporting a problem ............................ 3
Requesting Assistance.......................... 3
ROM .................................................. 48
RTX-251 Full Real-Time Kernel ....... 18
RTX-51 ............................................ 101
BITBUS Communication ........... 107
CAN Communication................. 107
Compiling................................... 106
Events.................................. 104,107
Functions .................................... 108
Interrupts .................................... 106
Introduction................................ 101
Linking ....................................... 106
132
Index
U
User ......................................................2
using ...................................................29
V
S
sans serif typeface, use of ................... iv
SCA251 ............................................. 19
SDK251 ............................................. 18
SMALL......................................... 25,26
SRC.................................................... 31
System Requirements........................... 5
T
Technical Support................................ 3
W
Whats Included ...................................2
Windows-Based Product
Installation.........................................7
Windows-based tool
requirements ......................................5