Encoder Front Page
SRS Home | Front Page | Monthly Issue | Index
Search WWW Search seattlerobotics.org

The Vice-Prez Sez

Karl Lunt

Doing the ‘hc11 thing...

I get asked robotics questions from time to time, usually over the Internet, and one question I get asked a LOT is: How to you put a program inside a 68hc11?

The answer is: It depends.

I’ll start with what you might call a beginner’s setup. This includes a BOTBoard with a 68hc811e2 installed, hooked via a serial cable to a PC. The PC should have Motorola’s pcbug11 program installed on it. I’ll also assume you have written a program (call it FOO) that you want to install on the ‘hc11.

First off, you have to have the tools. You can get pcbug11 from the Motorola FREEWARE web site http://freeware.aus.sps.mot.com/freeweb/amcu_ndx.html#mcu11. The file you want is pcbug342.exe.

Download PCBUG342.EXE into a directory such as C:\PCBUG11, then run the file. It is a self extracting archive.

Next, do whatever you have to do to your FOO source file to create the proper FOO.S19 object file. If FOO was written in assembler, use either AS11 or ASMHC11 (both available from the Motorola FREEWARE site) to assemble FOO. If FOO was written in SBasic, use SBasic to compile it, then run ASMHC11 to assemble it. In either case, you will end up with a FOO.S19 file for downloading to the 68hc11. Since the 68hc811e2 has memory from $f800 to $ffff, you need to ensure your executable file resides in that address range.

Now hook the serial cable between the PC’s serial port and the BOTBoard. Strap the BOTBoard for special bootstrap mode, per the BOTBoard instruction manual. Apply power and press reset.

Back on the PC, go to a DOS prompt and invoke pcbug11 with the command:

pcbug11 -a

(If you hooked your serial cable to COM2, use: pcbug11 -a port=2)

pcbug11 should respond with a bright blue screen and a command prompt at the bottom of the display. If you get an error splat whining about communications problems, you might have a wiring problem in your serial cable. This usually means that you have crossed pins 2 and 3 in the cable. Double-check your wiring, correct it, and try again.

If you are running Windows 95 and pcbug11 crashes out and leaves you back at the DOS prompt with an error message complaining about hardware failure, you might have a problem related to Win95. My laptop does not run pcbug11 properly if I boot the machine in Win95 and then try to run pcbug11 from a DOS prompt. If, however, I boot the laptop in DOS mode and try it, pcbug11 runs fine.

Assuming you are finally seeing a pcbug11 command prompt, enter the following commands:

control base hex (use hex numbers by default)
ms 1035 10 (enable programming of EEPROM)
eeprom f800 ffff (declare addresses of EEPROM)
loads foo (download foo.s19 to EEPROM)

pcbug11 will open the foo.s19 file and send the object code to the ‘hc11, where it will be burned into EEPROM. When the download finishes, you can disconnect the serial cable, restrap the BOTBoard for expanded mode, hit reset, and watch your code run.

This should be enough to get you started. If you still have questions, stop on by the SRS meetings on the third Saturday of each month; you’ll always find people willing to help you over the next hurdle.

Keep on keeping on...