Copyright: Copyright (c) 1996-1998 Keil Software, Inc.
Citation: Copyright (c) 1996-1998 Keil Software, Inc.


Help Contents
Contents

Monitor-51

Overview

Target Hardware Requirements

MON51: DOS Monitor Driver

MON51.EXE Invocation

Control Keys

MON51 Terminal Control Codes

Serial Transmission Line

MON51 Commands

ERROR Messages

MON51.DLL: dScope Monitor Driver

Overview

Configuration Dialog

Restrictions of dScope with MON51.DLL

Monitor-51 Configuration

Install Invocation

Configuration Files Settings

Preparing Programs for MONITOR-51

Translating Modules

Linking/Locating Modules


Monitor-51 - Overview
Overview

MONITOR-51, communicates with your PC over the serial interface. Therefore, the operation of the monitor requires either MON51 or dScope-51 for Windows. However, debugging with code banked hardware is only supported with dScope-51.  The following MON51 commands are supported:

•	Display the contents of the various 8051 memory spaces in hexadecimal and ASCII format.

•	Change memory contents interactively.

•	Display and change register and "Special Function Register" contents.

•	Initialize the various 8051 memory spaces with a constant value.

•	Disassemble the code area into 8051 mnemonics.

•	In-line Assembler.

•	Real-Time Go with up to 10 fixed and 1 temporary breakpoint.

•	Control commands for up to 10 fixed breakpoints.

•	Single step execution, alternatively with the possibility to execute a subroutine as one step.

•	Down-load and up-load for Intel HEX and Object files.

•	Command menu (help).


Target Hardware Requirements

MONITOR-51 requires the following hardware components of the 8051 system:

•	CPU or derivative (e.g. SIEMENS 80517A)

•	5 Kbytes external code memory (EPROM) starting at address 0 (loaded with MONITOR-51 software)

•	256 Byte external data memory (XDATA RAM) and 5 Kbytes trace buffer (optional).  Additionally, the external data memory must be big enough to hold the complete application (code and data).  All external data memory areas must be 'von Neumann' wired, meaning that access is possible from XDATA and CODE space.  A common way to do this is to connect the CPU signals /PSEN and /RD to a AND gate.  The output of this AND gate is then connected to the /RD pin of the RAM.

•	Serial interface with a timer as baudrate generator.

•	Between 1 and 5 port pins if you are using a banked hardware (for 2 - 32 banks).  See example hardware schematics in the Utilities manual chapter 1 'Bank Switching Configuration' for more details.  All these memory banks have to be 'von Neumann' wired!

•	Additional 6 bytes stack space (IDATA).

All other hardware components can be used by the application.


MON51.EXE Invocation

MON51 is invoked by entering its name: 'MON51'. The communication with the serial interface is performed with the hardware interrupt. Various parameters can be stated in the invocation line. These parameters change the working method of MON51.

The general syntax of the MON51 invocation is MON51 [parameter]

Where:

MON51	is the program name.

parameter	is one or more of the following:

COM1:	use serial interface COM1: (Default). Abbreviation: 1.

COM2:	use serial interface COM2:. Abbreviation: 2.

COM3:	use serial interface COM3:. Abbreviation: 3. This parameter can only be used together with NOINT.

COM4:	use serial interface COM4:. Abbreviation: 4. This parameter can only be used together with NOINT.

INT14	the serial interface is called through the BIOS software interrupt 	14H. No hardware interrupt is performed. The abbreviation of INT14 is I.

NOINT	the serial interface is polled. No hardware interrupt system is necessary. The abbreviation of NOINT is N.

BAUDRATE (bps)	allows the setting of the transfer baud rate. If this option is omitted, the baud rate 9600 bps is used. The value bps specifies the baud rate. Possible values are: 300, 600, 1200, 2400, 4800, 9600, 19200, 38400 and 57600. The abbreviation of BAUDRATE is BR.

All MON51 invocation parameters can also be specified in the DOS evironment variable MON51=, which can be defined with the DOS SET command.  If no parameters are stated in the invocation line, MON51 automatically operates with the parameters of the system variable. MON51 outputs the following message if the parameters of the system variable MON51= are used:

ENVIRONMENT STRING: MON51=<parameters>

Example

MON51

MON51 COM2: INT14

MON51 2

MON51 BAUDRATE (1200)

SET MON51=COM2: BAUDRATE (4800)

MON51

After invocation, MON51 signs-on with the message:

MS-DOS MON51 Vx.y
INSTALLED FOR PC/XT/AT (COM Line 1) USING HARDWARE INTERRUPT SERVICE
BAUDRATE: 9600 (DEFAULT)
*** MONITOR MODE ***   or  *** TERMINAL MODE ***

Vx.y is the actual version number of the MONITOR-51 software.

After MON51 has been invoked, a test is made to determine whether MONITOR-51 is active on the target board.  If this is the case, MON51 switches to the Monitor Mode.  Otherwise, assumption must be made that a program is already running on the board.  In this case, a switch is made to the Terminal Mode in order to input or output data via the serial interface.


Control Keys

Editing a Command Line

Controlling Console Output


Editing a Command Line

Command lines can be manipulated using the following control keys:

Keys	Function
Enter	Executes entire entry line.
Backspace	Deletes character in front of the cursor.
DEL, Ctrl+D	Deletes character below the cursor.
Ctrl+A	Deletes all characters  to the right of the cursor.
Ctrl+X	Deletes all characters to the left of the cursor.
Ctrl+Z	Deletes entire entry line.
Escape, Ctrl+C	Aborts entry and start new entry line.
Home	Positions cursor at the beginning of the entry line.
End	Positions cursor at the end of the entry line.
Insert	Toggles between insert/overwrite mode.
← Cursor left	Moves cursor one position to the left.
→ Cursor right	Moves cursor one position to the right.
Cursor up	Assumes a prior entry line in the line editor.
Cursor down	Assumes a later entry line in the line editor.


Controlling Console Output

The following control the output on the console:

Keys	Function
CTRL-S	Stops output to the console and suspends the execution of the current command.
CTRL-Q	Cancels the effect of CTRL-S. Output to the console resumes.
CTRL-C,  ESC	Terminates the execution of a command and returns to the command line interpreter. MONITOR-51 produces the following console message: *** TERMINATED *** #


MON51 Terminal Control Codes

All MON51 Terminal Control Codes:

