Section 1 Keil C51 Compiler Control Instructions
The control instructions of the C51 compiler are divided into three categories: source file control, target file control and list control.
1. Source file control
NOEXTEND: C51 source files are not allowed to use ANSI C extension functions.
DEFINE (DF): define preprocessing (in C51 command line).
2. Object file (Object) control class:
COMPACT LARGE SMALL Select compilation mode
DEBUG(DB) Contains debugging information for use by the emulator or dSCope51.
NOAMAKE(NOAM) Disable AutoMake information logging
NOREGPARMS Disable passing parameters using registers
OBJECTEXTEND(OE) Object file contains additional variable type information
OPTIMIZE(OT) specifies the optimization level
REGFILE(RF) specifies a register file for global optimization.
REGISTERBANK(RB) Specifies a register bank name for absolute register access.
SRC does not generate target files, only assembly source files
Other controls are not commonly used.
3. Listing file control class:
CODE(CD): Add assembly listing to listing file
LISTINCLUDE (LC): Display indude files
SYMBOLS (SB): List file contains a list of all symbols in the module
WARNINGLEVEL(WL): Select the "Warning" level
Section 2 Use of dScope51
1. dScope51 for Dos
In general, dScope51 has the following features:
l High-level language display mode
l Integrated hardware environment simulation
l Single-step or "GO" execution mode
l Memory, register and variable access
l The value of the Watch expression
l Function and signal function
The following is a detailed description of how to implement the above functions after entering dScope51 for
Dos. dScope51 uses a drop-down menu format and window display control. There are four windows: language, serial, exe, and register. exe is the command line window, language is the program window, serial is the serial port window, and register is the register window.
(1) High-level language display mode
Click "View" in the main menu, and the three commands "Highlevel", "Mixed" and "Assembly" in the first column will display the loaded program in "high level", "mixed level" and "assembly level" respectively for easy debugging.
(2) Integrated hardware environment simulation display
The "Peripheral" items in the main menu can display the status of the simulated hardware environment, including:
I/O Port: Displays the value of each I/O port. For 8031, the values of P1, P2, P3, P0 and pins in SFR are listed separately:
Interrupt: Displays the interrupt status such as whether the entry mode of the 5 interrupt sources is allowed, priority, etc.
Timer: Displays the mode, initial value status, etc. of each timer/counter.
int Message: Interrupt information is allowed. If it is allowed (“>>” appears), the interrupt source information will be displayed when the interrupt is requested. For example, when an interrupt occurs, it will display:
“interrupt Timer 0 occured”等
A/D converter:
When the A/D converter status is displayed as None, it will prompt “None”.
Serial: Serial port information display, including serial port mode, baud rate, etc.
Other: Other devices. If it is 8031, it will display “None”.
(3) Single step or “Go” execution
"F8" single-step execution, "F5" full-speed execution to the breakpoint. Or select Trace single-step execution in the main menu and Go full-speed execution in the CPU.
(4) Memory register and variable access
External memory management MAP menu: set, cancel, display and process available storage space.
Modify Code: ASM command
Memory display command: D category is (X, D, I, B, C)
Modify memory command: E has the following commands EB, EC, EI, EL, EF, EP
Complex data type display: Object command; used to display the contents of a structure or array. To make this command effective, the C51 compiler must have DB and OBJECTEXTEND.
Disassembly command: U
(5) The value of the "Watch" expression
There are four items in the "Watch" column of the View menu: including defining Watch Point (Define), deleting Watch Point (remove, kill
all), and automatic update options.
You can also use WS, WK and other commands instead. See the "Expression" type below:
dScope51 can set up to 16 WtchPoint expressions at a time, which are displayed in the Watch
Window. The expressions can be simple variables or complex data types such as structures, arrays, and pointers to structures. For example:
>WS *ptime
>WS ptime→hour
>WS some_record[o], analog, etc.
(6) About .IOF files
After starting DS51, you must load the .IOF file to make the CPU and Peripheral items work. The use of this function is based on the different characteristics of the 8051 series CPU. Load the 8051 CPU hardware device simulation driver file. For example, the 8031CPU must load
8051.IOF in the DS51 directory.
2. dScope for Windows
dScope for Windows has all the functions of dScope for DOS. In addition, it has the following obvious advantages:
(1) Standard Windows interface, easier and simpler to operate;
(2) Common operations are performed using dialog boxes rather than the command line interface of Dos;
(3) Richer window resources: memory window, coverage analysis, and running status analysis window, which enhance the debugging function;
Because dScope for Windows is powerful, its specific operation is described in detail in Chapter 8.
Section 3 Monitor51 and its use
1. Hardware requirements of Monitor51
(1) The hardware system is a 51 series CPU;
(2) It has a 5K external program memory (starting from address O) to store the Monitor51 program;
(3)
It has a 256-byte external data memory and a 5K trace buffer. In addition, the external data memory must be large enough to accommodate all application code and data, and all external data memories must be von Neumann memories, that is, they can consistently access the XDATA and Code spaces.
(4) A timer is used as a baud rate generator for the serial port;
(5) 6 bytes of free stack.
2. Use of Mon51
There are three ways to use Mon51:
(1) Dos command mode:
first use install to configure MON51, then use MON51 to enter the Monitor state, and enable various commands to debug Monitor51.
(2) tScope51 mode:
start tScope51, load the MON51.IOT driver file in the TS51 directory, and communicate with the target board.
(3) dScope51 for Windows mode:
when selecting the CPU driver file, select "MON51.dll", then check the target board and enter the MON51 state.
3. Configuration of MON51
(1) Configuration of MON51 for Dos
Run the install file (in the MON51 directory). Different parameters can be used to configure different hardware environments. INSTALL Serialtype
[xdstastart[codestart[bank][PROMCHECK]]] For detailed instructions, see the MON51 help file or user manual.
(2) Configuration of MON51 for Windows
When MON51.dll is enabled, the system will automatically check the target board connection. If the configuration is incorrect, the "Configuration" dialog box will pop up to set the PC serial port, baud rate, etc. Click "Apply" to make it effective.
4. Serial port connection diagram:
The transceiver is cross-connected, RTS, CTS are directly connected, DSR, DTR are directly connected, and the specific pin arrangement refers to the serial port data.
5. MON51 command and use
For detailed MON51 commands, please refer to the help.
Section 4 Using the Integrated Development Environment (IDE)
1. Use of Ishell for Dos
After entering Ishell, you will see two windows: one is the file window and the other is the Dos command line window. Above the window is a drop-down command menu, in which Files controls the visibility of the file window.
The first step in using Ishell is to configure the system, which means learning how to modify and create two files:
(1) Ishell.CFG file
Each project has an Ishell.CFG, which contains some information under the Option menu and Setup menu; Bell enabled, Monochrome
enabled, Editor Selected, CRT Lines, target enviroment, name of user edit, Automatic
load for configuration enabled, file window enabled, file specification for file
window, translate command line controls, project name, etc.
The above information must be set for each project, and then save the "setup" and "save" to start the following work.
(2) IShell.col file
For IDE color settings, if you do not change them, you can use the default settings.
(3) CDF file
This file is located in the BIN directory. Each file defines a set of external function toolkits, that is, defines external environments such as 8051.CDF, USER.CDF, etc. Developers can modify CDF files for their own use. As for the content of CDF files, you can check
8051.CDF to know. Note that .CDF files are the core of the Ishell system. Different CDF files can make this IDE suitable for different compilation and connection systems, that is, this IDE is not only suitable for C51.
Let's talk about the Automake tool:
C51's Automake is a
project manager. In the 8051 toolkit, information about a project is retained in the form of an OBJECT file. AutoMake uses this information to manage the project. Once a project is manually created, Automake can generate a new OBJECT, which AutoMake uses to compile the modified files.
Automake supports C51, A51, L51/BL51, C166, A166, L166 and other compilers and connectors. Click Automake in the main menu to run this tool.
Ishell for Dos is complicated to use, so it is recommended to use uVision for Windows.
2. Usage of uVision for Windows
uVision is a standard Windows application. Its compilation function, file processing function, project processing function, window function and tool reference function (such as A51, C51, PL/M41, BL51
dScope, etc.) are much stronger than Ishell for Dos.
uVision uses BL51 as the connector. Since BL51 is compatible with L51, all projects that can work under Dos can be connected and debugged in uVision.
uVision uses dScope for Windows as the debugger, which supports both MON51 and system simulation. It is more powerful and easier to use than for DOS, and has powerful debugging functions.
Notice:
(1)
You must know how to use the items under the Option menu. A51, C51, PL/M51, and BL51 define the compilation and linking control instructions used by each file, dScope defines a dScope initialization file, and Make defines a make file.
(2) To enter debugging, run dScope under the RUN menu.
(3) Project includes new creation, opening, modification, updating, compiling, and connection. For specific usage, please refer to the following examples.
Previous article:Some experience of using keil c51 compiler
Next article:Keil C51 library function reference
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to read the timing diagram--Detailed explanation of nand flash read operation
- FPGA Experiment (VI) SignalTap II parameter setting and waveform generation
- [Mill MYB-YT507 development board trial experience] Use Python to obtain computer memory and CPU information
- How to deal with idle pins in CMOS circuits
- "Practice together in 2021" + 2020 is my first year of letting go
- Ask everyone a question about chip manufacturing
- [Raspberry Pi 4B Review] Raspberry Pi 4 drives 3G network card to send and receive text messages and wireless Internet access
- ESP32 VL53L5CX Multi Zone Range Sensor
- Simple questions about DC motors
- Dual-receive and dual-transmit radio RF board based on XC7Z100+ADRV9009