PCBUG11 Primer

Back to 68hc11 tools.

Back to articles.

Back to docs & references.

Last updated:


Copyright: This document is copyright 1994-2004 by Thomas P. Dickens (), written for the direct use of my students at Henry Cogswell College. It may be distributed freely in verbatim form provided that no fee is collected for its distribution (other than reasonable reproduction costs) and that this copyright notice is included. Enjoy...

Purpose:

The purpose of this document is to provide you with minimum working information about the Motorola PCBUG11 monitor program, directed for use with the Motorola 68HC11E1 micro controller. It is NOT intended to teach you assembly programming, HC11 internals, or to be a complete a reference for PCBUG11. The information is compiled from Motorola's "PCbug11 User's Manual", Motorola document number M68PCBUG11/D2, second edition, September 1992.

 

Contents:

  1. Files required
  2. Invoking PCBUG11
  3. The few commands needed to work
  4. Startup files
  5. Hardware setup
  6. Sample PCBUG11 session

 

1) Files required: These can be found on various electronic bulletin boards. I am using version 3.24a, 1991. I don't have a record of version numbers and differences.

PCBUG11.EXE The PCBUG11 program executable.

PCBUGTRN.EXE User-definable return program.

CODES.P11 Mnemonic tables for assembly/disassembly.

OFFSETS.P11 Mnemonic tables for assembly/disassembly.

TALK??.BOO Talkers using SCI interrupt.

TALK??.XOO Talkers using SCI interrupt.

PCBUG11.HLP PCBUG11 help information.

 

All of these files should reside in the same directory.

2) Invoking PCBUG11: If you just type PCBUG11, you will be prompted for different options including chip type and which PC serial port (1 or 2) you are using (see section 6, Sample PCBUG11 session, for the series of prompts and basic answers). You will then see the complete command line to use next time to get the same options. I usually take this line and put it in a 1-line .bat file, called PCBUGE1.BAT or PCBUGA1.BAT for the different chips types (see section 4).

 

3) The few commands needed to work:

In my sessions with PCBUG11, there are only a handful of commands I use regularly. I will detail those here. Refer to the PCBUG11 help file (PCBUG11.HLP) for information on the other commands.

-Setup-

EEPROM [start-addr [end-addr]] Define an EEPROM range.

EEPROM DELAY option Define an EEPROM delay for writing (12 mS min).

CONTROL [parameter] Set or display PCBUG11 system parameters.

CONTROL BASE HEX Set hex mode for numbers. (No $ needed)

-Load code into HC11-

LOADS filename [addr] Load an .S19 file (result of AS11) into HC11 memory.

-Check HC11 code-

DASM addr1 [addr2] Disassemble HC11 memory from address1 to address2.

MM addr Modify memory from address.

 

-Running HC11 code-

G [addr] Start HC11 execution at the address.

S Stop HC11 execution.

 

-Get out-

DOS [command] Drop to DOS and execute commands. EXIT to return.

QUIT [Y] Quit PCBUG11. Y will avoid confirmation.

 

I know PCBUG11 offers other advanced capabilities, but my these get the job done. And when combined with startup files to set my options, it makes for an easy to use environment.

 

4) Startup files:

To make PCBUG11 as easy to use as possible I have configured a few startup files. This way I can forget how to use PCBUG11, and when I need it a couple of weeks later I can still use it.

====== File: PCBUGE1.BAT ======

pcbug11 -e port=2 macro=startup

====== End-Of-File ======

 

====== File: STARTUP.MCR ======

DEFM AUTOSTART
BEGIN
    CONTROL BASE HEX
    EEPROM B600 B7FF
    EEPROM DELAY 12
    LOADS E1MM

END

====== End-Of-File ======

 

====== File: E1MM.ASM ======

* Clear the BPROT register to allow writing into EEPROM space.

    ORG $1035
    FCB $00

====== End-Of-File ======

Note: E1MM.ASM must be assembled using AS11.EXE to generate E1MM.S19.

 

With these files in the same directory as my PCBUG11 files, all I enter is 'PCBUGE1' and PCBUG11 will come up ready to talk to an E1 chip, in HEX mode, with the EEPROM range and delay set, and the HC11 BPROT register cleared. Without the BPROT register cleared, the HC11 will not accept any data in it's EEPROM.

 