Screen control codes	Function
00H	null
07H	bell
08H	backspace
09H	tab
0AH	line feed
0BH	cursor up
0CH	cursor right
0DH	carriage return
14H	cursor right
17H	erase to end of screen
18H	erase to end of line
1AH	clear screen and home
1CH	cursor down
1DH	cursor home
1EH	cursor up
1FH	cursor left
1BH  28H  (ESC '(')	highlight
1BH  29H  (ESC ')')	highlight off
1BH  30H  (ESC '0')	underline
1BH  31H  (ESC '1')	underline off
1BH  32H  (ESC '2')	cursor on
1BH  33H  (ESC '3')	cursor off
1BH  3DH  (ESC '=')	set cursor position (ADM-3A Modus)
1BH  41H  (ESC 'A')	cursor up
1BH  42H  (ESC 'B')	cursor down
1BH  43H  (ESC 'C')	cursor right
1BH  44H  (ESC 'D')	cursor left
1BH  45H  (ESC 'E')	clear screen and home
1BH  48H  (ESC 'H')	cursor home
1BH  4AH  (ESC 'J')	erase to end of screen
1BH  4BH  (ESC 'K')	erase to end of line
1BH  4CH  (ESC 'L')	insert line
1BH  4DH  (ESC 'M')	delete line
1BH  59H  (ESC 'Y')	set cursor position (VT-52 Modus)
1BH  62H  (ESC 'b')	erase to beginning of screen
1BH  6AH  (ESC 'j')	save cursor position
1BH  6BH  (ESC 'k')	restore cursor position
1BH  6CH  (ESC 'l')	delete line
1BH  6FH  (ESC 'o')	erase to beginning of line
1BH  70H  (ESC 'p')	reverse on
1BH  71H  (ESC 'q')	reverse off
1BH  76H  (ESC 'v')	scroll on
1BH  77H  (ESC 'w')	scroll off
1BH  7AH  (ESC 'z')	reset terminal


Serial Transmission Line

MON51 and Monitor-51 use an XON/XOFF protocol for the serial transmission. Therefore the only signals required from the V.24 (RS 232 respectively) serial interface are "TRANSMIT DATA", "RECEIVE DATA" and "SIGNAL GROUND". In most cases, prototype boards are designed to use a standard serial cable (1:1) to connect to the PC.  However, if this does not work, some connections in the serial connectors are necessary to enable the computer systems to transmit or receive respectively. A standard transmission line which functions with most computer systems has the following configuration:

Please note that the transmission signals RxD and TxD should be connected such that RxD is connected to TxD. The connections of RxD and TxD are not standardized. Some manufactures have TxD on PIN 2 or PIN 3 (RxD respectively on opposite pins).

PIN connections of various computer systems

•	IBM PC XT (DB-25 connector)
RxD	Pin 3	receive data
TxD	Pin 2	transmit data
Gnd	Pin 7	signal ground

•	IBM PC AT (DB-9 connector)
RxD	Pin 2	receive data
TxD	Pin 3	transmit data
Gnd	Pin 5	signal ground
Connect	Pin 7 to Pin 8
Connect	Pin 1 to Pin 4 and Pin 6


MON51 Commands

MON51 requires parameters in hexadecimal form (allowed characters 0 .. 9, A .. F). If more than one parameter is required by a command the parameters can be separated by a blank (' ') or a comma (',').

Example

#FILLX 2000, 4000, 0

or

#FILLX 2000 4000 0

In the command description and in the help menu of the MONITOR-51 the following terms are used:

Term	Meaning
Address	Address value with the range of the particular 8051 address space. For the various 8051 address spaces the following values are allowed: Bit Address: 0 .. FF Code-Address: 0 .. FFFF Data-Address: 0 .. FF Idata-Address: 0 .. FF Pdata-Address: 0 .. FF Xdata-Address: 0 .. FFFF
Range	Two address values which are interpreted as address range. The range includes the first and the last specified address. The two numbers are separated with blank (' ') or comma (','). Example:  1F,29  or  1F 29 specifies the range from 1FH up to and including 29H.
Value	The content of a memory location. The values allowed depend on the addressed 8051 memory. The content of a bit address can be 0 or 1. In all other 8051 address spaces 0 .. 0FFH is allowed.
count	Specifies the number of instructions executed by a Trace or Procedure-Step command. The count can be between 0 and FFFF.
bp	Number of a breakpoint. The bp can be between 0 and 9.
breakadd	Temporary breakpoint (address) in the code memory. The temporary breakpoint is only valid for the current active Go command.
See Also:

F1: Terminate MON51 and Return to DOS

F2: Transmit the Contents of a File

F3: Log Output to File

Help Commands

Memory Commands

Breakpoint Commands

Testing Commands

Loading and Saving


F1: Terminate MON51 and Return to DOS

After the entry of the F1 key or ALT+1, MON51 responds with the question

EXIT MON51 (y or [n])

MON51 is terminated if the 'y' or 'Y' is pressed, otherwise the EXIT command will be ignored.


F2: Transmit the Contents of a File

After the entry of the F2 key or ALT+2, MON51 responds with the question:

Input File:

The user can enter a file name. The content of this file is interpreted as MON51 commands.

Example

Input File:  MYINIT.CMD

The content of the file MYINIT.CMD is interpreted as MON51 Commands.

Ctrl+C will abort the command file.


F3: Log Output to File

After the entry of the F3 key or ALT-3, MON51 responds with the question:

Output File:

The user can enter a file name. Each character which is displayed on the screen will be copied into this file.

Example

Output File: DEBUG.PRN

The Screen Output is copied additionally into the file DEBUG.PRN.

If the log function should be stopped the user enters the F3 key or ALT+3. The program MON51 displays the question:

Quit output to file (y or [n])?

The answer 'y' or 'Y' terminates the function. Otherwise the logging continues.

If a file with the specified name already exists, the question

Overwrite existing file (y or [n])?

is displayed. The answer 'y' or 'Y' deletes this file and creates a new file with this name. Otherwise the function F3 is aborted.


Help Commands

Help:  Display Command Menu

Comments (';')

Exit:  Exit MON51 and Return to DOS


Help:  Display Command Menu

Syntax	Meaning
HELP	display command menu
The Help command displays a brief description of all MONITOR-51 commands.

Example

#HELP
memory  display    modify       fill               utility
bit:   >DB range  >EB address  >FILLB range value >A address - assemble
code:  >DC range  >EC address  >FILLC range value >U range - disassemble
data:  >DD range  >ED address  >FILLD range value >X [register]-disp/change
idata: >DI range  >EI address  >FILLI range value
xdata: >DX range  >EX address  >FILLX range value
pdata: >DP range  >EP address  >FILLP range value

 program execution              breakpoint(s)      program load/save
>G [address] [,breakadd] - go  >BD bp - disable   >LOAD file - load hex/obj
>T [count] - trace step        >BE bp - enable    >SAVE file range-save hex
>P [count] - procedure step    >BK bp - kill      >LS   file - load symbols
                               >BL - list
>HELP - display menu           >BS address - set
#


Comments (';')

Syntax	Meaning
; comment	insert line of comment
Comments can be inserted by beginning the line with a semi-colon. The semi-colon instructs MONITOR-51 to ignore any text after the semi-colon. This is useful when a session is switched to a protocol file.

Example

#; this is a comment


Exit:  Exit MON51 and Return to DOS

Syntax	Meaning
EXIT	Exit MON51 and return to DOS
EXIT closes all open files and returns to DOS.

Example

#EXIT


Memory Commands

MON51 manages four memory areas according to the 8051 architecture:

•	CODE memory contains 64K Bytes of memory. The following commands are used to access code memory:
DC	Change contents of code memory.
EC	Change memory contents interactively
U	Disassemble code memory
A	Assemble, change code memory
FILLC	Write into code memory

NOTE
MONITOR-51 performs a write to Code memory with a write to XData memory. Code memory can only be written to if it is mapped physically with the XData memory. MONITOR-51 checks after each write into the XData RAM if the same result is in Code memory. If the contents differ a error message is displayed.

