Application Notes
Holon 11 Monitors
Handling Interrupts
Using the Real Time Kernel
Memory Banks

Holon 11 Monitors

Holon 11 is an "umbilical" development system. The host controls the target via a small monitor, which occupies 200 bytes in the target memory space. No emulators or other development hardware are needed. 

Monitors

There are many 68HC11 processors and systems and one monitor can not fit all situations. The Holon 11 system includes the following monitors.

Monitor Location Memory Communication
IMON $0000 internal RAM polling
PMON $FF00 program RAM interrupt
TMON $BF00 program RAM interrupt
EMON $FF00 internal EEPROM interrupt
EPMON $FF00 EPROM interrupt

IMON - Monitor in internal Processor RAM

We use IMON for establishing the initial contact with a target system. IMON puts a minimum of demand on the target. If you can boot-load code into the target, you can load and run IMON.  IMON operates in the internal system RAM of the 68HC11 processor. You can contact a target board even if it has a problem with its external memory. Better yet, you can use IMON to test your target board. Holon 11 has been used for production testing.

When IMON is started, it sets the processor into extended external mode. Thus you can address external memory - if available - and load and test your program.

Communication with the host is polled, IMON runs with the interrupts disabled and continually checks the status bits in the SCI port. You can still enable interrupts in your program and test interrupt service routines with IMON. However, you can't watch the memory while your program runs, because your program is now in control and IMON waits for the end of the program. (Use PMON to watch a running program.)

The host also waits for the end of the program and shows a small square in place of the blinking dot in the browser. When the program returns to the monitor, the monitor sends an end signal to the host. You can interrupt the host (press ESC) and regain control of the browser, while the program keeps running in the target. The monitor is off-line until the program ends.

If the program never ends, reset the target. Reset calls IMON, if the 68HC11 is set to external expanded mode and if there is RAM in the interrupt vector space below $FFFF. The RESET vector has been set by IMON at boot loading.

IMON also sets the SWI vector in the external interrupt vector space. SWI is used for interactive program execution. When a program word ends, it uses SWI to return control to the monitor. 


PMON - Monitor in Programm RAM

Holon 11 is designed for interactive program development into a 68HC11 target system, which contains RAM for the program in the upper memory space during development. The program RAM may be replaced by an EPROM in the final system. A battery-backed RAM is ideal for program development with Holon 11 and PMON. 

The monitor PMON installs itself at location $FF00 after boot-loading. It sets and uses the interrupt vectors SCI, SWI, and RESET. It also sets and catches TRAP, IRQ, and XIRQ.  Communication is interrupt based. An incoming character evokes the SCI interrupt, which is serviced by the monitor. The monitor performs a complete command inside the interrupt service routine, then it returns control to the program and enables interrupts again. If a program word runs, the monitor and the host wait for the end of the word. Press ESC to regain control of the host.

If interrupts are enabled in the application, the host picks up communication with the monitor while your program is running. Holon 11 starts the program with interrupts on. Now you can look into the running program. If you press F6 (=Code), Holon 11 repeatedly reads data from memory and displays the memory contents. You can watch variables and the contents of the 68HC11 register block changing.

You can also change the running program. If you change a word in the program and reload it in the browser (F3), Holon 11 automatically sends the new code to the target. Control is then returned to the program, which executes the new code. 

NOTE:  WOLF WEJGAARD FORTH ENGINEERING DISCLAIMS ANY RESPONSIBILITY FOR THE CONSEQUENCES OF CHANGING CODE IN A RUNNING PROGRAM. Changing a running program is safe in many cases, however, I do not not recommend it, if your target system is controlling a critical process.

CPU Stack

While the monitor is in charge, the 68HC11 stack pointer SP is set to $000F. The locations below $000F are used by the monitor. When the monitor passes control to the program, SP is moved to MainSP0. The value of MainSP0 (initially $0044) is defined in the target module Basis, thus you can freely adapt the stack location to your application.

COP watchdog 

The COP watchdog is serviced by the monitor. You can develop programs with the COP watchdog activated. 

68HC11F1

The internal EEPROM of the 68HC11F1 must be inactive for PMON. Boot-load the file NOEEPROM.COD, which is included with Holon 11. Then load PMON.  The chip-selects of the 'F1 are set as:

CSCTL  = $E5    32 KB on CSPROG, has priority.
CSGSIZ = $01    32 KB on CSGEN, at $0000

This can be changed, see notes.


TMON for the Handyboard (Special Test mode)

TMON is a normal programming monitor that is used in the Special Test mode of the 68HC11. TMON is loaded to $BF00.

Use TMON with the Handyboard in robot applications.


EPMON - Monitor in EPROM

Normally the monitor is loaded into the 68HC11 system using the special boot mode of the processor. EPMON is a version of PMON that is burned into an EPROM. Thus you don't need to provide for switching the board into boot mode.The monitor EPMON obviously can't be used to write code into the EPROM. Therefore EPMON is mainly useful for testing a program that is burned into the EPROM with the monitor. Simply include the monitor with the application.

If you have external RAM available, you can develop the program temporarily in the RAM, and then all the functions of Holon 11 are at your disposal, like single-stepping through the code, and changing the code on-the-fly.


EMON - Monitor in internal EEPROM

In a 68HC11F1 you may wish to install the monitor in the internal EEPROM. The monitor EMON is your choice. After boot-loading the boot code turns on the EEPROM, positions it at the upper end of memory space, and copies the monitor code to $FF00.  The monitor EMON has the properties of PMON and the following features.

Redirected interrupt vectors

EMON redirects the interrupts that are not used by the monitor to pseudo-vector locations in the internal system RAM. Each pseudo-vector is allowed three bytes of space, rather than the two bytes for normal vectors, because an explicit jump (JMP) opcode is needed to cause the desired jump to the user's service-routine address. For example, to use the SPI, a jump to the user's SPI service routine would be placed in RAM at addresses $3CD, $3CE and $3CF. Holon 11 contains a list of these pseudo-vectors in the module 68HC11. The utility word SetExternal ( isr-adr vec-adr  -- ) lets you insert both the JMP code and the ISR address in the desired external pseudo-vector. Example for an SPI service routine:

Define the SPI service routine.

Label SPIservice
    <action>
      rti   

Set the SPI external vector from within the program.

Code SetupSPI
      SPIservice  evSPI  SetExternal
      next

You can also set up the vector interactively in a pseudo-word. When this word is loaded, the contents are executed as a compiler directive.

( Set-SPI-vector )
SPIservice  evSPI  SetExternal

 See the application note Holon 11 interrupts.


Notes