5) Hardware setup: The 68HC11 is designed to communicate to a host computer using serial communications. This can easily hook up to a PC running AS11 and PCBUG11. To convert from 5 volt TTL logic to RS-232 voltage levels, a MAX-232 or MAX-233 chip can be used. Their differences are; the 233 chip costs more, but does not require external capacitors. The MAX-233 chip can be wired inside of a hood of a 25-pin connector to save space.

 

The HC11 to PC hookup is as follows:

    PC 25-pin connector:                    PC 9-pin connector:
     Connect pins 5, 6, and 20                 2=PC Rx
       2=PC Tx                                 3=PC Tx
       3=PC Rx                                 7=Ground
       7=Ground

                    +---------------+
  HC11, pin 21 (Tx) | 1  MAX-233 20 |  HC11, pin 20 (Rx)
              -nc-  | 2          19 |  PC Tx
              -nc-  | 3          18 |  PC Rx
              -nc-  | 4          17 |  pin 12
              -nc-  | 5          16 |  pin 10
            Ground  | 6          15 |  pin 11
           5 Volts  | 7          14 |  -nc-
              -nc-  | 8          13 |  -nc-
            Ground  | 9          12 |  pin 17
            pin 17  | 10         11 |  pin 15
                    +---------------+

   All Caps are electrolytic, polarized, 1.0 uF.
   Use a 5th Cap file 5 Volts to Ground.
                    +---------------+
            Cap2+   | 1  MAX-232 16 |  5 Volts
            Cap1+   | 2          15 |  Ground
            Cap2-   | 3          14 |  PC Rx
            Cap3+   | 4          13 |  PC Tx
            Cap3-   | 5          12 |  HC11, pin 20 (Rx)
            Cap4-   | 6          11 |  HC11, pin 21 (Tx)
              -nc-  | 7          10 |  -nc-
              -nc-  | 8           9 |  -nc-
                    +---------------+
      Cap1- to 5 Volts      Cap4+ to Ground 

 

6) Sample session: We will create code to do a slow binary count on port B of the HC11. Monitor the port B pins with LEDs (with current-limiting resistors of course) or other methods to see the port.

 

6.1) Create an assembly language program:

====== File: COUNT_B.ASM ======

* This code will perform a binary count on Port B
PortB 	EQU 	$1004
	ORG 	$B600 	; Start of HC11E1 EEPROM
	clr 	PortB 	; set port B to zero
Main 	inc 	PortB 	; Add 1 to port B
	ldx 	#$4000
Delay 	dex 		; X = X - 1
	bne 	Delay
	bra 	Main

====== End-Of-File ======

 

6.2) Assemble the code: This generates the file COUNT_B.ASM

C:\AS11 COUNT_B.ASM

 

6.3) Connect your HC11 to your PC. Power on the HC11 circuit in BootStrap mode. It should now be waiting to hear from the PC.

6.4) Start PCBUG11

C:\PCBUG11

Answer the prompts to get into the program:

Is the talker installed on your board? (Y/N) : N
Do you wish to use the XIRQ interrupt? (Y/N) : N
MCU boot talkers available (list of HC11 CPUs)
Which device are you using? : D (PC types in -E)
Do you wish to load a macro automatically? (Y/N) : N
PC communications Port 1. COM1 2. COM2
Which communications port are you using? : 2 (depends on your PC)
Are you using an 8 MHz crystal? (Y/N) : Y

 

At this point PCBUG11 should initialize the HC11 and present you the prompt:

>>

 

If the HC11 and PC are not talking, you will get one of the following messages:

+-----------------------------------------------+
| Comms fault: Register Read Terminated 	|
+-----------------------------------------------+

+-----------------------------------------------+
| Comms fault: Memory read t/out Terminated 	|
+-----------------------------------------------+

If you get errors, double check all cables, ports, and other setups.

 

6.5) Allow writing into the HC11 EEPROM:

>> mm $1035

Type in 00, then hit <ESC> to return to the >> prompt.

 

6.6) Load the COUNT_B machine code into the HC11:

>> loads count_b

 

6.7) Confirm the program in the HC11 memory:

>> dasm $B600

You should now see the COUNT_B program as read from the HC11 memory.

 

6.8) Run the HC11 program:

>> g $B600

You should not see the LEDs blinking on the HC11 port B.

 

6.9) Stop the HC11:

>> s

 

6.10) Exit PCBUG11:

>> quit y