•	DATA memory is the internal data memory containing 256 bytes.  The memory spaces 20H-2FH and 80H-0FFH are bit addressable. The 8051 special function register resides above address 80H. The data addresses can be manipulated using the following commands:
DD	Display contents of data memory
ED	Change data memory interactively
FILLD	Write into data memory

•	IDATA memory is the indirectly addressable (256 Bytes) internal 8052 data memory.  The lower memory (00H- 7FH) is identical to the directly addressable DATA memory.  The higher address space (80H-0FFH) is indirectly addressable.  The Special Function Register space cannot be addressed using the IDATA commands.  Indirectly addressable memory can be accessed using the following commands:
DI	Display contents of IDATA memory
EI	Change IDATA memory interactively
FILLI	Write into IDATA memory

•	XDATA memory is the optional external 8051 memory. The following commands access the XDATA memory space:
DX	Display contents of XDATA memory
EX	Change XDATA memory interactively
FILLX	Write into XDATA memory
Additionally, three other memory spaces that are physically tied up with the DATA and XDATA memory are supported:

•	REGISTER memory defines the internal 8051 RAM of which some is bit addressable (A, R0, ..., R7). Four register banks (R0-R7) are available. The current bank in use is indicated in the program status word (PSW). The processor registers can be displayed or altered using the following commands:

•	X	display all register contents

•	X<Register Name>	change register contents interactively

The following can be used in the  <Register Name> parameter field when using MONITOR-51:

Register Name	Meaning
RA	Accumulator (DATA address 0E0H)
RB	B register (DATA address 0F0H)
R0—R7	Standard register bank (work register)
PSW	Program status word (DATA address 0D0H)
DPTR	Data Pointer (DATA address 82H and 83H)
SP	Stack Pointer (DATA address 81H)
PC	Program Counter
All registers defined in the "Special Function Register" set of the 8051 derivative can be used (see LoadSymbols Command).

•	Bit Addressable Memory: The 8051 internal RAM memory space 20H-2FH and 80H-0FFH are bit addressable. The bits can be accessed using the following commands:

DB	Display all bits
EB	Change bit(s) interactively
FILLB  	Write into bit memory

•	PDATA Memory is a page of the external data memory which comprises 256 bytes.  The page is set with the Special Function Register P2.  This area can be accessed with the command MOVX  @Ri.

DP	Display PDATA areas
EP	Change PDATA cells interactively
FILLP  	Write PDATA memory with constants

See Also:

DISPLAY: Display Memory

ENTER: Change Memory Interactively

FILL: Fill Memory

Unassemble: Display Assembler Mnemonics

Assemble: Load 8051 Instructions into Code Memory

eXamine: Display and Change Processor Registers


DISPLAY: Display Memory

Syntax	Meaning
DC [tartaddr[,endaddr]]	Display code memory
DD [startaddr[,endaddr]]	Display data memory
DI [startaddr[,endaddr]]	Display indirect data memory
DX [startaddr[,endaddr]]	Display external data memory
DP [startaddr[,endaddr]]	Display 'paged' external memory
DB [startaddr[,endaddr]]	Display bits
The second letter in the Display command contains the memory type to be displayed. If no address is entered, the last address used by the display command is used. If only one address is entered, the rest of the memory (i.e., 128 Bytes of code and external data memory) is displayed.

Example

#DB                         ; Bit memory

#DC 0, 26                   ; Code memory

#DD 30                      ; Data memory

#DI 70, 90                  ; IData memory

#DX 200,0BFF                ; XData memory

#DP 40, 80                  ; PData memory


ENTER: Change Memory Interactively

Syntax	Meaning
EC [address]	change contents of code memory
ED [address]	change contents of data memory
EI [address]	change contents of indirect data memory
EX [address]	change contents of external data memory
EP [address]	change contents of 'paged' external data memory
EB [address]	change bit contents
The second character of the E command contains the memory type to be changed.  The address parameter can be omitted. If it is omitted the last address used when the enter command was aborted is used. The address and the current value are displayed after the command is entered. The following options are available:

•	RETURN
The current contents remain unchanged. The pointer jumps to the next address ('VIEW').

•	PERIOD
The Enter command is completed and control returns to the command level.

•	EXPRESSION
Entering the expression and Return causes MON-51 to evaluate the expression.


FILL: Fill Memory

Syntax	Meaning
FILLC startaddr, endaddr, value	write into code memory
FILLD startaddr, endaddr, value	write into data memory
FILLI startaddr, endaddr, value	write into indirect memory
FILLX startaddr, endaddr, value	write into external memory
FILLP startaddr, endaddr, value	write into 'paged' external memory
FILLB startaddr, endaddr, value	write into bit memory
The FILL command changes memory. The second character of the FILL command contains the memory type to be filled. The addresses and values can be any number which is allowed for this memory type. XDATA memory being used by MON-51 cannot be FILLed.

Example

#FILLC 0, 3FFF, 23

#FILLD 0, 7F, 0

#FILLB 0, 77, 1

#FILLI 80, FF, 0

#FILLX 400, FFF, 7F

#FILLP 40, 80, 7F


Unassemble: Display Assembler Mnemonics

Syntax	Meaning
U [startaddr[,endaddr]]	Disassemble Memory
The Unassemble command displays the memory contents as 8051 assembler mnemonics. The first and last address is optional, and if not specified  the last address used by previous Unassemble commands is used.

Example

#U

#U 100

#U 1000, 1100


Assemble: Load 8051 Instructions into Code Memory

Syntax	Meaning
A [address]	Load 8051 instructions into memory
The Assemble command allows in-line assembly language to be inserted into the current code memory image. This enables the patching of code or the testing of assembler instructions without having to write and/or assemble a program. Parameters can be absolute or Special Function Registers.

The address can be omitted. If it is, the last address used by the Assemble command will be assumed. After the Assemble instruction is entered the instruction at the current code address is displayed. The following options can be used:

•	RETURN
The current memory contents are not changed. The counter  goes to the next instruction.

•	PERIOD
The A command is terminated. Control returns to the command level.

•	INSTRUCTION
The previous 8051 instruction is replaced by the present instruction. An error message is issued if the instruction is invalid.

Example

#A 8000

8000  SJMP 8010                MOV DPTR,#4000
8003  NOP                      MOV R0,PCON
8005  NOP                      MOV A,R1
8006  CLR A                             ; take over instruction
8007  CLR A                    MOVX A,@DPTR
8008  ANL P0(80),#12           MOV @R1,A
8009  RET                      INC DPTR
800A  INC R1                   MUL AB
800B  NOP                      .        ; Terminate
#


eXamine: Display and Change Processor Registers

Syntax	Meaning
X	display register contents
X register name	change register contents
The X command without any parameter displays the current register contents in the following  format:

RA RB R0 R1 R2 R3 R4 R5 R6 R7       PSW     DPTR  SP   PC
xx xx xx xx xx xx xx xx xx xx     ---Rn---  xxxx  xx  xxxx

The register names used in the display are the same that can be used as symbols:

RA	accumulator

RB	multiplication register

R0 - R7	register R0 - R7 of the current register bank

PSW	program status word

DPTR	data pointer (consists of DPH and DPL)

SP	stack pointer

PC	program counter

xx, xxxx	the current contents in hexadecimal format

