13
3 MON08 MONITOR FIRMWARE
3.1 Introduction
The HC908 series of micro controllers come with a small monitor program (MON08) already
programmed into ROM. This program has a software bit-bang emulation of the standard RS232 serial
protocol and six low-level commands which together allow the user to read and write RAM memory,
read the stack pointer (SP) and run a program. It is the function of Xplor8 to interface with this
monitor program and use its low level commands to perform realistic tasks such as programming
FLASH memory.
To be able to enter this monitor program after resetting the MCU requires that the reset vector points
to its start. As the normal reset vector (at $FFFE/F) may have been programmed by the user to point
to the start of the user’s own program, the HC908 MCUs have a special mechanism to force the CPU
to use different addresses for the reset and SWI vectors. This mechanism involves having certain
voltages on various pins at the moment of reset - see any HC908 data sheet for details.
The monitor uses only a single pin on the MCU to communicate with the outside world. This means
that full duplex communication is not possible, and also that every byte sent to the MCU from the host
is inevitably also returned to the host as an unwanted echo. Xplor8 automatically disregards these
unwanted echos.
The monitor program on the MCU provides six basic communication functions:
1. Read MCU memory
2. Write MCU memory
3. Indexed read of MCU memory
4. Indexed write of MCU memory
5. Read the Stack Pointer (SP)
6. Run a user program
All Xplor8's features are provided by using one or more of these six functions. When the CPU enters
the monitor program it executes a software interrupt (SWI) instruction. This automatically stacks the
program counter, A, X and CCR registers, and the monitor is so written that it also stacks the H
register. This allows us to read and modify the CPU inherent registers before giving the ‘run’
command which unstacks H and then executes a Return from Interrupt (RTI).
Once a user program is running on the MCU there is no way for Xplor8 to seize back control, unless:
• The user program arrives at a pre-set breakpoint
• The user program arrives at an SWI instruction
• The MCU is reset
Comentarios a estos manuales