68HC11 Tips

This page contains various tips about the 68HC11 -- a processor from Motorola that I got familiar with when I was working for Motorola quite some time ago.

The easiest way to get started is to pick up a 68HC811E2 in a 48 pin DIP package. This lets you breadboard without using PLCC chips. A basic system is just the CPU, an 8 MHz crystal or resonator, a reset circuit, and an RS232 converter (like a MAX232 or MAX233). The chip has 4 A/D, 256 bytes of RAM, 2K of EEPROM, and plenty of I/O, interrupts, timers, and other features.

NEW: If you want a easy way to connect an RS-232 cable to a MAX232 and to your breadboard, check this out!

The 68HC11 has a special bootstrap mode that allows you to load data into RAM via the built-in serial port. There are special programs that load another special program, called a talker, and then use it to control the computer so you can examine memory, run programs, and even single step programs. Motorola provides a program called PCBUG11 which performs these functions.

The problem is, the talker usually loads into RAM. Since it take a large amount of space, you have very little RAM left over for your program. If you just want to program the EEPROM, that's fine, but if you want to execute a program -- especially a Basic program written with the excellent and free SBasic, you won't have much luck.

I rewrote the TALKEREE file supplied by Motorola to work with the 68HC811 -- I was going to rename it TALK811, but apparently PCBUG11 "knows" about TALKEREE and does some of the special things required to get it to work, so I couldn't get it to work as TALK811 (unless I made a dumb mistake).

Here's how it works:

1) Use PCBUG11 as usual to load the TALKEREE.S19 file. Here are the commands you'll need to issue inside PCBUG11:
    CONTROL BASE HEX
    MS 1035 10
   EEPROM F800 FFFF
    LOADS TALKEREE
   QUIT

2) Reset the CPU -- make sure it is still in Bootstrap mode

3) Run PCBUG11 TALKEREE

4) Now you can use PCBUG11 as usual. However, a few notes:
-> Don't specify EEPROM -- the talker assumes the EEPROM starts at F910 and goes to FFFF -- the talker loads at F800 to about F90F and it won't let you write over itself

-> Do specify MS 1035 10 to enable EEPROM writes

-> You can use RAM from 0 to A2 (the Stack is at A2). RAM above this is reserved.

-> If you use the SCI, you will interfere with debugging which also uses the SCI

You can compile an SBasic program using the following options: 

/CF910 /V0000 /S00A2 /I

Here are the files you need: talk811.zip (Version 2!)

If you want to interface our PAK floating point math, I/O, or pulse input coprocessors to an HC11 you can find an assembly library that will work from assembly or SBasic here.

Here is my macro file. The TRACE macro is really important to define:

DEFM AUTOSTART
BEGIN
CONTROL BASE HEX
MS 1035 10
END

DEFM TRACE
BEGIN
rd
dasm *
END

If you are at a JSR and you want to execute it and return, enter:

BR *+3

G

When execution returns

NOBR *

Put these in a macro. For example:

DEFM ENDTRACE
BEGIN
NOBR *
RD
DASM *
END

DEFM TRJSR
BEGIN
BR *+3 ENDTRACE
G
END

 For a BSR use BR *+2 instead of *+3.

This might be obvious to you, but it took me a while to figure it out. PCBUG11, when working correctly, can operate while your program is running. In other words, you don't need to stop the program to examine memory or registers or even change things. While a program is running, for example, you can modify an I/O port or set a break point. This works because PCBUG11 uses interrupts.

Great starting point

All the tools you'll need in one place (almost)

PCBUG11 Tutorial (remember -- don't use EEPROM with my version of TALKEREE)

Information about SBasic (Very nice IDE)

Good page of links

Back to WD5GNR's home page

Our Microcontroller Products (floating point math, PWM, I/O expansion, PS/2 keyboard interface, pulse I/O, and more)