The format of the Processor Status Word is similar to that of the 8051 PSW. Flags that are set are displayed by the first letter corresponding to their names (Carry, Overflow, F0, Auxcarry, Parity). Flags that are not set are displayed by a hyphen. The current register bank is indicated by 'Rn' (n = 0 - 3).

The 8051 Program Status Word

CARRY	AUX- CARRY	F0	RS0            RS1 REGISTER-BANK	OVER- FLOW	Unused	PARITY
The X commands can be used to alter the contents of registers. RA, RB, R0-R7, PSW, BS, DPTR, DPL, DPH, SP and PC can be used as register names in conjunction with the X command. Additionally, the "Special Function Register" set (see LoadSymbols Command) can be used. The current register content is displayed. A new value can be assigned to the register. If only a return  is entered, contents remain unchanged.

Example

#XDPTR
DPTR = 1234H  FFFF

#XSP
D:81: 07H  90


Breakpoint Commands

When debugging programs it is sometimes necessary to stop the program, in order to check the system and correct errors. MONITOR-51 has the following breakpoint commands:

Command	Name	Description
BD	Breakpoint Disable	temporarily deactivate breakpoint(s).
BE	Breakpoint Enable	activate breakpoint(s).
BK	Breakpoint Kill	kill breakpoint(s).
BL	Breakpoint List	list breakpoints.
BS	Breakpoint Set	define a breakpoint.
To perform a breakpoint MONITOR-51 inserts an  ACALL instruction into the user program.  The advantage of this method is that no additional hardware is required for the breakpoint logic; however, breakpoints can only be set in RAM.  A second disadvantage is that an ACALL instruction occupies two bytes.  Therefore, it can be dangerous to set a breakpoint on a one-byte instruction, if a label (jump target) is after this instruction.  The following example demonstrates this problem.

Test Program

8000  E4        CLR     A
8001  04        INC     A
.     .         .
.     .         .
.     .         .
8010  80 ED     SJMP    8001

First, the user program is executed until address 8010 with the following command.

#G 8000, 8010.

Afterwards, a breakpoint is set at address 8000. The breakpoint is realized by inserting an ACALL instruction into the user program; this means that the user program is modified by the breakpoint.

Modified Test Program

8000  11        CLR     A      ; An ACALL instruction is
8002  XX        INC     A      ; written at address 8000.
.     .         .
.     .         .              ; Address 8001 is
.     .         .              ; occupied by the target of
8010  80 ED     SJMP    8001   ; the ACALL instruction.

If the interrupted program is continued at address 8010, the execution is not stopped at 8000. The reason is, that the user program jumps to address 8001 after the execution of the SJMP instruction. But at this address the second byte of the ACALL instruction resides in memory—not the INC instruction. Therefore the program execution at this point is unpredictable.

The user has to check that the ACALL instruction of a breakpoint overwrites no important OP codes. If needed, the user program should be executed by the Trace command. The Trace mode executes all instructions without conflicts.

See Also:

BreakSet: Define breakpoint

BreakKill: Kill Breakpoint

BreakList: Display Breakpoints

BreakDisable: Disable Breakpoint

BreakEnable: Enable Breakpoint


BreakSet: Define breakpoint

Syntax	Meaning
BS break address	define breakpoint
The Breakpoint Set command sets a breakpoint. The program execution (GO command) is stopped when the instruction at the breakpoint is reached. An error occurs if:

•	An attempt is made to define more than 10 breakpoints

•	The break address is already defined, or an overlap with an already defined breakpoint occurs

•	The break address is illegal

NOTE
Break addresses must be op code addresses! (The address of the first op code byte of an instruction.)

Example

#BS 8100
#BS 9234


BreakKill: Kill Breakpoint

Syntax	Meaning
BK ALL	Delete all breakpoints
BK bp [,…]	Delete specified breakpoints
Breakpoints can be deleted by using the Breakpoint Kill command. The 'ALL' option deletes all defined breakpoints. If single breakpoints are to be deleted the breakpoint number must be entered. Several breakpoints can be specified by separating them with commas. The breakpoint number can be obtained by using the breakpoint List command.

Example

#BK ALL
#BK 2
#BK 0,2,6,9


BreakList: Display Breakpoints

Syntax	Meaning
BL	List all breakpoints
The Breakpoint List command lists all the current breakpoints. The list consists of the following components:

•	Breakpoint number
Each breakpoint is assigned a number between 0 and 9. This number is used, for example, when enabling or disabling the breakpoints.

•	Breakpoint status
A breakpoint is either ENAbled or DISabled. A disabled breakpoint is not active during program execution.

•	Breakpoint address


BreakDisable: Disable Breakpoint

Syntax	Meaning
BD ALL	Disable all breakpoints
BD bp [,…]	Disable breakpoints individually
The Breakpoint Disable command disables breakpoints that are not presently required. The definitions are not altered. The 'ALL' option disables all defined breakpoints. A single breakpoint can be disabled by indicating the breakpoint number. Several breakpoints can be disabled by separating the numbers with commas. The breakpoint numbers can be displayed using the breakpoint List command.

Example

#BD ALL
#BD 2
#BD 0,2,6,9


BreakEnable: Enable Breakpoint

Syntax	Meaning
BE ALL	enable all breakpoints
BE bp [,…]	enable named breakpoints
The Breakpoint Enable command enables disabled breakpoints. The 'ALL' option enables all the breakpoints. Single breakpoints can be enabled by specifying their breakpoint numbers. Several breakpoints can be specified by separating each breakpoint number with a comma. The Breakpoint List command displays the defined breakpoint numbers.

Example

#BE ALL
#BE 2
#BE 0,2,6,9


Testing Commands

The following are testing commands:

•	Go
Execute an 8051 program in 'real time'.

•	Trace
Single step through an 8051 program.

•	Procedure
Single step through an 8051 program, with the possibility of executing a subroutine as one step.

See Also:

Go: Start Program Execution in 'Real time mode'

Trace: Start Program Execution in 'Single Step Mode'

Procedure: 'Procedure Single Step Mode' Execution


Go: Start Program Execution in 'Real time mode'

Syntax	Meaning
G [startaddr[,breakaddr]]	start program execution
The Go command starts program execution from the current program counter (PC) or from the optional start address. The breakpoint is also optional. If the break address is not specified, program execution will stop at a breakpoint defined with the BS command. If no breakpoints are defined program execution has to be stopped by a hardware reset. The breakaddr option defines a temporary breakpoint and not a permanent breakpoint.

If a defined breakpoint conflicts through the inserting of the ACALL instruction with the OP code at the start address, this breakpoint is ignored. In this case MON51 displays the message "BREAKPOINT NEAR CURRENT PC IGNORED".

If a breakpoint terminates the program execution MON51 displays the message:

PROCESSING TERMINATED AT xxxx
#

Example

#G
#G8100
#G,8200
#G8000,8010


Trace: Start Program Execution in 'Single Step Mode'

Syntax	Meaning
T [count]	start single step execution
The Trace Instruction(s) command starts program execution in single step mode. The count of steps can be between 1 and FFFF. 1 step is assumed if no count is specified. Breakpoints do not affect program execution while in single step mode. The T command can be stopped by entering CTRL-C.

