Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Build your own MC68HC11 computer trainer (G.C. Yerem).pdf
Скачиваний:
107
Добавлен:
12.08.2013
Размер:
1.28 Mб
Скачать

2 Yerem: Build Your Own MC68HC11 Computer Trainer

2 The Structure of a Small Computer System

The purpose of a computer is to act out a series of directions given by a person, ultimately performing some physical action. This goal starts with numbers. Numbers, as it turns out, can represent any type of information. Since computers manipulate numbers, computers also manipulate representations of information. The form of numbers that electronic computers use are groups of binary digits or bits. Bits are simply numerical digits which only have two states, 0 and 1. This is just like a digit in our decimal system which has ten states, 0 through 9, one state for each finger on our two hands. So you might say that by using the binary system, a computer probably has only one finger on each of its hands! A consequence of bits having fewer states than decimal digits is that you need more binary digits to represent the same number in the decimal system. Nonetheless, both number systems can each represent every possible number. Ultimately, electronic computers use binary digits because by only having two states it has a minimal chance of confusing one state with the other and that provides a maximum level of reliability.

A computer uses its electronic versions of numbers to perform its purpose; acting out a series of directions given by a person. Since numbers can represent anything, we can use numbers to represent the instructions that we want the computer to follow as well as raw information and even some physical actions like turning on an indicator light, sending messages to a teletype or making a sound.

The microprocessor chip contains all of the electronics needed to perform a majority if not all of the actions of a computer system. Usually though, a certain amount of the resources of a computer are too expensive or impractical to squeeze onto one integrated circuit chip. The most notable of these resources is memory. Memory is the single most expensive element of a computer system. Memory gives the computer a place to store numbers. The more memory a computer has, the more numbers it can store. Computer memory typically stores raw data and programs.

If a microprocessor is going to work with external memory it needs external signals to control the memory. These signals can be broken into three parts: an address bus, a data bus and a control bus.

The address bus is a series of digital signal lines which can send out a binary number which in turn represents a single location in the computer’s memory space. Since the address bus can only represent a finite amount of unique numbers, there can only be a finite number of memory locations in a computer system.

Once you have a place to store numbers, you need a way access them. That’s where the data bus comes in. Just like the address bus, the data bus is a series of digital signal lines which can send and receive numbers. In this case, the numbers represents raw data, physical actions or a program.

Finally, the control bus uses its digital signals to keep the address and data busses of the microprocessor synchronized with the external components.

3

2.1The 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

 

2 5

 

MODA(*LIR)

PB7

 

9

2 4

 

 

1 0

 

MODB(Vstby)

PB6

 

 

 

 

 

1 1

4 1

 

 

 

PB5

 

1 2

4 0

 

 

*IRQ

PB4

 

1 3

 

 

 

*XIRQ

PB3

 

 

 

 

 

1 4

 

 

 

 

PB2

 

 

2 2

 

VRH

 

1 5

 

PB1

 

2 1

 

 

1 6

 

VRL

PB0

 

2 0

 

PE3/AN3

 

 

 

1 9

 

 

 

 

1 8

 

PE2/AN2

 

 

2 6

 

PE1/AN1

AS

1 7

 

2 7

 

PE0/AN0

E

 

 

 

 

 

2 8

4 7

 

