Using PCBUG11 With the Technological
Arts Products
|
Motorola’s PCBUG11 is a flexible,
powerful, and easy-to-use program that runs on a PC. It allows you to examine
and modify on-chip memory (RAM, EEPROM, and EPROM), load HC11 code, debug,
trace, erase EEPROM, disassemble blocks of code, assemble line-by-line,
and even includes a basic terminal program. What’s more, it works with
all varieties of HC11 micros, and is fully compatible with all Technological
Arts 68HC11 Products. It is a self-extracting archive, so just copy it
to the directory on your harddrive where you want it to reside, and type
pcbug342
at the DOS prompt to extract all the files.
Running PCBUG11
Always RESET your module in
BOOT mode before starting PCBUG11. Also, make sure there are no background
tasks running on you PC, such as faxmodem drivers, networks, etc. PCBUG11
needs to access the serial port chip directly. If you have problems, start
PCBUG11 directly from DOS (not a DOS shell).
If the microcontroller in
your board is a 68HC811E2, or any A-series chip, type the following command
at the DOS prompt (after RESET in BOOT mode):
pcbug11 -a port=2
(if you’re using COM1, omit
the port=2 parameter).
If your microcontroller is
a 68HC11E0, ‘E1, or ‘E9, enter the following command instead:
pcbug11 -e port=2
(if you’re using COM1, omit
the port=2 parameter).
If your microcontroller is
a 68HC11D0 (ie. MicroStamp11), enter the following command instead:
pcbug11 -d port=2
(if you’re using COM1, omit
the port=2 parameter).
If your board has a 9.8304
MHz crystal (eg. Turbo version of MicroStamp11, MicroCore-11, or Adapt11C24DX),
you'll need to add a parmeter to use 9600 baud. For example, for
a Turbo MicroStamp11 connected to COM2 on your PC, you would enter:
pcbug11 -d port=2 baud=9600
Once PCBug11 has successfully
connected to your board, you'll see the command prompt. If you get communication
or read/write errors, hit ESC a few times until the command prompt appears.
Then reset your board and type RESTART. If you still have
no success, type CONTROL TIMEOUT 10000, then reset your board and
type RESTART again.
PCBug11 Session Notes:
If you prefer to use hexadecimal
numbers in your PCBUG11 session (instead of the default decimal notation),
enter the following command at the PCBUG11 prompt:
control base hex
To switch the SCI's
RX and TX pins to CMOS modes (for reliable serial communications), enter
ms 1028 05
Loading an S-record File into
‘811E2 EEPROM
First tell PCBUG11 the range
of addresses that contain EEPROM, as follows:
eeprom f800 ffff
Then make sure the Block
Protect Register is cleared:
ms 1035 00
To do a bulk erase of the
entire EEPROM block before programming it:
eeprom erase bulk f800
Then you can disable Erase-before-Write
to prevent PCBUG11 from erasing each byte before writing the new value:
eeprom erase disable
(disabling byte erase will
make downloading faster).
Now you’re ready to load
your s-record file. Suppose you have generated a file called myprog.s19,
use the following command to load it into EEPROM:
loads myprog
If it is in a different
directory, (eg. c:\myfiles) you should specify the directory path. For
example:
loads \myfiles\myprog
To verify that your file
myprog.s19 was actually written to EEPROM, use the Verify command:
verf myprog
Accessing External Memory
You can access external memory
in any expanded mode system (eg. MicroCore-11, MicroStamp11, Adapt11C24DX,
or Adapt11 with MX1 Memory Expansion Card) by placing the HC11 in Special
Test Mode. (Note: remember that a system always has to be in BOOT mode
to run PCBUG11; the mode can then be changed by modifying the HPRIO register).
To access external memory, modify the HPRIO register:
ms 103c e5
To change the value stored
in a RAM or register location (eg. clear location $2000), simply use the
Memory Set command, as follows:
ms 2000 00
To modify an internal EEPROM
location, make sure you have first specified the address range of EEPROM,
and that you have cleared the Block Protect Register (see Loading an S-record
File, above).
You can view locations,
and modify them as you require, by using the Memory Modify command, as
follows:
mm 2000
In this example, PCBUG11
will display the current value of location 2000. If you wish to change
it, type the new value, and press ENTER. If not, just press ENTER. The
next memory location will be displayed. While in this Memory Modify Mode,
you can decrement addresses using the up error key or increment addresses
using the down error key. To end the Memory Modify Mode, press ESC
on your keyboard.
Programming External EEPROM
To use the MX1E Memory Expansion
Card (eg. Adapt11 64K Starter Package) with PCBUG11, slide switch SW1 on
the MX1E card to WRITE, and then use Memory Modify or Memory Set, as above.
To load your .s19 file into EEPROM, we recommend you exit from PCBUg11
and use the Windows MicroLoad utility. However, it is also possible
to use LOADS to load an s-record file into external EEPROM, although
it is fairly slow. To do this, specify the EEPROM address range:
eeprom e000 ffff
Then enter:
eeprom erase disable
to disable the Erase-before-write
function. Now use LOADS, as described above. In any case,
to prevent unwanted modification of EEPROM locations, slide the switch
back to PROT when you are finished (and before resetting or cycling power).
To run the program you have loaded, switch SW3 away from the SCM position
(ie. put it in Expanded Memory mode), switch SW2 to RUN, and press RESET.
Using DOS from within
PCBug11
If you need to find a file,
you can suspend PCBUG11 temporarily and go to DOS by typing:
dos
When you have finished using
DOS, type exit to return to PCBUG11.
Programming the CONFIG Register
The CONFIG register ($103f),
allows the user to enable and disable such things as the EEPROM, ROM (or
EPROM), and COP (watchdog timer). In the ‘811E2, it also specifies to which
4K boundary the internal 2K EEPROM will be mapped in expanded mode. The
CONFIG register is implemented as an EEPROM cell, so you need to specify
this in PCBUG11 before you can modify it. Enter the following command:
eeprom 103f
If PCBUG11 returns a message
saying Erase-before-write disabled, enter the following command to enable
automatic erase:
eeprom erase enable
Make sure the appropriate
bits in the Block Protect Register are cleared (ie. PTCON):
ms 1035 00 enables
writing of EEPROM and the CONFIG register
Now you can use Memory Modify
or Memory Set to change the CONFIG register contents. There is one caveat,
however. The new value of the CONFIG register will not take effect until
following a RESET of the ‘HC11. Therefore, PCBUG11 will return a BAD MEMORY
error when you try to modify the location. This is because the Memory Set
and Memory Modify commands automatically attempt to verify the change they
just made. In the case of the CONFIG register, reading location $103f returns
the contents of a register which reflects the value of the CONFIG register
at the time of RESET. It is a read-only register. The actual EEPROM cell
implementing the CONFIG register, is a Write-only location, from the user’s
point of view. Also note: if you write a new 4K mapping address in the
CONFIG register of an ‘811E2, you will not be able to read it with PCBUG11.
This is because PCBUG11 must always start up in BOOT mode, which is a single-chip
mode. The ‘811E2 forces the upper 4 bits of the CONFIG register to ones
during reset in any single-chip mode. It also forces EEON to one, to ensure
that the 2K EEPROM is located in the HC11’s vector space, and is enabled.
This fact makes it impossible to access locations in the upper 2K of external
memory in BOOT mode on a system using an ‘811E2.
Using PCBUG11’s Terminal Window
PCBUG11 includes a basic communications
terminal function which is useful for testing and debugging your software.
To use it, set up the necessary communications parameters such as baud
rate, parity, etc. by entering:
control
A list of parameters is
displayed. Use the Page Down and Page Up keys to move to the parameter
that needs changing. Use the Up and Down arrow keys to make the changes,
or enter new values via the keyboard. When you’re done, press the ESC key
to return to the PCBUG11 prompt. Now enter:
term
to open the terminal window.
If you have the Demo program loaded in your board, you can use the terminal
window to interact with it. First, make sure you have set up the baud rate,
etc., as required for the demo program. Then, switch your board to RUN,
and press RESET. Pressing ENTER will cause the menu of the demo program
to be displayed. Select the menu commands, as you desire. When you have
finished using the demo program, you can return to PCBUG11 by hitting ESC.
To re-establish communication between PCBUG11 and the ‘HC11, reset your
board in BOOT mode, and enter:
baud 9600
restart
Programming 68HC711E9
One of the more popular versions
of the 68HC11 microcontrollers for single-chip applications is the MC68HC711E9,
containing 512 bytes of EEPROM, and 12K bytes of EPROM. In a windowed package
(FS suffix), it is eraseable with UV light, just like a normal EPROM. It
is also available in a one-time programmable package (FN suffix). Both
versions can be programmed with any model of ADAPT-11 using Motorola’s
PCBUG11. All that is required is to supply ADAPT-11 with the proper programming
voltage via External Power connector J1. This voltage must be closely regulated
between 11.5VDC and 12.5VDC. Before applying the programming voltage to
the connector, make sure that the VPP/NORMAL slide switch is in the NORMAL
position. Then connect the programming voltage. The on-board 5V regulator
will provide the ADAPT-11 circuitry with the power required to operate.
(There is no need for your breadboard to supply power. In fact, ADAPT-11
does not even need to be plugged into a breadboard when it is being used
as a programmer. Just be careful to place it on a non-conductive, anti-static
surface.) With the serial cable hooked between ADAPT-11 and your PC, and
the VPP/NRML switch still set to NRML, run PCBUG11 as outlined, above.
Then tell PCBUG11 the address range of EPROM as follows:
eprom d000 ffff
Next verify that the EPROM
is blank:
verf erase d000 ffff
Now switch the VPP/NRML
switch to VPP. This applies the programming voltage to the ‘711 in the
socket of the ADAPT-11. Use the LOADS command to specify the path and filename
of the S19 file you wish to program into the ‘711. For example, to "burn"
myprog.s19 into the EPROM, enter:
loads myprog
PCBUG11 will now invoke
the necessary EPROM programming algorithm to "burn" the file into the target
locations. As soon as it is finished, set VPP/NRML back to NRML to shut
off the programming voltage. If you wish, use the Verify command to verify
that the EPROM programmed correctly:
verf myprog
To run your code, switch
ADAPT-11 to RUN mode and press RESET. Note that your s-record file may
just as well have target addresses in EEPROM and RAM; these would be programmed
properly by PCBUG11, as long as you have specified the EEPROM range and
cleared the Block Protect Register.
Exploring Further with PCBUG11
For information about PCBUG11
commands and their syntax, enter:
help
at the PCBUG11 prompt.
For complete details on
PCBUG11, refer to the PCBUG11 Manual, available from the Motorola Literature
Center or right
here.
Last update: 2 Sep 2003
Copyright © 2003 Technological Arts