Example

#T                  ; execute a single step.
#T5                 ; execute five steps.

The following is an example of the display following a step. It is important to note that an instruction is first executed and then the display is issued. The 'PC' and the disassembled instructions displayed are the next instructions to be executed!

#T
RA RB R0 R1 R2 R3 R4 R5 R6 R7       PSW     DPTR  SP   PC
0D 00 44 12 00 33 12 12 FF CC     C--R0--P  5000  07  0344
8344  SETB     2F

#


Procedure: 'Procedure Single Step Mode' Execution

Syntax	Meaning
P [count]	start 'procedure single step execution'
The Procedure Trace command starts program execution like the Trace Instructions command in single step mode. The difference is, that a subroutine (CALL instructions) executes as one single step. The count of steps can be between 1 and FFFF. 1 step is assumed if no count is specified. Breakpoints do not affect program execution while in procedure single step mode. The P command can be stopped by entering CTRL-C.

NOTE
The Procedure Trace command has the restrictions described in chapter 'Breakpoint Commands'.

Example

#P                  ; execute one step.
#P8                 ; execute eight steps.


Loading and Saving

To communicate with other development tools, MON51 implements functions for loading and saving files:

•	LOAD
Load an Intel HEX or object formatted program.

•	SAVE
Save a program in the Intel HEX format.

•	Load Symbols
Load a symbol file.

See Also:

LOAD: Load a program

SAVE: Save Program in Intel HEX Format

Load Symbols:  Load SFR Definitions

Data Registers of the 8051 CPU

Bit Registers of the 8051 CPU


LOAD: Load a program

Syntax	Meaning
LOAD filename	load a HEX or OMF-51 file
Load a program in HEX or OMF-51 object format.  The format is automatically recognized.  The program is transferred in blocks (in binary format) with check sum for the 8051 board.  In this way, a down-load of HEX or object files is very simple:

Example

#LOAD TESTPROG            ; load an object program

#LOAD MYPROG.HEX          ; load an HEX program


SAVE: Save Program in Intel HEX Format

Syntax	Meaning
SAVE filename, startaddr, endaddr	The specified address range is stored under the file name in HEX format.
The Save command is the opposite of the LOAD command.  The address range specified in the save command is stored as a HEX file under the specified file name.  The data is transferred from the 8051 board to the PC/XT/AT checksum via the serial interface.

Example

#SAVE MYPROG.HEX 8000, 83FF


Load Symbols:  Load SFR Definitions

Syntax	Meaning
LS filename	Load symbol file
If an 8051 derivative is used, the additional symbols of the Special Function Register can be reloaded.  If the delivered INCLUDE files do not suffice, these can be extended correspondingly with a text editor.

Example

#LS REG517.INC              ; load symbol file

Structure of a Symbol File:

A symbol file can only contain symbols of the type DATA or BIT, the values of which are specified in HEX.

P0	DATA	80H
SP	DATA	81H
DPL	DATA	82H
DPH	DATA	83H
WDTL	DATA	84H
WDTH	DATA	85H

; TCON
TF1	BIT	8FH
TR1	BIT	8EH
TF0	BIT	8DH
TR0	BIT	8CH
IE1	BIT	8BH
IT1	BIT	8AH
IE0	BIT	89H
IT0	BIT	88H

See Also:

Data Registers of the 8051 CPU

Bit Registers of the 8051 CPU


Data Registers of the 8051 CPU

SFR Name	Data Address
P0	080H
SP	081H
DPL	082H
DPH	083H
PCON	087H
TCON	088H
TMOD	089H
TL0	08AH
TL1	08BH
TH0	08CH
TH1	08DH
P1	090H
SCON	098H
SBUF	099H
P2	0A0H
IE	0A8H
P3	0B0H
IP	0B8H
PSW	0D0H
RA	0E0H
RB	0F0H


Bit Registers of the 8051 CPU

SFR Name	Bit Address
IT0	088H.0
IE0	088H.1
IT1	088H.2
IE1	088H.3
TR0	088H.4
TF0	088H.5
TR1	088H.6
TF1	088H.7
RI	098H.0
TI	098H.1
RB8	098H.2
TB8	098H.3
REN	098H.4
SM2	098H.5
SM1	098H.6
SM0	098H.7
EX0	0A8H.0
ET0	0A8H.1
EX1	0A8H.2
ET1	0A8H.3
ES	0A8H.4
EA	0A8H.7
RXD	0B0H.0
TXD	0B0H.1
INT0	0B0H.2
INT1	0B0H.3
T0	0B0H.4
T1	0B0H.5
WR	0B0H.6
RD	0B0H.7
PX0	0B8H.0
PT0	0B8H.1
PX1	0B8H.2
PT1	0B8H.3
PS	0B8H.4
P	0D0H.0
OV	0D0H.2
RS0	0D0H.3
RS1	0D0H.4
F0	0D0H.5
AC	0D0H.6
CY	0D0H.7


ERROR Messages

MON51 issues a numbered error message when an error is encountered.  MON51 error messages have the following format

*** ERROR 1: FILE NOT FOUND

Where

1	is the error number

FILE NOT FOUND	is the error message.

The following table lists the MON51 error numbers and messages along with a description of the error.

Error Number	Error Message and Description
1	FILE NOT FOUND
	The specified file or path does not exist.
3	CAN'T CREATE FILE
	The specified file cannot be saved.  A file with the same name possibly already exists without access rights for writing.
4	ERROR WHILE WRITING FILE
	An error occurred during the writing of a file; i.e. no more room on the memory storage medium.
5	CAN'T OPEN READ-ONLY-FILE FOR WRITE ACCESS
	An attempt was made to write to or to erase a write-protected file.
6	ACCESS TO FILE DENIED
	The name mentioned is not the name of a file but that of a directory.
10	MISSING PARAMETER
	A required parameter is missing.
11	BAD DIGIT
	The number entered contains illegal characters for a number.
12	TOO MANY PARAMETERS
	Too many parameters were passed to a MON51 command.
13	BAD COMMAND
	The command entered is unknown.
14	BAD SERIAL TRANSMISSION
	An  incorrect check sum was encountered during the serial data transmission.  The transmitted data could be erroneous.  Please check the serial cable to the 8051 board.
15	BAD HEX RECORD! ABORT LOADING
	The loaded hex file contains illegal data or check sum.
16	INVALID OR CORRUPTED OBJECT FILE
	The loaded object file contains illegal data or check sum.
18	IN LINE xx: INVALID MEMORY TYPE
	The symbol file specified in the LS command contains a memory type other than DATA or BIT in the line specified.
19	IN LINE xx: HEX VALUE EXPECTED
	The symbol file in the LS command contains an invalid HEX number in the line specified.
20	WRONG REGISTER
	The register is in appropriate for the instruction.
21	NO BREAKPOINT AVAILABLE
	An attempt was made to define more then 10 breakpoints.
22	NO CODE MEMORY AT ADDRESS: xxxx
	Data cannot be stored into the code memory at the specified address.
23	CONFLICTING BREAKADDRESS
	The specified breakpoint collides with its ACALL instruction with an existing break address.
24	BREAKPOINT DOESN'T EXIST
	The specified breakpoint does not exist.