PD5/*SS

R/*W

 

 

 

 

 

 

 

 

 

 

 

4 6

 

 

 

 

 

 

 

PD4/SCK

 

 

 

4 5

 

PC7

 

3 8

 

PD3/MOSI

 

4 4

 

 

3 7

 

PD2/MISO

PC6

 

4 3

 

 

3 6

4 2

 

PD1/TxD

PC5

 

3 5

 

 

 

PD0/RxD

PB4

 

3 4

1

 

PA7/PAI/OC1

PC3

 

3 3

 

PC2

 

2

 

 

3 2

3

 

PA6/OC2/OC1

PC1

 

3 1

4

 

PA5/OC3/OC1

PC0

 

 

5

 

PA4/OC4/OC1

 

 

 

 

 

 

PA3/OC5/OC1

 

 

 

6

 

 

 

 

 

 

 

 

 

7PA2/IC1

8PA1/IC2

PA0/IC3

 

 

*RESET

3 9

XTAL

EXTAL

 

 

 

 

 

 

 

3 0

 

 

2 9

 

 

 

 

 

 

 

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 computer’s design using sections taken from the main schematic diagram. The complete schematic diagram can be found in Appendix 3.

Address Bus (A0:A15)

 

 

 

 

 

(U3)

 

 

 

 

 

 

 

 

74HC373

 

 

 

PB7

9

A15

AD7

1 8

8D

8Q 1

9

A7

 

1 0

A14

AD6

1 7

 

 

1

6

A6

PB6

1 1

A13

AD5

1 4

7D

7Q 1

5

A5

PB5

1 2

A12

AD4

1 3

6D

6Q 1

2

A4

PB4

1 3

A11

AD3

8 5D

5Q 9

 

A3

PB3

1 4

A10

AD2

7

4D

4Q

 

A2

 

 

 

6

 

PB2

1 5

A9

AD1

4 3D

3Q 5

 

A1

PB1

1 6

A8

AD0

3 2D

2Q 2

 

A0

PB0

 

 

 

 

1D

1Q

 

 

 

 

 

 

 

 

*OE

 

1

 

 

 

 

 

 

C

 

 

 

 

 

 

 

 

 

 

 

 

AS

2 6

 

 

 

1 1

 

 

 

 

E

2 7

 

 

 

 

 

 

 

 

2 8

 

 

 

 

 

 

 

 

R/*W

 

 

 

 

1 9

1

 

 

 

 

 

 

 

 

*EN

A-B

 

 

 

PC7

3 8

AD7

AD7

1 1

B8

A8

9

 

D7

PC6

3 7

AD6

AD6

1 2

B7

A7

8

 

D6

3 6

AD5

AD5

1 3

7

 

D5

PC5

3 5

AD4

AD4

1 4

B6

A6

6

 

D4

PB4

3 4

AD3

AD3

1 5

B5

A5

5

 

D3

PC3

B4

A4

 

3 3

AD2

AD2

1 6

4

 

D2

PC2

3 2

AD1

AD1

1 7

B3

A3

3

 

D1

PC1

3 1

AD0

AD0

1 8

B2

A2

2

 

D0

PC0

 

 

 

 

B1

A1

 

 

 

 

 

 

 

 

74HC245

 

 

 

 

 

 

 

 

(U4)

 

 

 

1.This is the address/data demultiplexer circuit. It separates the one address/data bus into distinct address and data busses. Multiplexing the address and data bus saves 8 pins which can be dedicated to other resources at the expense of requiring an external demultiplexing circuit.

(U5)

 

 

PAL16L8-12

 

 

A15

1

I

O

19

*BOOT

A14

2

18

*SPARE

I

I/O

A13

3

17

*WRIO

I

I/O

A12

4

16

*RDIO

I

I/O

A11

5

15

*PIA2

I

I/O

A10

6

14

*PIA1

I

I/O

 

 

13

*EXTRA

 

 

 

 

 

 

 

I/O

12

*RAM

 

 

 

O

 

 

 

 

 

 

7

I

I 11

E

 

8

 

 

9

R/*W

II

2.This is the Chip Select PAL. Its job is to decode the address space and select the appropriate memory chip. Its inputs are the address lines as well as the E and R/*W lines. Its outputs are the various chip select signals.

4 Yerem: Build Your Own MC68HC11 Computer Trainer

Vcc

(RP1)

4.7 kΩ

(U1)

MC68HC11

2 5

2 4 MODA(*LIR) MODB(Vstby)

3.These are the mode pins. These two pins allow you to configure the MC68HC11 to run in one of four modes. Pulling both pins high, as in this case, puts the microprocessor in Expanded Mode.

Vcc

J4 PE0

4.This is the “J4” jumper. The BUFFALO monitor program uses this jumper to determine whether or not to jump to the internal EEPROM or run the BUFFALO monitor at startup.

XTAL

EXTAL

Vcc

 

30

 

29

(RP1)

(R2) 10 MΩ

 

 

4.7 kΩ

 

 

 

(Y1) 8.0 MHz

 

 

 

 

(U10)

 

 

RESET

MN13811-Q

(C11)

(C12)

1

2

LVI

Vcc

22 pF

22 pF

3

 

 

 

 

5.This is the oscillator circuit. It provides the “heartbeat” for the microprocessor. The oscillator generates an 8 MHz square wave which is divided internally by a factor of four to supply a 2 MHz clock pulse to the microprocessor.

6.This is the reset circuit. Pressing the Reset button will cause the computer to stop what it is doing and start from scratch. The LVI (Low Voltage Interrupt) chip can also assert the Reset line if the power supply voltage drops below 4 V. This prevents the microprocessor from running before the power reaches a meaningful level.

(U6)

27C64-250

D7

19

O7

D6

18

O6

D5

17

D4

16

O5

D3

15

O4

O3

D2

13

D1

12

O2

D0

11

O1

 

 

O0

Vcc

 

 

1

Vpp

 

27

 

*PGM

 

22

 

*OE

 

 

A12

2

A12

 

 

 

23

A11

A11

 

 

21

A10

 

A10

 

 

 

24

A9

A9

 

 

 

25

A8

A8

 

 

 

3

A7

A7

 

 

 

4

A6

A6

 

 

 

5

A5

A5

 

 

 

6

A4

A4

 

 

 

7

A3

A3

 

 

 

A2

8

A2

 

 

 

9

A1

A1

 

 

 

10

A0

A0

 

 

 

20

 

 

*CE

 

 

 

 

 

 

 

 

 

7.This is one of the two EPROMs (Erasable Programmable Read Only Memory). The computer uses this memory chip to store programs and data semi-permanently. In other words, the information stored here can only be erased by shining an ultraviolet light into the glass window on the chip.

 

 

 

 

 

 

 

 

 

(U8)

 

 

 

 

 

 

 

 

 

 

 

 

HM62256-LP15

 

 

 

 

(D0:D7)

 

D4

1 6

I/O4

A11

2 3

A11

BusAddress

 

 

D7

1 9

I/O7

A14

1

A14

 

 

 

D6

1 8

I/O6

A13

2 6 A13

 

 

 

D5

1 7

2

A12

 

 

 

 

 

 

 

 

 

I/O5

A12

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DataBus

 

D3

1 5

I/O1

A8

2 1 A10

(A0:A15)

 

D0

1 1

3

A7

 

 

D2

1 3

I/O3

A10

2 4

A9

 

 

 

D1

1 2

I/O2

A9

2 5

A8

 

 

 

 

 

 

 

 

 

I/O0

A7

 

 

 

 

 

 

 

 

 

 

 

 

4

A6

 

 

 

 

 

 

 

 

 

 

A6

 

 

 

 

 

 

 

 

 

 

 

 

 

5

A5

 

 

 

 

 

 

 

 

 

 

A5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A4

6

A4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A3

7

A3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8

A2

 

 

 

 

 

 

 

 

 

 

A2

 

 

 

 

 

 

 

 

 

 

 

 

 

9

A1

 

 

 

 

 

 

 

 

 

 

A1

 

 

 

 

 

 

 

 

 

 

 

 

 

1 0

A0

 

 

 

 

 

 

 

 

 

 

A0

 

 

 

 

 

2 2

 

 

2 7

 

 

 

 

 

 

 

 

*OE

R/*W

 

 

 

 

 

 

 

 

 

 

 

 

*CE

2 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8.This is the RAM (Random Access Memory) chip. While the MC68HC11 has 256 bytes of RAM internally, this usually is not enough for software development. The HM62256 provides the computer with an additional 32 kB of R/W memory.

5

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)

Vcc

 

 

 

(U9)

 

 

1

DCD

 

 

MC68B21

 

 

MAX232CPE

 

 

 

 

 

 

 

 

 

 

 

 

 

6 DSR

 

 

 

 

 

 

 

 

 

 

 

 

 

D7

2 6

D7

CS1 2 4

 

PD1

1 0

 

T

7

TxD

2

 

D6

2 7

 

2 2

 

 

 

 

 

 

 

7

D5

2 8

D6

CS0

3 5

A1

PD0

9

 

R

8

RxD

3

 

 

 

 

 

 

 

 

 

 

D4

2 9

D5

RS1 3 6

A0

 

1 1

 

 

1 4

 

4

8 CTS

D3

3 0

D4

RS0

2 3

*PIA1 ($A000)

 

 

T

 

DTR

 

*CS2

 

 

 

 

 

 

9

 

 

 

 

 

 

 

 

D2 3 1 D3

 

 

 

 

 

 

 

 

 

 

E 2 5

E

 

1 2

 

R

1 3

 

5

 

D1

3 2

D2

 

2 1

R/*W

 

 

 

 

 

 

 

 

D0

3 3

D1

R/*W

3 4

*RESET

 

1

 

 

4

 

 

 

 

 

D0

*RESET

 

 

(C14)

C1+

C2+

(C15)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CA2

3 9

CA2

CB2 1 9

CB2

10µF

3

C1-

C2-

5

10µF

 

 

CA1

4 0

CA1

CB1 1 8

CB1

 

2

V+

V-

6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PPA7

9

PA7

PB7

1 7

PPB7

(C13)

 

 

 

 

(C16)

 

 

PPA6

8

1 6

PPB6

10µF

 

 

 

 

10µF

 

 

PPA5

7

PA6

PB6

1 5

PPB5

 

 

 

 

 

 

 

 

PA5

PB5

 

Vcc

 

 

 

 

 

 

PPA4

6

PA4

PB4

1 4

PPB4

 

 

 

 

 

 

 

 

PPA3

5

PA3

PB3

1 3

PPB3

 

 

 

 

 

 

 

 

PPA2

4

1 2

PPB2

 

 

 

 

 

 

 

 

PPA1

3

PA2

PB2

1 1

PPB1

 

 

 

 

 

 

 

 

PPA0

2

PA1

PB1

1 0

PPB0

 

 

 

 

 

 

 

 

PA0

PB0

 

 

 

 

 

 

 

 

9.This is the PIA (Peripheral Interface Adapter) chip. Since we are using the MC68HC11 in expanded mode, I/O ports B and C are unavailable for our use. The MC6821 will give us two bi-directional 8-bit I/O ports to work with.

10.This is the RS-232 circuit. The MAX232 provides the interface between the serial port on the MC68HC11 and the DB-9 connector. This buffer chip is required because RS-232 requires relatively high voltages (about ±12 V). Additionally, the MAX232 has a charge pump circuit which uses four capacitors to generate ±10 VDC from the 5V supply. This way the whole computer can run from a single 5V supply.

Additionally, the computer requires a +5 VDC @ 0.3 A power supply. For this project, you can either purchase one or build a simple one from scratch.

Keep in mind that this design isn’t inscribed in stone. Feel free to modify the computer in any way you see fit. You can learn a great deal by customizing the computer.