Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Keil Debugger/Simulator
Software Installation
Step 1: Put the provided CD into CD player, use Start\Run command to Open
the \EK51\Setup.exe file as shown below. Then click OK button.
A-1
Step 2: Welcome window shows the installation about the PK51 Eval Version.
Click Continue button.
Step 3: Enter the drive and directory where the PK51 Eval Version will be
placed. The default is C:\C51EVAL. If accepted, click OK to
continue.
Step 4: Enter your name and organization, then click Continue button.
A-2
Step 5: A Registration Confirmation window shows your information entered.
If correct, click Yes button to continue.
A-3
dScope-51 Debugger
A-4
The dScope divides the screen into several fully user configurable areas.
Each window can be shown or hidden. A window is selected by clicking the
mouse pointer somewhere within the window.
dScope-51 Components
1. Mainframe window
The Mainframe window is the parent of all other dScope windows. It hosts
the main menu, a toolbar with shortcuts for showing and hiding the
individual child windows, and a statusbar located on the bottom of the
mainframe window for showing a short description text for each menu
entry. The description is also available for the toolbar buttons. To get it,
select some button by moving the mouse pointer over a button. Press the
left mouse button, and keeping the left mouse button pressed, watch the
text in the status bar.
A-5
Toolbar buttons:
Open file
CPU driver selection
Show/hide Command window
Show/hide Debug window
Show/hide Register window
Show/hide Serial I/O window
Show/hide Watch window
Show/hide Performance Analyzer window
Show/hide Memory window
Show/hide Symbols window
Show/hide Call-Stack window
Show/hide Code Coverage window
Show/hide Tool Box window
Reset dScope
Show the About dialog
A-6
2. Command window
The Command window is used to enter command lines.
A-7
(f) Load CPU driver or file: >LOAD filename
Examples:
> LOAD 8051.DLL ; load 8051 driver DLL
> LOAD TEST1.HEX ; load TEST1.HEX file
3. Debug window
The Debug window is used to display: (1) source program, (2) assembler
instructions, or (3) a combination of both. The display mode can be
changed using the Commands menu entry from the menu line. Text can
be scrolled upwards, downwards or horizontally by using the scrollbars.
The Commands menu contains other commands dealing with trace
recording, source module selection, text search and others. The
remaining menu entries are used to start and stop execution of the user
program. These entries are duplicated in the dialogbar to the right of the
Debug window by using the Commands\Show Dialogbar command.
(1) Load file: A project or HEX file can be loaded to the Debug window
for simulation and debugging by using the [File\Load object file…]
command and selecting the drive and folder.
A-8
(2) Commonly used commands
[Go]: Start execution until some breakpoint gets active.
[StepInto]: Step into next statement.
[StepOver]: Step over next statement.
[StepOut]: Step out of the current function.
[Stop]: Stop execution. Before terminating dScope-51, the program in
execution must be stopped first.
[Assemble…]: Edit assembly instructions in the Debug window by
double-clicking on an instruction line to be edited in the Inline
Assembler window shown below, entering 8051 instruction, and then
clicking the Assemble button.
A-9
4. Registers window
The Registers window shown below is used to show the contents of the
various CPU registers, the current program counter (PC) and executed
cycles plus time information. The register layout in the Regs window
depends on the type of the CPU being simulated. The register contents
are updated each time program execution is stopped or if the window is
selected or double clicked.
A-10
6. Watch window
The Watch window shown below is used to show the values of aggregate
types (structures, unions, arrays) or simple scalar values. The items to be
displayed are defined or removed either by commands in the COMMAND
window or with a specific dialog for simple operation of the WATCH window.
The WATCH window is updated after break out of execution but can be
directed to update itself periodically while the user program is executed.
A-11
8. Memory window
The Memory window shown below is used to display a range of memory in
Hex bytes. The range may be up to 64K in length. This window is
updated after break out of execution but can be directed to update itself
periodically while the user program is executed. The Memory window
contains four fields: memory identifier (D=internal and X=external),
address, Hex value, and ASCII value.
9. Symbols window
The Symbols window shown below is used to show the complete symbolic
debugging information of the loaded user program. This information
includes public symbols, functions with local symbols and line number
information. The output can be limited to symbols with a specific memory
type. The Symbol browser also includes a simple but powerful regular
expression search engine.
A-12
The Symbol browser supports the dragging and dropping of symbols to
other dScope windows such as the Command window and to the input
fields of all dialogs which require expressions for input such as define
watch, inline assemble and others.
A-13
11. Code Coverage window
The Code Coverage window shown below is used to show the functions
based on the user selectable module together with the number of
instructions of each function and the percentage value the instructions
already executed. Additional features include dynamic update while
executing the user program and synchronizing the Debug window to the
next executed or unexecuted instruction.
Peripherals
If CPU driver (for example, 8051.dll) is selected, Peripherals command
appears on the main menu line of dScope-51 mainframe window. The
contents of 8051 on-chip peripherals, such as I/O ports, interrupts,
timer/counters, and serial port, can be displayed and specified in its sub
A-14
window.
1. I/O Ports: Each window of parallel ports displays the contents of the latches
and the pins. Bit value can be set or cleared.
A-15
4. Serial Channel: The Serial Channel window displays the contents of serial
port registers and control bits as well as the baudrate.
Setting Breakpoints
A breakpoint is used to halt a program run at a certain code address. You can
simply set a breakpoint anywhere by double-clicking on an instruction line.
Once the breakpoint is set, a breakpoint number [BR n] presents at the right
end of the instruction line as shown below. The dScope supports up to 40
simultaneously active breakpoints.
A-16
Color Setup
Open the Color Setup window using [Setup\Colors and fonts] command. In
this window you can set the background color and text color of the selected
window. To set font, click the [Select Font>>>] button.
A-17
Program Debugging Procedure
μVision-51
A-18
uVision-51
Text Editor
Source Assembly
(.A51)
A51 Assembler
Object Listing
(.OBJ) (.LST)
BL51 Linker
Executable
Machine Code
OH51 Converter
Programming
A-19
Run μVision-51 by executing Start\Programs\Keil PK51-Eval\uVision-51 and
open the μVision/51 evaluation window. The mainframe window hosts the
main menu, a toolbar with shortcuts for menu entries, and a statusbar located
on the bottom of the mainframe window for showing a short description text for
each menu entry.
Toolbar Buttons:
New file
Open
Save
Print
Find
Compile
Update A Project
Build All
Tile Horizontally Command
Tile Vertically Command
Debug (dScope-51)
A-20
To create a new source file, use [File\New] command to open the editor
window as shown below.
Now you can write a source program in the working area. Then save the
source file onto the disk using the [File\Save As] command and select .A51
extension for assembly source and .C for 8051 C source.
A-21
Create A New Project
Use the [Project\New Project…] command to open the Create New Project
dialog box as shown below. Select drive and folder, enter the filename and
click OK.
Project dialog box is shown below. The project source files and options are
listed.
Select a source file to be added to the current project and then click Add
button. The Add File to Project dialog box is shown below.
A-22
Select drive, folder, source file, and click Add button to add the files selected to
the current project. Click Close button and return to Project dialog box.
Click Save button to save the current project.
A-23
LOAD 8051.DLL
Then press Ctrl+Z keys. This file is used for loading 8051 driver.
The Object thumb tab shows the options that control how the
assembler generates the object file.
A-24
The Misc thumb tab shows miscellaneous assembler options.
A-25
The Listing thumb tab shows controls the linker uses when creating a
map or listing file.
The Linking thumb tab shows controls the linker uses when creating an
absolute object module or a banked object module.
The Size/Location thumb tab shows controls that specify the size or
location of different memory areas.
A-26
(4) Make Options
Use [Options\Make…] command to open the Make Options dialog box.
The Make Options dialog box lets you select options for the make
process. Four groups of options are available in this dialog box: After
Compile options, After Make options, Misc options, and Extensions
options.
The After Compile thumb tab shows what μVision-51 does after all files
in the project are assembled and compiled.
The After Make thumb tab shows what μVision-51 does after all files in
the project are processed and the linker, library manager, and object
A-27
converters have been run.
The Extensions thumb tab shows the file extensions used by your
source and library files.
A-28
Compiling and Linking
Once a project is created, the project can be complied and linked with the
[Compiler File], [Make-Update Project], and [Make-Build Project] commands in
Project menu.
(1) Compile File command is used to assemble project source and create
object.
(2) Make-Update Project command is used to assemble project source
and link object and create executable and HEX files.
(3) Make-Build Project command is used to assemble project source and
link object and create executable and HEX files.
If syntax errors occur, ERR window will be shown and the error instruction line
is colored.
A-29
To debug the project, enter dScope-51 by using [Run\dScope Debugger…]
command. Open Command window and enter [LOAD filename] command
line. The source program will be shown in Debug window.
A-30