25	BREAKPOINT NUMBER OUT OF RANGE
	The specified breakpoint number is greater than 9.
40	ILLEGAL SYNTAX
	One parameter in the invocation line is unknown.
41	ILLEGAL OR UNINSTALLED COM LINE
	The specified serial interface line is not installed in your computer system.  If you use COM3 or COM4, you must also use the NOINT or INT14 setting.
42	TARGET FOR JUMP OUT OF RANGE
	The specified destination of a conditional jump command does not lie in the memory area from -127 to + 128 of the current address.
43	OPERAND SPECIFIES WRONG REGISTER
	The specified register operand does not match the command.
44	IMPROPER OPERAND
	The specified operand does not correspond to the requirements of the assembler instruction.
46	NUMBER OF OPERANDS DOES NOT MATCH INSTRUCTION
	The number of operands of the assembler instruction does not correspond to the required number of operands.
49	ILLEGAL EXPRESSION TYPE
	The expression used is invalid.  For example, a floating-point type was used as the index for an array.


MON51.DLL: dScope Monitor Driver - Overview
Overview

dScope can interface to target systems by the use of the MON51.DLL driver.  Therefore, the MON51.DLL has to be loaded like any other simulation driver (see dScope manual chapter 1 'Loading a CPU Driver DLL').  The serial interface parameters such as COM port and baudrate are selected in the configuration dialog.  When starting the MON51.DLL it tries to communicate with the target system using the previous settings.  If it fails, a dialog is automatically opened where you can select new COM port parameters.


Configuration Dialog

The MON51.DLL Configuration dialog box is accessed by selecting Config, from the  Peripherals menu.  The Configuration dialog box controls the MONITOR-51 options.

•	Port: selects the serial PC interface (COM1 - COM4) which is used for communication with the target system.  A new setting becomes active only when you press the Apply button.

•	Baudrate: allows to select the baudrate.  Possible values are: 300, 600, 1200, 2400, 4800, 9600, 10473, 11520 , 12800, 14400, 16457, 19200, 23040, 28800, 38400 and 57600.  These, sometimes not standard baudrates allow to use a different crystal frequency on a target board without having to reinstall MONITOR-51.  Example:  A target board running at 12 MHz and 9600 bps can be modified to a 16MHz and 12800 bps by just exchanging the crystal.
A new setting becomes active only when you press the Apply button.

•	Cache Enable: to speed up the screen output, a data cache is implemented.  This cache memory is only updated when a Single-step or Go command is executed.  If you want to view the actual value of port pins, timers or memory mapped external peripherals you can switch off the cache for every memory area separately.  For performance reasons you should enable all caches.

•	Use serial interrupt: selecting this option allows Monitor-51 to terminate an executing application with Ctrl+C or ESC.  To accomplish this, Monitor-51 intercepts the serial interrupt.  That means that this interrupt and the complete serial interface is no longer available for other use.  You must take care to avoid placing code in this area, and should plan your program operation and flow accordingly (see chapter 'Preparing Programs for MONITOR-51' below).  In addition, the Global Interrupt Enable Flag EA at bit address 0AFH (175 dec.) must not be reset.


Restrictions of dScope with MON51.DLL

Map Command
The memory mapping of a target board with MONITOR-51 is selected with hardware components.  It is not possible to display or change this memory mapping with the dScope MAP command.  The MAP command is therefore not supported.

Performance analyzer / Call stack analyzer / Code coverage
These features are not available with MONITOR-51.

Breakpoint Options
MONITOR-51 itself is able to handle up to 10 simple code breakpoints.  If you define more than 10 code breakpoints or if you define access or conditional breakpoints, the application is executed in single steps.  Single step execution is at least 10000 times slower.

Trace Recording
Selecting the 'Trace Recording' option (dScope module window -> commands) when using MON51.DLL, causes the target to go into single step mode.  Instruction execution speed will be about 1/4000 of normal.  When operating in this mode, Monitor-51 requires an additional 5Kb of XDATA RAM which is expected to be addressed just "below" the RAM already required for MON51 operation.  See the 'Monitor-51 Configuration' section below.


Install Invocation

The MONITOR-51 software can be adapted to different hardware configurations using the INSTALL program.  Parameters for INSTALL are listed below.

INSTALL  serialtype  [xdatastart  [codestart  [BANK][PROMCHECK]]]

A number between 0 and 12 can be entered for serialtype.  The function is explained in the following table.

Serial Type	Serial Interface	Clock Source	Baud Rate	CPU Clock	Processors
0	0	Timer 1	9600 bps	11,059 MHz	all
1	0	Int. Baudrate generator	9600 bps	12,000 MHz	80515(A), 80517(A)
2	0	Timer 2	9600 bps	12,000 MHz	8052 and compatibles
3	1	Int. Baudrate generator	9600 bps	12,000 MHz	80517(A)
4	0	Timer 2	9600 bps	12,000 MHz	Dallas 80C320 /520/530
5	1	Timer 2	9600 bps	12,000 MHz	Dallas 80C320 /520/530
6	ext. UART 16450/16550	Ext. Crystal 3,686400 MHz	9600 bps	don't care	All
7	0	Timer 1	Self adjusting	don't care	All
8	0	Timer 2	Self adjusting	don't care	8052 and compatibles
9	0	Int. Baudrate generator	Self adjusting	don't care	80515A, C505C C515C,80517(A)
10	1	Int. Baudrate generator	Self adjusting	don't care	80517(A)
11	0	Timer2	Self adjusting	don't care	Dallas 80C320 /520/530
12	1	Timer 2	Self adjusting	don't care	Dallas 80C320 /520/530
XDATASTART is used to specify the page number of the XDATA memory area which the Monitor-51 uses for internal management (length = 256 bytes).  The entry is made in HEX and can be a number between 0 and 0FFH inclusive.  The default value is 0FFH.  If trace recording is used with dScope-51 (Module Window / Commands / Record trace) another 5 KB XDATA RAM area is used below 'xdatastart'.  Example: When 'xdatastart' is set to 0FFH, the memory area 0EB00H to 0FEFF is used for trace data and the range from 0FF00H to 0FFFFH for internal Monitor-51 management.

CODESTART is used to specify the page number of the CODE memory area in which the Monitor-51 is to be contained after the installation (4 - 5 KB).  The entry is made in HEX and can be a number between 0 and 0F0H inclusive.  The default value is 0.

Note: Installing Monitor-51 at a high address has the advantage that the application can be loaded at address 0.  Therefore, the target board needs to have a boot logic which mirrors Monitor-51 down to address 0 during and short after RESET.

If BANK is specified, a Monitor-51 version for a code banked target system is generated.  Therefore, the settings in the file MON_BANK.A51 must match the hardware configuration.  See Configuration Files Settings for further information about hardware configurations with code banking.

If PROMCHECK is specified, Monitor-51 immediately checks at the start if a PROM or a RAM is contained at code address 0.  If a PROM was found, the program is automatically started at address 0 on.  Otherwise, Monitor-51 assumes control over the board.  PROMCHECK only makes sense in target systems where Monitor-51 remains on the board after the application has been programmed into an EPROM.  Therefore, this option can never be used with codestart = 0!

Example

INSTALL  0  7F  80

