Putting a program into a 68hc11 BOTBoard

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. The program you want is called PCBUG342.ZIP, which is the latest version of this popular 68hc11 development tool. Download PCBUG342.ZIP into a directory such as C:\PCBUG11, then unzip the file. You will see several files, including the executable, pcbug11.exe.

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.

Another failure of pcbug11 can happen if your PC is too fast; as in more than 100 MHz or so.  pcbug11 is an old program, written in the days of (relatively) slow machines.  The program contains a number of delays written as busy loops, and the newer machines execute the busy loops so quickly that pcbug11 times out prematurely and decides a hardware failure has occurred.  If this happens to you, download my specially-modified version of pcbug11, called pcbug11a.  This has a stopgap fix to the timing problem that will tide the community over until we can (hopefully) get a real fix.  pcbug11a works and acts just like pcbug11, only it isn't so susceptible to the timing problems on fast machines.

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

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 (if necessary), restrap the BOTBoard for expanded mode, hit reset, and watch your code run.