Professional Documents
Culture Documents
Geoffrey C. Yerem
Department of Electrical Engineering
University of Tennessee, Knoxville
Introduction
The electronic computer has been called the most complex machine built by
man, and anyone fascinated by technology recognizes the computer as t h e
ultimate machine. Infinitely configurable through programming, the computer
is a machine that is malleable as clay is to a skilled sculptor. If you love
computers, you probably want to become a skilled computer sculptor. Becoming
a skilled programmer provides half of the skills you need. Completing your
skills means understanding computer hardware, at the heart of which is t h e
microprocessor. If learning about computer hardware is your goal, then read on.
This paper is going to show you how to build your own practical, working
computer from scratch.
This document will show you how to build your own computer trainer based
on the Motorola MC68HC11 microprocessor. The design used here is similar to
many of the commercially available MC68HC11 single board computers,
particularly the Motorola M68HC11 Evaluation Board (EVB). You will learn a
great deal by building this project and, in the end, you will have a working
EVB of your very own that you can program and customize.
This document contains six sections:
Section 1 - Introduction
Section 2 - The Structure of a Small Computer System
Section 3 - Building the Computer
Section 4 - Testing the Computer
Section 5 - Using the Computer
Section 6 - Conclusion
The instructions in the rest of this document assume that you have h a d
little or no exposure to microprocessor electronics. You should, though, have
some computer programming experience, particularly with assembly language.
Also, you should have some experience with digital electronics as well as some
experience with basic electronic assembly. Barring no problems, you can
construct this project in about one full week. Good luck, you are on your way to
building your first, but probably not your last, computer.
2.1
The Design
The computer we are about to build will have the Motorola MC68HC11
microprocessor at its core. Motorola designed the MC68HC11 so that it requires
a minimum of support circuitry in order to build a working design with it. This
will suit our purposes nicely since it will allow us to learn how to build a
computer without sinking in excessive complexity.
(U1)
MC68HC11A1P
25
24
41
40
PB7
MODA(*LIR)
MODB(Vstby)
PB6
PB5
PB4
PB3
PB2
*IRQ
*XIRQ
22
VRH
21
VRL
26
AS
27
E
28
R/*W
47
PD5/*SS
46
PD4/SCK
45
PD3/MOSI
44
PD2/MISO
43
PD1/TxD
42
PD0/RxD
38
37
PC6
36
PC5
35
PB4
34
PC3
33
PC2
32
PC1
31
PC0
PC7
PA7/PAI/OC1
PA6/OC2/OC1
PA5/OC3/OC1
PA4/OC4/OC1
PA3/OC5/OC1
6
PA2/IC1
7
PA1/IC2
8
PA0/IC3
*RESET
XTAL
30
10
11
12
13
14
15
PB1
16
PB0
20
PE3/AN3
19
PE2/AN2
18
PE1/AN1
17
PE0/AN0
1
2
3
4
5
39
EXTAL
29
The MC68HC11 has many useful circuits already built into it. For example,
it has built-in digital I/O ports, a sophisticated timing system, an
asynchronous serial port for RS-232 communications, a synchronous serial port,
an analog-to-digital converter and a built-in crystal oscillator circuit. It also
has built-in memory such as 256 bytes of Random Access Read/Write Memory
(RAM), 512 bytes of Electrically Erasable Programmable Read Only Memory
(EEPROM) and in some versions, 8 kB of Read Only Memory (ROM). Having
all these resources on one chip allows the MC68HC11 to be used as a single-chip
microcontroller requiring no extra support chips. For this project though, we
will treat the MC68HC11 as a conventional microprocessor by adding various
external resources to it.
Following is a block-by-block description of the computers design using
sections taken from the main schematic diagram. The complete schematic
diagram can be found in Appendix 3.
Address Bus (A0:A15)
(U5)
(U3)
74HC373
9
10
PB6
11
PB5
12
PB4
13
PB3
14
PB2
15
PB1
16
PB0
PB7
AD7 1 8
8D
AD6 1 7
7D
AD5 1 4
6D
AD4 1 3
5D
AD3 8
4D
AD2 7
3D
AD1 4
2D
AD0 3
1D
A15
A14
A13
A12
A11
A10
A9
A8
C
11
26
AS
27
E
28
R/*W
19
*EN
38
37
PC6
36
PC5
35
PB4
34
PC3
33
PC2
32
PC1
31
PC0
PC7
AD7
AD6
AD5
AD4
AD3
AD2
AD1
AD0
AD7 1 1
B8
AD6 1 2
B7
AD5 1 3
B6
AD4 1 4
B5
AD3 1 5
B4
AD2 1 6
B3
AD1 1 7
B2
AD0 1 8
B1
PAL16L8-12
19
16
7Q
15
6Q
12
5Q
9
4Q
6
3Q
5
2Q
2
1Q
8Q
*OE
A7
A6
A5
A4
A3
A2
A1
A0
A15
A14
A13
A12
A11
A10
I/O
I/O
I/O
I/O
I/O
I/O
O
19
*BOOT
18
*SPARE
17
*WRIO
16
*RDIO
15
*PIA2
14
*PIA1
13
*EXTRA
12
*RAM
1
A-B
9
8
A7
7
A6
6
A5
5
A4
4
A3
3
A2
2
A1
A8
D7
D6
D5
D4
D3
D2
D1
7
8
11
9
E
R/*W
D0
74HC245
(U4)
Vcc
Vcc
(RP1)
4.7 k
J4
PE0
(U1)
MC68HC11
25
MODA(*LIR)
24
MODB(Vstby)
Vcc
XTAL
30
EXTAL
(R2) 10 M
29
(RP1)
4.7 k
RESET
(C11)
22 pF
(C12)
22 pF
(U8)
(U6)
27C64-250
19
O7
18
O6
17
O5
16
O4
15
O3
13
O2
12
O1
11
O0
D5
D4
D3
D2
D1
D0
Vcc
1
27
22
Vpp
*PGM
*OE
2
A12
2 3 A11
A11
2 1 A10
A10
24
A9
A9
25
A8
A8
3
A7
A7
4
A6
A6
5
A5
A5
6
A4
A4
A3
7
A3
8
A2
A2
9
A1
A1
10
A0
A0
A12
*CE
20
D7
D6
D5
D4
D3
D2
D1
D0
HM62256-LP15
19
A14
I/O7
18
A13
I/O6
17
A12
I/O5
16
I/O4
A11
15
A10
I/O3
13
I/O2
A9
12
I/O1
A8
11
I/O0
A7
A6
A5
A4
1
26
2
23
A14
A13
A12
A11
2 1 A10
24
A9
25
A8
3
A7
4
A6
A5
5
6
7
A3
8
A2
9
A1
10
A0
22
*OE
R/*W
*CE
D7
D6
Vcc
A4
A3
A2
A1
A0
27
20
Notice that the EPROM and the RAM chip have similar pin outs. This is
due to the JEDEC standard which specifies the pin outs of byte-wide (8-bit)
memory devices. The JEDEC standard allows memory of different sizes and
from different manufacturers to be used in the same sockets, with little or no
modifications.
(U2)
MC68B21
D7
D6
D5
D4
D3
D2
D1
D0
26
D7
27
D6
28
D5
29
D4
30
D3
31
D2
32
D1
33
D0
(U9)
MAX232CPE
Vcc
24
CS1
22
CS0
35
RS1
36
RS0
23
*CS2
25
E
21
R/*W
34
*RESET
A1
A0
PD1
10
PD0
PPA7
PPA6
PPA5
PPA4
PPA3
PPA2
PPA1
PPA0
39
CA2
40
CA1
19
CB2
18
CB1
CB2
CB1
9
PA7
8
PA6
7
PA5
6
PA4
5
PA3
4
PA2
3
PA1
2
PA0
17
PB7
16
PB6
15
PB5
14
PB4
13
PB3
12
PB2
11
PB1
10
PB0
PPB7
1
3
10F
PPB6
PPB5
PPB4
PPB3
12
(C13)
10F
RxD
DCD
6 DSR
14
13
8 CTS
DTR
9
C1+
C2+
C1-
C2-
V+
TxD
11
*PIA1 ($A000)
E
R/*W
*RESET
(C14)
CA2
CA1
1
7
V-
4
(C15)
5
10F
6
(C16)
10F
Vcc
PPB2
PPB1
PPB0
3.1
Tuesday
Order Parts.
Download Software.
Order Data Sheets.
Buy parts from Radio Shack.
Wednesday
Thursday
Friday
Saturday
Sunday
There are three parts listings given for this project, one for each parts
supplier. Generally, the fewer orders you make, the less overall shipping
charges you have to pay. It turns out that JDR Microdevices, Digi-Key and
Radio Shack have all of the parts that well need. JDR Microdevices and
Digi-Key are mail-order houses, while Radio Shack is usually just a car ride
away.
Keep in mind that the parts list, and the whole design for that matter,
isnt etched in stone. If you find a better supplier, come up with better parts, or
just want to save money, many of these parts can be substituted or even left out
entirely. Look over the part list carefully and check the items with the mailorder catalogs. Try to understand what youre buying.
If you find that a particular part isnt in stock, it would be best to substitute
the part for another or order it somewhere else, as opposed to backordering t h e
part. Backorders can mean waiting weeks or possibly not getting the part a t
all, not to mention extra shipping charges. Be sure to keep the mail-order
catalog handy when you place your order in case you need to make a quick
substitution. Backorders shouldnt be a problem for this project since most of t h e
parts are pretty commonplace.
If you choose, you can order all of the mail-order parts over the Internet.
Simply go to the respective WWW site and follow the ordering procedure. One
advantage to ordering parts over the Internet is that you can instantaneously
check the stock for each item as you go along. Also, you wont feel rushed in
case you need to change your mind while ordering.
If you place your order early in the day, the parts suppliers will usually
ship the order the same day. As a result, the shipping method you choose will
determine the amount of time it will take to get the parts. Second-day airmail is usually a good buy. With second-day air-mail, the parts will arrive
within two business days of when they are shipped.
The prices and part numbers which are listed below reflect what was
available at the time of printing. As time progresses, the prices, availability
and part numbers will change. If you can't find a part in the recent catalogs,
find substitutes using the master parts list in Appendix 1.
The parts marked (*) are ones you might already have in your parts box. I f
you don't have them, go ahead and order them since you're getting a pretty
good deal from the mail-order houses. The parts marked () are optional and
can be substituted for something less exotic.
Digi-Key, 1-800-344-4539 (http://www.digikey.com)
#
1
1
1
1
1
1
1
1
Part No.
AE1020-ND
ED1609-ND
ED4648-ND
MN13811-Q-ND
EG1403-ND
923252-ND
923292-ND
L20165-ND
*
*
*
Part Description
Male-Female DB-9 Cable (2m)
2 Position Terminal Block
48-Pin DIP WW Socket 3-Level
3.8V O.D. Low Voltage Detector
SPST Momentary Square Yellow Pushbutton
6.5" Solderless Breadboard w/Power Busses
54 Point Terminal Strip with Solder Tails
PC Board Mount Green LED With Holder
Sub Total
Unit
Price
5.35
0.37
5.49
0.85
0.98
19.25
9.65
0.67
Total
Price
5.35
0.37
5.49
0.85
0.98
19.25
9.65
0.67
$42.61
Part No.
1
1
1
1
1
2
1
1
74HC245
74HC373
MAX232CPE
68HC11A1P
68B21
27C64A-200
HM62256LP-10
16L8B
1
1
10
10
1
4
2
9
8.0MHZ
RPS7-4.7K
R10.0M
R330
100R16
10R63
22PF
T.1-35
DB09SRS
1
3
3
1
16 PIN WW
20 PIN WW
28 PIN WW
40 PIN WW
10
1
JUMPER-KT-10
HDR-40R
Part Description
Integrated Circuits
Octal Tri-State Transceiver
Octal Tri-State D Type Latch
+5V Powered Dual RS-232 Trans./Rcvr.
8-bit HCMOS MCU
2 PIA 2 MHz
8kx8 250ns EPROM
32kx8 100ns Static RAM
PAL 16L8B 15ns
*
*
*
*
*
*
Unit
Price
Total
Price
0.39
0.45
1.39
11.99
2.89
2.89
1.99
1.49
0.39
0.45
1.39
11.99
2.89
5.78
1.99
1.49
Discrete Components
8.0 MHz Crystal
4.7 k SIP 7 Resistor Network
10 M 1/4 W Resistor
330 1/4 W Resistor
100 F 16V Radial Electrolytic Capacitor
10 F 63V Radial Electrolytic Capacitor
22 pF Ceramic Capacitor
0.1 F Tantalum Capacitor
1.39
0.19
0.05
0.05
0.14
0.10
0.05
0.15
1.39
0.19
0.50
0.50
0.14
0.40
0.10
1.35
Connectors
Right Angle PC Mount Female DB-9 Connector
0.59
0.59
IC Sockets
16-Pin DIP WW Socket 3-Level
20-Pin DIP WW Socket 3-Level
28-Pin DIP WW Socket 3-Level
40-Pin DIP WW Socket 3-Level
0.79
1.09
1.49
1.69
0.79
3.27
4.47
1.69
0.99
0.89
0.99
0.89
$43.63
Unit
Price
2.79
3.49
7.49
Total
Price
2.79
3.49
7.49
$13.77
Headers
Shorting Jumper Block
1x40 Snappable Header with Right Angle Pins
Sub Total
Part No.
278-503
276-1396
276-1570
Part Description
50' 30-Gauge Blue Wrapping Wire
6"x8 IC-Spacing Perfboard
Wire-Wrapping Tool
Sub Total
3.2
Size
19182
Date
03/30/1994
/mon/buf34.zip
116221
03/02/1995
Comments
BUFFALO 3.4 monitor for the
HC11.
BUFFALO 3.4 monitor for the
HC11 with source code.
Size
18870
Date
03/30/1994
/ibm/as11new.exe
/mac/XASMHC11.MAC
19584
49024
03/30/1994
03/30/1994
Comments
Cross assembler for the
MC68HC11.
Improved version of as11.
This is as11 ported to the
Macintosh by Georgia Tech.
Use MacBinary to download
this application.
3.3
3.4
Construction
Now that the parts have arrived, it is time to assemble your computer. W e
will start by programming the boot EPROM and the chip select PAL. Following
will be a tutorial on wire-wrapping. Finally, we will lay out the components on
the board and do the actual wiring.
3.4.1
11
2.
**** test.as
RegBase equ
PORTA
equ
TCTL1
equ
TFLG2
equ
PACTL
equ
PIA_PRA equ
PIA_CRA equ
PIA_PRB equ
PIA_CRB equ
start
delay
loop
3.4.2
****
$1000
$00
$20
$25
$26
$A000
$A001
$A002
$A003
org
ldx
clr
clr
ldaa
staa
staa
ldaa
staa
staa
ldaa
staa
clr
ldab
clc
$E000
#RegBase
PIA_CRA
PIA_CRB
#$FF
PIA_PRA
PIA_PRB
#$04
PIA_CRA
PIA_CRB
#$80
PACTL,x
TCTL1,x
#$38
ldy
brclr
ldaa
staa
dey
bne
rolb
stab
stab
stab
bra
#7
TFLG2,x $80 loop
#$80
TFLG2,x
org
fdb
$FFFE
start
Initialize PIA.
loop
PORTA,x
PIA_PRA
PIA_PRB
delay
2.
3.
Load the resulting .s19 file into the EPROM programmer as before
specifying a base address of $E000.
4.
number of components by eliminating many discrete logic gates. The PAL can
provide much more complex designs than normally would be attempted with
discrete logic. Also, if the logic needs to change, a new chip can be programmed
replacing the old design.
Since all of the memory and I/O chips share the same data and address
busses, they need a way to know when they are being addressed. The PAL will
do this job by decoding the current value on the address bus and selecting t h e
appropriate chip. Additionally, the PAL gates the RAM and ROM chip select
signals with the E clock signal since the data bus isnt ready until E is high.
Also, the ROM chip selects are gated with the R/*W line so that the ROM is
only selected during a read cycle.
Programming the PAL
1. Using a text editor, type in the program shown in Listing 2 and save i t
in a text file.
Listing 2:
INPUT
INPUT
INPUT
INPUT
INPUT
INPUT
INPUT
INPUT
INPUT
GND
INPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
VCC
;
;
;
;
;
;
;
;
$0000
$8000
$A000
$A400
$A800
$AC00
$C000
$E000
$7FFF
$9FFF
$A3FF
$A7FF
$ABFF
$AFFF
$DFFF
$FFFF
13
Using an EPROM programmer, program the PAL using the JEDEC file.
3.4.3
Board Layout
The next step is to lay out the components on the board.
First place the sockets and discrete components on the perfboard. The scale
drawing in Appendix 2 offers a suggested layout. Keep in mind that the DIP
wire-wrap sockets have an indentation which marks pin 1 of the chip. The
indentation on the socket corresponds to the indentation on the chip itself.
Next label the underside of the board. This will prevent errors when you
are wiring the board. It can be very frustrating to finish wiring a project, only to
find out that youve wired the chips backwards. White adhesive correction
tape, which can be found at office supply stores, works good for this purpose.
Also, you can buy preprinted labels for wire-wrapping if you dont want to make
the labels yourself. For this project, Appendix 4 has some pre-printed labels
that you can cut out and glue to the board.
Now remove the discrete components and carefully turn the board over. Cut
out the labels in Appendix 4 and glue them underneath the appropriate sockets.
A knife and tweezers are helpful for placing the labels. Also, double check to
make sure you have the orientations correct.
3.4.4
If you shop around you will find that there are many varieties of wirewrapping tools available. Some tools will dispense, strip and cut the wire
automatically for you and some are also motorized to spin the wire for you. I
personally use a manual tool because it is inexpensive and yields very reliable
results.
Here is a step-by-step description of wire-wrapping:
15
To correct a mistake, you can spin the tool in the opposite direction which
removes the wire. Be careful though not to inadvertently unwrap any wires
underneath.
Here are some handy tips to follow when wire-wrapping:
There should be about 1 turn of insulation and about 4 turns of bare wire
wrapped around a post.
While spinning wires onto a post, be sure not to oppose the direction of wires
already tied there.
Try not to tie too many wires to a single post. Four connections to a single
post is about the limit while two connections is the average.
A nice straight connection usually works best. It may take a few trys to
thread the wire to its destination. Tweezers help for doing this.
Try not to force the tool when you are spinning it because the wire may
break and you will have to start over. With a little practice, you will find
that a light touch works best.
When wiring the discrete components, cut the leads to about 1/2 inch long.
Be careful not to twist and break the leads of a discrete component.
Do not solder the chip connections! Soldered wire-wrap connections are
impossible to remove if a mistake has to be corrected or if a repair is
needed. The wire-wrap connection alone is strong enough to last 10-20
years.
Do not cut the wire wrapping pins if you can help it. Again, corrections and
modifications are easier to make if you leave the posts intact.
17
3.4.5
1.
reliability. For now though, dont solder anything just in case you need to
make corrections.
2.
Wire the Internal Connections - The internal connections in this case are t h e
leads which are grounded or pulled high. The 74HC373, the PAL16L8, t h e
27C64s, the HM62256 and the MAX232 all have internal connections.
3.
Wire the Multiplexed Address/Data Bus - These are the lines labeled AD0
through AD7 which connect the MC68HC11 to the 74HC245 and 74HC373.
4.
Wire the Data Bus - These are the lines labeled D0 through D7. The Data
Bus connects the 74HC373 to the 27C64s the HM62256 and the MC68B21.
5.
Wire the Address Bus - These are the lines labeled A0 through A15. The
lines A0 through A7 originate with the 74HC373 and go to the 27C64s t h e
HM62256 and the MC68B21, while the lines A8 through A15 originate
with the MC68HC11 and go to the 27C64s the HM62256 and the PAL16L8.
19
6.
Wire the Control Bus - The signals in the control bus include *RESET, AS, E,
R/*W, *BOOT, *SPARE, *RAM and *PIA1.
7.
8.
Wire the Reset Circuit - Use a resistor in the 4.7k resistor pack for t h e
pull-up resistor. A bead of solder on each pin of the push-button will
mechanically secure it to the board. Be careful not to burn any of the wires.
9.
Wire the Crystal Connections - This includes wiring Y1, R2, C11 and C12 to
the MC68HC11.
10. Wire the J4 jumper - Cut off a 3x1 section of the header connector. Unbend
the right-angle pins so that they are straight. This will give us some extra
long pins to wire wrap to.
11. Wire the MAX232 - Wire the capacitors to the MAX232 and wire t h e
MAX232 to the micro.
12. Drill and Cut the Holes for the DB-9 Connector - Since the row of five pins
on the connector arent aligned with the perfboard, we need to cut a slot for
them. Also, drill out the two mounting holes.
13. Mount and Wire the DB-9 Connector - Connect the DCD, DSR, CTS and DTR
lines together. Also, prewire the TxD, RxD and GND lines with some wire
of an appropriate length. Now thread the three loose wires through t h e
perfboard, screw the DB-9 connector to the perfboard and wire the connector
to the MAX232.
21
14. Prepare the Wireless Breadboard - Cut off two small rectangles of the foam
backing of the wireless breadboard behind the top and bottom power strips.
Four metal strips should be exposed, two on the top and two on the bottom.
We will use these openings to wire power directly to the bread board. The
photograph in Step 15 shows the recommended orientation for the holes.
One thing to keep in mind is that the power strips on the breadboard are
actually divided in half. In other words, the strips dont connect all t h e
way across. An easy solution is to put small jumper wires in the top of t h e
board.
15. Mount the Breadboard and Terminal Strip - Drill all the mounting holes for
the solderless breadboard and the terminal strip. Also, drill and cut t h e
two holes for the power connections to the breadboard. Screw on t h e
breadboard and terminal strip.
16. Wire the Terminal Strip - The connections to the terminal strip are
arbitrary. A recommended series of signals to bring out is listed on the label
in Appendix 4.
17. Wire the Power Connections , Power Connector and LED - Use heavier
gauge wire for the power busses. Wire the power busses on the breadboard.
You might want to paint the power busses on the breadboard so that you
remember the polarity.
Wow! That was a lot of work! Now its time to test the computer out.
23
1.
Check for shorts in the power buss with a continuity meter. If you use an
ohmmeter to check for continuity, keep in mind that the filter capacitors
will charge up giving you a changing reading. Now hook up a +5 VDC
power supply to the computer. With no chips installed, power t h e
computer and check each socket for power with a voltmeter. Make certain
that you read +5 VDC at the correct polarity.
Vcc
330
PA7
PA6
PA5
PA4
PA3
2.
Turn off the power and plug in the MC68HC11, the Test ROM, the 74HC373,
the 74HC245 and the PAL16L8. The Test ROM should be plugged into t h e
Its time to perform a smoke test. A smoke test is simply a test where you
turn on the project and check for smoke. After you turn on the computer, feel
each chip to make sure that none are getting hot. This could indicate a
backwards power connection. Keep one hand on the power switch and be
ready to turn off the power at the first sign of trouble.
Now check the LEDs. Are they blinking? Is the program running? If not,
its time to do some troubleshooting.
Is the EPROM programmed properly?
Is the PAL programmed properly?
Is the crystal oscillator running? Check the E clock signal on an oscilloscope
and look for a 2 MHz square wave.
Is the Reset line high? Try pressing the Reset button and see if the program
starts running.
3.
Dont disconnect the LEDs yet. Turn off the computer and plug in t h e
MAX232 chip. Power up the computer again and perform another smoke
test. Make sure that the MAX232 is not getting hot. Using a voltmeter,
check pin 2 of the MAX232, it should be +10 VDC with respect to ground.
Now check pin 6, it should be -10 VDC with respect to ground. Also, make
certain that the test program is still running.
4.
For this step you need a serial terminal program for your personal computer.
Turn off the project, remove the Test ROM and plug the BUFFALO ROM in
its place (dont plug the ROM in backwards). Also, make certain that t h e
J4 jumper is grounded.
Hook up the computer to the serial port on your personal computer. Set t h e
serial terminal program to 9600 Baud, 8 Data Bits, No Parity, 1 Stop B i t
and No Handshaking.
25
Now power up the computer and perform another smoke test. Did you get a
BUFFALO prompt similar to the one below? Try hitting the Return key on
your personal computer.
BUFFALO 3.4 (ext) - Bit User Fast Friendly Aid to Logical Operation
5.
Turn off the computer and plug the Test ROM into the Extra ROM socket.
Turn the computer back on and perform another smoke test. Now from
BUFFALO type: go C000 [ENTER]. Are the LEDs blinking? To stop t h e
program press the Reset button. Now, try disassembling the test program.
Type: asm C000 [ENTER]. Hit [ENTER] to advance to the next line. To
exit the disassembler type: [Control-A].
6.
Turn off the computer and plug in the HM62256. Turn the computer on and
perform the smoke test as usual. Using the BUFFALO Block Fill command,
try to write to locations in the RAM. Type: bf 7000 7100 AA [ENTER].
Now type: md 7000 [ENTER]. Were you successful writing to the RAM?
Also, try running the test program. Is it still working?
Vcc
330
PPA7
PPA6
PPA5
PPA4
PPA3
PPA2
PPA1
PPA0
7.
Turn off the computer and plug in the MC68B21. Wire eight LEDs to t h e
PIA. Perform the usual smoke test. Run the test program. Are the LEDs
blinking?
Congratulations!
scratch.
27
5.1
Programming
When you are programming your computer, the most important thing to be
aware of is the memory map. The Chip Select PAL divides up the 64 k B
memory space among the external memory and peripherals while t h e
MC68HC11 handles the addressing of its internal devices. When there is an
address space conflict between the internal and external devices, the internal
devices have priority. In the memory map drawn below, you can see that t h e
internal RAM and Control Registers overlap the 32 kB of external RAM.
Boot ROM
E000-FFFF
10
Spare ROM
C000-DFFF
15
Internal EEPROM
B600-B7FF
20
PIA 2, A400-A7FF
PIA 1, A000-A3FF
WR IO, AC00-AFFF
RD IO, A800-ABFF
25
Extra ROM
PD2
PD3
PD4
PD5
PE0
PE1
PE2
PE3
VRL
VRH
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7
PIA2
D0
D1
D2
D3
D4
D5
D6
D7
8000-9FFF
30
35
Main RAM
0000-7FFF
40
45
Internal Registers
1000-103F
50
Internal RAM
0000-00FF
A0
A1
IRQ
XIRQ
RESET
R/*W
E
PPB0
PPB1
PPB2
PPB3
PPB4
PPB5
PPB6
PPB7
CB1
CB2
PPA0
PPA1
PPA2
PPA3
PPA4
PPA5
PPA6
PPA7
CA1
CA2
Use this memory map to plan the organization of any hardware and
software that you add to the computer.
The MC68HC11 has a large number of on-chip peripherals to take
advantage of. The MC68HC11 data book describes how to program the on-chip
peripherals.
5.1.1
Using BUFFALO
The BUFFALO monitor program will allow you to do most of your program
development. In BUFFALO you can view and modify memory and registers,
assemble and disassemble programs, and perform advanced debugging. The
most important feature of BUFFALO is its Load command. It allows you to
download Motorola Hex (.s19) files to the computers RAM through the serial
port. Here is a procedure for using BUFFALO in your program development:
1.
2.
5.1.2
5.2
Interfacing
In order to keep the design practical certain built-in resources of the MC68HC11
arent available on our computer. For example, in this design the pins PD0 and
PD1 are used for the serial port and as a result arent readily available for use
as digital I/O. Also, since the BUFFALO monitor program uses PE0 as an input
29
for the J4 jumper, PE0 shouldnt be used for other purposes. Additionally, lines
PE4 through PE7 of Port E arent pinned out on the MC68HC11A1P version used
in this design. This is because the DIP (Dual Inline Package) version of t h e
MC68HC11A1 used here doesnt have enough pins to accommodate all of Port E.
The pins PE4 through PE7 are only available on the PLCC (Plastic Leaded
Chip Carrier) version. The PLCC version wasnt used for this project because i t
would have been harder to wire by hand. Finally, Port B, Port C, STRA and
STRB are unavailable because we are operating the MC68HC11 in expanded
mode as opposed to single chip mode. Expanded mode is what allows us to
connect external memory like the HM62256 RAM chip and the 27C64 EPROM
chip to the microprocessor.
Despite these limitations, expanded mode allows us to add as much I/O to
the computer as we require, albeit with a few extra chips required. In this
design, the MC68B21 chip augments the available digital I/O. The following
sections will describe how to use the MC68B21 and how add even more digital
I/O to the design.
5.2.1
Vcc
MC68B21
D7
D6
D5
D4
D3
D2
D1
D0
CA2
CA1
PPA7
PPA6
PPA5
PPA4
PPA3
PPA2
PPA1
PPA0
26
D7
27
D6
28
D5
29
D4
30
D3
31
D2
32
D1
33
D0
24
CS1
22
CS0
35
RS1
36
RS0
23
*CS2
25
E
21
R/*W
34
*RESET
A1
A0
*PIA1 ($A000)
E
R/*W
*RESET
39
CA2
40
CA1
19
CB2
18
CB1
CB2
CB1
9
PA7
8
PA6
7
PA5
6
PA4
5
PA3
4
PA2
3
PA1
2
PA0
17
PB7
16
PB6
15
PB5
14
PB4
13
PB3
12
PB2
11
PB1
10
PB0
PPB7
PPB6
PPB5
PPB4
PPB3
PPB2
PPB1
PPB0
Internally, the MC6821 has six registers for operating the chip, three
registers for Port A and three registers for Port B. When RS1=0 the Port A
register set is selected and when RS1=1 the Port B registers are selected. When
RS0=1 the Control Register for the given port is selected. When RS0=0 t h e
register that is accessed depends on bit 2, the DDR Access Bit, of the Control
Register. If the DDR Access Bit is 0, the Data Direction Register is selected. I f
the DDR Access Bit is 1, the Peripheral I/O Register is selected.
The MC6821 Control Register
b7
IRQ A(B) 1
Flag
b6
IRQ A(B) 2
Flag
b5
b4
CA2 (CB2)
Control
b3
b2
DDR
Access
b1
b0
CA1 (CB1)
Control
The Data Direction Register for each port allows any of the lines on a port
to be configured as inputs or outputs. A zero bit will configure a line as an input
while a one bit will configure the line as an output. Similarly, the Peripheral
I/O Register allows you to read from and write to the I/O ports.
A simple procedure for programming a port on the MC6821 is to:
1.
2.
3.
4.
This procedure applies for both Port A and Port B. Once you have
programmed the Data Direction Register, you probably will want to leave t h e
DDR Access Bit set to 1 for the rest of the program.
Here is a code snippet which demonstrates how to program the MC6821:
clr
clr
ldaa
staa
ldaa
staa
ldaa
staa
staa
ldaa
staa
ldaa
$A001
$A003
#FF
$A000
#0F
$A002
#04
$A001
$A003
#FF
$A000
$A002
Check the MC6821 data sheet to find out how to use its more advanced
features.
Data Bus
D7
D6
Control Bus
5.2.2
D5
D4
D3
D2
D1
D0
*RDIO ($A800)
74HC244
3
2Y4 2A4
5
2Y3 2A3
7
2Y2 2A2
9
2Y1 2A1
12
1Y4 1A4
14
1Y3 1A3
16
1Y2 1A2
18
1Y1 1A1
19
1
*2G
*1G
17
15
13
11
8
6
4
2
In7
In6
In5
In4
In3
In2
In1
In0
Vcc - Pin 20
Gnd - Pin 10
To read the current state of the input lines simply perform a read from t h e
address $A800. The following line of assembly language will read the values
of the eight input lines into the A register:
ldaa $A800
This circuit can apply to other type of digital input that you would want to
connect to the computer, such as an analog-to-digital converter.
31
5.2.3
Control Bus
Data Bus
D7
D6
D5
D4
D3
D2
D1
D0
*RESET
*WRIO
74HC273
18
8D
8Q
17
7D
7Q
14
6D
6Q
13
5D
5Q
8
4D
4Q
7
3D
3Q
4
2D
2Q
3
1D
1Q
1
11
19
16
15
12
Out7
Out6
Out5
Out4
9
6
5
2
Out3
Out2
Out1
Out0
Vcc - Pin 20
*CLR
CLK
Gnd - Pin 10
A simple write to the address $AC00 will change the states of the outputs.
The following two lines of assembly language show how to do this:
ldaa #AA
staa $AC00
You can of course use this circuit as an example for connecting other types of
output devices to the computer.
D4
D3
D2
D1
D0
26
27
28
29
30
D7
D6
D5
D4
D3
31
D2
32
D1
33
D0
39
40
CA2
CA1
9
PA7
8
PA6
7
PA5
6
PA4
5
PA3
4
PA2
3
PA1
2
PA0
24
CS1
22
CS0
35
RS1
36
RS0
23
*CS2
25
E
21
R/*W
34
*RESET
19
CB2
18
CB1
PB7
PB6
PB5
PB4
PB3
A1
A0
Control Bus
Vcc
MC68B21
D7
D6
D5
Address Bus
Data Bus
5.2.4
*PIA2 ($A400)
E
R/*W
*RESET
Vcc - Pin 20
Gnd - Pin 1
17
16
15
14
13
12
PB2
11
PB1
10
PB0
Now you have two extra bi-directional ports to work with. Similarly, you
can add as many PIAs to the computer as you need, keeping in mind that there
are only a finite number of unused address locations available.
Conclusion
I hope this was a great learning experience for you. When I built my first
computer it was pretty frustrating. Part of the frustration was due to t h e
complexity of the computer and part was due to errors in the instructions. I hope
that Ive at least eliminated those two variables for you. Nonetheless, after a
lot of struggling I was able to get the computer working and learned a lot in t h e
process.
Im sure you will get much use out of your new computer and I know there
will be more home-built computers in your future. Just think, ten years from now
you will look back fondly to this experience.
33
References
[1]
[2]
Farmer, Brian. Planting Geraniums by Robot/Build an MC68HC11based 2-D Sensor. Circuit Cellar INK 29 (1992): 12-21.
[3]
[4]
[5]
[6]
[7]
[8]
Swiger, Frank and Joe Glover. The FS-100 MC68HC11-Based SingleBoard Computer. Circuit Cellar INK 24 (1991): 52-59.
U1
U2
U3
U4
U5
U6, U7
U8
U9
U10
1
1
1
1
1
4
2
9
Y1
RP1
R1
R2
C1
C13-C16
C11, C12
C2-C9
Part No.
MC68HC11A1P
MC68B21
74HC373
74HC245
16L8B
27C64-250
HM62256LP-10
MAX232CPE
MN13811-Q
Manufacturer
Motorola
Motorola
123-93-648-41-001
Mill-Max
5381H5
520-01-2
ED1609
276-1396
923252
923292
AK131-2
Assmann
1
1
1
Maxim
Panasonic
J4
J4
1
3
3
1
1
1
1
1
1
1
1
Part Description
8-bit HCMOS MCU
PIA 2 MHz
Octal Tri-State D Type Latch
Octal Tri-State Transceiver
PAL 16L8B 15ns
8kx8 250ns EPROM
32kx8 250ns Static RAM
+5V Powered Dual RS-232 Trans./Rcvr.
3.8V O.D. Low Voltage Detector
LED1
35
C14
C13
+
+
(EEPROM)
J4
(BUFFALO)
(U9)
MAX232
C2
C15
C16
5
RP1
C11
(U5)
PAL16L8B
RESET
10
+
C3
C12
R2
Y1
U10
15
(U1)
MC68HC11
C4
20
C10
(U4)
74HC245
25
+
C6
(U3)
74HC373
+
C5
(U8)
HM62256-LP15
30
+
C7
35
(U6)
27C64-250
40
+
C8
(U7)
27C64-250
45
50
+
C9
(U2)
MC68B21
R1
C1
LED1
Vcc
(RP1)
4.7 k
(U1)
(U3)
MC68HC11A1P
25
MODA(*LIR)
PB7
24
MODB(Vstby)
PB6
PB5
41
PB4
*IRQ
40
*XIRQ
PB3
VRH
VRL
PE3
PE2
PE1
J4
PE0
PD5
PD4
PD3
PD2
PD1
PD0
PA7
PA6
PA5
PA4
PA3
PA2
PA1
PA0
20
PE3/AN3
19
PE2/AN2
18
PE1/AN1
17
PE0/AN0
74HC373
AD7 1 8
8D
8Q
AD6 1 7
7D
7Q
AD5 1 4
6D
6Q
AD4 1 3
5D
5Q
AD3 8
4D
4Q
AD2 7
3D
3Q
AD1 4
2D
2Q
AD0 3
1D
1Q
A15
A14
A13
A12
A11
A10
A9
13
14
PB2
15
PB1
16
PB0
22
VRH
21
VRL
47
46
45
44
43
9
10
11
12
A8
PD5/*SS
PD4/SCK
1
PA7/PAI/OC1
2
PA6/OC2/OC1
3
PA5/OC3/OC1
4
PA4/OC4/OC1
5
PA3/OC5/OC1
6
PA2/IC1
7
PA1/IC2
8
PA0/IC3
A7
A6
A5
A4
A3
A2
A1
1
27
A0
1
*OE
*CE
AD7
AD7
AD6
AD5
AD4
AD3
AD2
AD6
AD5
AD4
AD3
AD2
AD1
AD0
AD1
AD0
19
*EN
11
B8
12
B7
13
B6
14
B5
15
B4
16
B3
17
B2
18
B1
1
A-B
9
A8
8
A7
7
A6
6
A5
5
A4
4
A3
3
A2
2
A1
D7
D7
D6
D5
D4
D3
D2
D6
D5
D4
D3
D2
D1
D0
D1
D0
74HC245
(U4)
19
O7
18
O6
17
O5
16
O4
15
O3
13
O2
12
O1
11
O0
1
27
Vpp
*PGM
22
*OE
*CE
Vcc
3
123
(C12)
22 pF
Vcc
GND
U1
U2
U3
U4
U5
MC68HC11A1P
MC68B21
74HC373
74HC245
PAL16L8-12
48
20
20
20
20
23
1
10
10
10
U6,U7
U8
U9
27C64-250
HM6264-LP15
MAX232CPE
28
28
16
14
14
15
(U9)
MAX232CPE
10
PD0
11
TxD
RxD
14
12
13
D5
D4
D3
D2
D1
D0
D7
D6
D5
D4
D3
8 CTS
DTR
D2
D1
D0
CA2
1
(C14)
3
10F
2
(C13)
10F
C1+
C2+
C1-
C2-
V+
V-
CA1
(C15)
11
9
E
R/*W
*BOOT ($E000)
20
*SPARE ($C000)
20
19
I/O7
18
I/O6
17
I/O5
16
I/O4
15
I/O3
13
I/O2
12
I/O1
11
I/O0
*OE
1
A14
2 6 A13
A13
2
A12
A12
2 3 A11
A11
2 1 A10
A10
A9
24
A9
A8
25
A8
A7
3
A7
A6
4
A6
A5
5
A5
6
A4
A4
A3
7
A3
A2
8
A2
A1
9
A1
A0
10
A0
A14
R/*W
*CE
27
20
(U2)
MC68B21
DCD
6 DSR
D7
D6
22
PPA7
PPA6
PPA5
10F
PPA4
PPA3
PPA2
PPA1
PPA0
(C16)
10F
Vcc
26
D7
27
D6
28
D5
29
D4
30
D3
31
D2
32
D1
33
D0
39
CA2
40
CA1
9
8
7
6
5
PA7
PA6
PA5
PA4
PA3
4
PA2
3
PA1
2
PA0
(R1)
330
100F
(LED1)
(C2)
(C9)
0.1F
0.1F
A1
A0
*PIA1 ($A000)
E
R/*W
*RESET
19
CB2
18
CB1
CB2
17
PB7
16
PB6
15
PB5
14
PB4
13
PB3
12
PB2
11
PB1
10
PB0
PPB7
PPB6
PPB5
Vcc
(C1)
R/*W
*RAM ($0000)
Vcc
24
CS1
22
CS0
35
RS1
36
RS0
23
*CS2
25
E
21
R/*W
34
*RESET
Input/Output Bus
+5 VDC
Control Bus
(U8)
HM62256-LP15
(Bottom)
PD1
29
(U10)
MN13811-Q
1
2
LVI
(C11)
22 pF
I
I
*RDIO
*PIA2
*PIA1
*EXTRA
*RAM
*RESET
EXTAL
(R2) 10 M
1 9 *BOOT
1 8 *SPARE
1 7 *WRIO
16
15
14
13
I/O 1 2
O
7
8
A3
A2
A1
A0
39
RESET
XTAL
A14
A13
A12
A11
A10
(U5)
PAL16L8-12
1
I
O
2
I
I/O
3
I
I/O
4
I
I/O
5
I
I/O
6
I
I/O
2
A12
A12
2 3 A11
A11
2 1 A10
A10
24
A9
A9
25
A8
A8
3
A7
A7
4
A6
A6
5
A5
A5
A4
6
A4
7
A3
A3
8
A2
A2
9
A1
A1
10
A0
A0
Vcc
(RP1)
4.7 k
30
A9
A8
A7
A6
A5
A4
A15
(U7)
27C64-250
Vcc
*RESET
24
25
3
4
5
6
7
8
A2
9
A1
10
A0
Vpp
*PGM
22
2
A12
2 3 A11
2 1 A10
E
R/*W
38
PC7
37
PC6
36
PC5
35
PB4
34
PC3
33
PC2
32
PC1
31
PC0
PD3/MOSI
PD2/MISO
PD1/TxD
42
PD0/RxD
9
6
5
2
*OE
C
11
26
AS
27
E
28
R/*W
19
16
15
12
Vcc
(U6)
27C64-250
19
A12
O7
18
D6
A11
O6
17
D5
A10
O5
D4
16
A9
O4
D3
15
A8
O3
D2
13
A7
O2
12
D1
A6
O1
11
D0
A5
O0
A4
Vcc
A3
D7
CB1
PPB4
PPB3
PPB2
PPB1
PPB0
37
CA2
CA1
PPA7
PPA6
5
25
PPA5
50
PPA4
48
PPA3
PPA2
MC68HC11A1P
PPA1
24
10
PPA0
45
CB2
CB1
21
PPB7
40
PPB6
MC68B21
15
PPB5
40
PPB4
20
PPB3
PPB2
PPB1
15
28
20
PPB0
35
E
R/*W
HM62256
RESET
14
XIRQ
1
25
IRQ
30
A1
A0
28
27C64
14
15
28
HEADER
15
27C64
D7
D6
14
30
D5
25
D4
D3
11
D2
20
PAL16L8
10
D1
1
35
D0
20
PIA2
11
74HC373
10
20
PA7
PA6
PA5
40
11
74HC245
10
PA4
20
PA3
PA2
15
PA1
PA0
9
8
MAX232
16
45
VRH
10
VRL
PE3
PE2
PE1
GND
50
PE0
PD5
+5V
PD4
PD3
PD2