In this example, Monitor-51 uses Timer 1 as the baudrate generator.  Monitor-51 occupies the CODE area from 8000H to 9100H and the XDATA area from 7F00H to 7FFFH.  The optional trace memory area occupies the XDATA area from 6B00H to 7EFFH.  No test whether a PROM lies at address 0 is made during the start of the program.

The resulting Intel HEX file (MON51.HEX) can then be transferred into an EPROM programmer.  If Monitor-51 is installed at the code address 0, the interrupt vectors are offset to  8000H.  If the setting options stated above do not suffice, the assembler file INSTALL.A51 must be changed accordingly.


Configuration Files Settings

Depending on the target hardware and the memory areas used by Monitor-51, some settings in the files INSTALL.A51 and MON_BANK.A51 need to be modified.

See Also:

Settings in INSTALL.A51

Bank Switching Configuration


Settings in INSTALL.A51

Interrupt offset:

When the Monitor-51 code is installed at ROM address 0, an application would never be able to reach an interrupt vector.  Therefore, Monitor-51 diverts all interrupt vectors to a higher (RAM) address, where the application's interrupt vectors can be loaded.  Interrupt offset has no meaning when the Monitor-51 code is not located at address 0.
Example: The code of Monitor-51 is installed at address 0.  The 'v.Neumann' wired RAM starts at 8000H.  The interrupt offset has to be set to 8000H and the application has to be linked to 8000H and above.

INT_ADR_OFF EQU 8000H   ; INTERRUPT VECTOR OFFSET IF MONITOR
                        ; IS INSTALLED AT ADDRESS 0000H

Changing the baudrate of a serial interface:

Depending on the oscillator frequency of the target system and the baudrate which should be used, it might be necessary to change the reload value of the baudrate timer. Search for the label 'InitSerial:' in the code section which initializes the serial interface to be used.
Example: Timer 2 of a 8052 should be used as baudrate generator (install option: serial = 2) .  The 8052 is clocked with 12 MHz and the baudrate should be 4800 bps.  Therefore, the RCAP2L register has to be initialized to the value 0B2H instead of 0D9H.  Please refer to the manual of the corresponding 8051 derivative to see how the baudrate is calculated.

$IF (SERIAL = 2)
;********************************************************************
;*  Using TIMER 2 to Generate Baud Rates (only for 8052)            *
;*  Oscillator frequency = 12.000 MHz                               *
;*  Set Baudrate to 9600 Baud                                       *
;********************************************************************
RCAP2L  DATA    0CAH
RCAP2H  DATA    0CBH
T2CON   DATA    0C8H
 InitSerial:     PROMCHECK               ; Check if PROM in System
                MOV     T2CON,#34H
                MOV     RCAP2H,#0FFH
                MOV     RCAP2L,#0D9H
                MOV     SCON,#01011010B ; Init Serial Interface
                JMP     Mon51
$ENDIF

Other Functions and Definitions in INSTALL.A51

Since most serial interface configurations are predefined, it is extremely seldom that there is a need to modify the communication functions listed below.  Please note, that it is not allowed to modify any other register value (e.g. DPTR) without saving and restoring it.

INITSERIAL:	This function initializes the serial interface and maybe other peripherals.  At the end of this function a jump to MON51 instead of a RET is necessary.

SER_INT_ADR:	This definition specifies the interrupt vector address of the serial interface.  The default value is 023H for a standard 8051, but it can be set to any other interrupt vector address (e.g. external interrupt).  If the serial interface is not able to generate an interrupt, set this value to any unused interrupt vector address.

INSTAT:	This function returns the receive status of the serial interface in the C-flag.  C = 1 means character received;  C = 0 means no character received.

OUTSTAT:	This function returns the transmit status of the serial interface in the C-flag.  C = 1 means character transmitted;  C = 0 means character not yet transmitted.

INCHAR:	This function returns the received character in the accumulator.

OUTCHAR:	This function transmits the character in the accumulator to the serial interface.

CLR_TI:	This function clears the transmit interrupt flag of the serial interface

SET_TI:	This function sets the transmit interrupt flag of the serial interface.

CLR_RI:	This function clears the receive interrupt flag of the serial interface.

CLR_SER_IE:	This function clears the interrupt enable flag of the serial interface.

SET_SER_IE:	This function sets the interrupt enable flag of the serial interface.

BEFORE_GO:	This function is called before a application is started with GO or P-step.  It is empty by default (only RET).  This function can be used to generate a signal at a port pin or to change the memory configuration.

AFTER_GO:	This function is called when a application has been stopped with a breakpoint.  It is empty by default (only RET).  It should do the opposite of BEFORE_GO.

WR_CODE:	Since it is not possible to write to the code memory of a 8051, the external RAM needs to be 'von Neumann' wired.  Therefore, write access to the code memory is usually done with a MOVX @DPTR,A instruction.  However, if the target system allows a different way to do this (e.g. different address area) it can be adapted here.


Bank Switching Configuration

When you install Monitor-51 for code banking, you must specify the number of code banks your hardware provides as well as how the code banks are switched.  This is done by changing constants that are defined in the assembly module MON_BANK.A51.

MON_BANK.A51 Constants

The banking method, the number of banks, and the number of address lines used are configured using this source file.  MON_BANK.A51 contains EQU statements at the beginning which are used for configuration.  Following is a listing of these as well as a description of each.

;************************ Configuration Section *******************************
?B_NBANKS       EQU     8        ; Define max. Number of Code Banks (not      *
;                                ; including XDATA or COMMON bank).           *
;                                ; The max. value for ?B_BANKS is 32          *
;                                ; possible values are: 1,2,3,...32           *
;                                                                             *
?B_MODE         EQU     0        ; 0 for Bank-Switching via 8051 Port         *
;                                ; 1 for Bank-Switching via XDATA Port        *
;                                                                             *
?B_BANKSTART    EQU     08000H   ; defines the start address of the code      *
;                                ; banking area                               *
;                                                                             *
?B_BANKEND      EQU     0FFFFH   ; defines the end address of the code        *
;                                ; banking area                               *
;                                                                             *
?B_COMMON       EQU     0FFH     ; 0FFH if the COMMON area is not mapped into *
;                                ; a code bank.                               *
;                                ; otherwise ?B_COMMON must be set to the     *
;                                ; bank number which contains the COMMON area *
;                                                                             *
?B_XRAM         EQU     0FFH     ; 0FFH if the XDATA RAM area is not mapped   *
;                                ; into a code bank.                          *
;                                ; otherwise ?B_XRAM must be set to the bank  *
;                                ; number which contains the XDATA RAM area   *
;                                                                             *
?B_MON_DATA_BANK EQU    007H     ; Bank number where monitor data is stored   *
;                                                                             *
IF  ?B_MODE = 0;                                                              *
;-----------------------------------------------------------------------------*
; if ?BANK?MODE is 0 define the following values                              *
; For Bank-Switching via 8051 Port define Port Address / Bits                 *
?B_PORT         EQU     P1       ; default is P6                              *
?B_FIRSTBIT     EQU     0        ; default is Bit 5                           *
;-----------------------------------------------------------------------------*

?B_NBANKS	indicates the number of banks supported.  The number must be between 2 and 32.  Only one 8051 address line (port terminal) is used for two banks.  Three or four banks require two address lines.  Five to eight banks require three address lines.  Nine to sixteen banks require four address lines.  Seventeen to thirty-two banks require five address lines.

?B_MODE	indicates if the bank switching code should use an 8051 port or an XDATA port for the address extension.  A value of 0 defines an arbitrary 8051 port for the address extension.  A value of 1 determines a XDATA port which is addressed in the external address space of the 8051.

?B_BANKSTART	specifies the start address of the banking area.  The value 0 means, that there is no physical common area.  In this case, the logical common area is automatically copied into every code bank during the load process of your application.  The value 0FFFFH specifies, that you are running a banked version of Monitor-51 on a non-banked hardware.  8000H is the default value.

?B_BANKEND	specifies the end address of the banking area.  This value must be greater or equal than ?B_BANKSTART.  0FFFFH is the default value.

?B_COMMON	indicates whether the physical common area must be accessed as a bank or not.  The default value 0FFH specifies, that the common area is not mapped to a bank.  Any other value specifies the bank number of the common area.  This option is used to separate the common area and XDATA area, although the common area is 'von Neumann' mapped.

?B_XRAM	indicates whether the XDATA area must be accessed as a bank or not.  The default value 0FFH specifies, that the XDATA area is not mapped to a bank.  Any other value specifies the bank number of the XDATA area.  This option is used to separate the common and XDATA area.  Both, ?B_COMMON and ?B_XRAM have to be set to 0FFH or both to different values.

?B_MON_DATA_BANK	specifies the bank number of the XDATA area used by Monitor-51.  In order to save memory space, the 256 byte monitor XDATA area and the optional 5KB trace memory can be located in a code bank instead of the common area.

?B_PORT	specifies the port address used to select the bank address.  If the value 0 is used for ?B_MODE, ?B_PORT can be used to specify the address of the internal data port.  In this case, the SFT address of an internal data port must be specified.  P1 is the default value for port 1.

?B_XDATAPORT	specifies the XDATA memory address used to select the bank address.  If the value 1 is used for ?B_MODE, ?B_XDATAPORT defines the address of an external data port.  In this case, an arbitrary XDATA address can be specified (address range 0H to 0FFFFH) under which a port can be addressed in the XDATA area.  0FFFFH is the default value.

?B_FIRSTBIT	indicates which bit of the defined port is to be assigned first.  The value ?B_FIRSTBIT EQU 3 (defined as the default when ?B_MODE is 0) indicates that P1.3 is to be used as the first port terminal for the address extension.  If, for example two port terminals are used for the extension, P1.3 and P1.4 are used in this case.  The remaining lines of the 8051 port can be used for other purposes.  If the value 1 is selected for ?B_MODE, the remaining bits of the XDATA port cannot be used for other purposes.


Translating Modules

If your target system allows MON-51 to be installed at address 0H, and the 'von Neumann' wired RAM is mapped to address 0, skip this section and go to Linking/Locating Segments.

If the monitor is installed at code address 0 and the 'von Neumann' wired RAM starts at a higher address, all interrupt vectors, the startup vector and all code segments must be relocated to this RAM start address.  For the following examples, a RAM start address of 8000H is assumed.

See Also:

Compiling C Modules

Translating Assembler Modules

Preparing STARTUP.A51

Preparing L51_BANK.A51


Compiling C Modules

Compile your applications as you normally would, but add the 'INTVECTOR' option in order to relocate all interrupt vectors to a higher address.  For example, you may use the following command line.

C51 MYCODE.C INTVECTOR(0x8000)

When you are using uVision, you will find this option in the pull down menu 'Options' / 'C51 Compiler...' / 'Object' / 'Offset'.


Translating Assembler Modules

Assembler modules may contain absolute segments (CSEG or ORG) and absolute references to CODE or XDATA locations.  All these CODE segments and CODE references must be located in the 'von Neumann' wired RAM address range of your target board.  Therefore, changes in your assembly source code may be necessary.
Relocatable CODE and XDATA segments (RSEG) are located by the linker L51/BL51.  Options therefore are described later under 'Linking/Locating Modules'.


Preparing STARTUP.A51

In order to locate the startup-vector to an address other than 0, it is necessary to modify the STARTUP.A51 file.  Copy the STARTUP.A51 file from the 'C51\LIB\' directory into your project directory and search for the following line:

              CSEG  AT 0
?C_STARTUP:   LJMP  STARTUP1

This is the startup-vector definition.  Change the address from 0 to the start address of your 'von Neumann' wired RAM.

              CSEG  AT 08000H
?C_STARTUP:   LJMP  STARTUP1

This STARTUP.A51 file must then be assembled with A51 and linked to your application.
When you are using μVision, add the modified STARTUP.A51 file as a assembly source file to your project.


Preparing L51_BANK.A51

The module L51_BANK.A51 is only necessary when a code banked application should be generated.  The constant settings in this file are similar to the settings in MON_BANK.A51.  For more details, please refer to section 'Bank Switching Configuration' in chapter 1 of the 8051 utilities manual.
This L51_BANK.A51 file must then be translated with A51 and linked to your application.
When you are using uVision, add the modified L51_BANK.A51 file as a assembly source file to your project.


Linking/Locating Modules

Locating CODE Segments

Locating XDATA Segments

Object to HEX Conversion


Locating CODE Segments

Code segments need to be located in the 'von Neumann' wired RAM area.

If MONITOR-51 is installed at a high address and 'von Neumann' RAM is available at address 0, only the serial interrupt vector has to be reserved.  MONITOR-51 uses the serial interrupt vector only as an option (see chapter 'MON51.DLL: dScope Monitor Driver' above).  With the BL51 CODE (0100H) directive all relocatable code and constant segments are located at 100H and above, reserving all interrupt vectors.

L51 MYCODE.OBJ, STARTUP.OBJ CODE (0100H)

When MONITOR-51 is installed at address 0, code segments have to be located where the 'von Neumann' RAM starts.

L51 MYCODE.OBJ, STARTUP.OBJ CODE (08000H)

When you are using uVision, you will find this option in the pull down menu 'Options' / 'BL51 Banked Linker' / 'Size/Location' / 'Code Address'.


Locating XDATA Segments

Since MONITOR-51 needs a 'von Neumann' wired memory architecture to load and debug code, the XDATA and CODE segments cannot be located at the same address.  The application's XDATA Segments have to be located either in the 'von Neumann' wired RAM above all CODE segments or in a separate XDATA area.  Check the linker map file (*.M51) of your application to figure out size and location of all code segments.  With the BL51 XDATA directive all relocatable xdata segments are located at the specified address and above.

L51 MYCODE.OBJ, STARTUP.OBJ CODE (0100H)  XDATA (04000H)
or
L51 MYCODE.OBJ, STARTUP.OBJ CODE (08000H)  XDATA (0C000H)


Object to HEX Conversion

You may use the OH51 utility to create an Intel HEX file from the absolute object module created by the linker.  Use the following command line to create a HEX file:

OH51 MYFILE

You may use either Intel HEX files or absolute object modules with the dScope debugger and the MON51.  Absolute object modules include symbols and source-level debugging information but HEX files do not.  Therefore, dScope should always be used with absolute object files and not with HEX files.