This is only a preview of the November 1992 issue of Silicon Chip. You can view 52 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "A 2kW 24VDC To 240VAC Sinewave Inverter; Pt.2":
Articles in this series:
Items relevant to "An Automatic Nicad Battery Discharger":
Articles in this series:
Articles in this series:
Articles in this series:
|
MAL-4: Microcontroller
Aid for Learning
Here is a microcontroller design which can be used
to learn programming and computer c~ntrol. It
features the Motorola 68HC705CB microcontroller
and has serial and parallel ports. You can program
it via its own hexadecimal keyboard or via a
standard IBM computer keyboard.
34
SILICON
CHIP
By Barry Rozema
A
single chip microcomputer, as
the name implies, is a microcomputer in a single chip package. This means that all the building
blocks of the microcomputer are in
the one integrated circuit. The building blocks for most computers are the
central processing unit (CPU), memory
(RAM & ROM), parallel and serial input/output (I/0) ports, address decoding, clock, interrupt timer and watchdog timer.
Single chip microcomputers or
microcontrollers have found a very
important niche in the computer industry. Due to their size and low cost,
they are very effective when used for
control applications such as in washing machines, microwave ovens, VCRs
and burglar alarms.
The microcontroller used in this
project is the Motorola MC68HC705C8. It is an 8 bit microcontroller
with a user programmable EPROM inst~ad of mask programmable ROM.
This makes prototyping and development a reasonably easy task.
Why use the MC68HC705C8? The
main reasons were cost and availability plus the fact that I like Motorola's
"easy to understand" data sheets and
manuals.
And why design and build a single
chip microcontroller learning aid? I
realised when I first started programming the 68 705 that it would be handy
to run some small test programs to
familiarise myself with the devicA.
After some enquiries, I discovered that
there are some development tools for
the 68705 but the prices were out of
my league. So the idea of designing a
cheap single chip learning aid was
born.
Main Features
• Processor - Motorola MC68HC705C8S.
• Clock speed - 2MHz/2 (1 MHz internal clock).
• Display - 2-l ine by 16-character alphanumeric LCD.
• Keyboard - Hex keypad with option for different types.
• Power supply - either 9V AC or 12V DC.
• Monitor - resides in EPROM (5Kb) and includes disassembler.
• Two modes - MAL-4 or single chip monitor mode.
• Emulates the Motorola M68HC05PGMR programming board.
• Battery backup of RAM.
• Ports:
A - 8-bit input port with 8-way DIP switch.
B - 8-bit outpuVinput port with 8 LEDS.
C - 8-bit control port with 8 LEDS.
D - 7-bit input only port with 8-way DIP switch or asynchronous
(RS232) and synchronous (IBM keyboard) .
• Ease of construction
• Stand alon e operation
• Possible u se as a controller
The MC68HC 70 5C8S microc ontroller is a recent addition to th e
Motorola 6805 family and is similar
to the 68 705P3 processor featured in
the Sprinkler Controller published in
the July 1992 issue and the Burglar
Alarm publish ed in th e September &
October 1992 issues of SILICON CHIP.
The " HC " des ign ation of the
68HC705C8 signifies that it is a high
speed CMOS version (ie, high speed,
low power). It is one of m any versions
of this chip so that once you have
learnt h ow to program it , you w ill
have no trouble with the other versions and indeed you will have a good
grounding in programming any microprocessor.
Block diagram
The block diagram of Fig.1 shows
MAL-4
Entitled "Microcontroller Aid for
Learning, Version 4.03" or MAL-4, for
short, this project is the fourth in a
series which have been designed primarily as a learning tool for TAFE
colleges. I paid close attention to the
following points:
• Low cost
• Current processor technology
• Simple design
The MAL-4 uses a 2-line alphanumeric readout which plugs into a socket on the
PC board. It is an intelligent unit which accepts ASCII code.
NOVEMBER
1992
35
TABLE 1: MAL-4 MEMORY MAP
Input/Output
32 Bytes·
$00
Port A Data Register
$01
Port B Data Register
$0020 - $002F
Unused 16 Bytes
$02
Port C Data Register
M.A.L. Zero Page Ram
144 Bytes
$03
Port D Input Register
$0030 - $00BF
$04
Port A Data Direction Register
$00C0 - $00DF
M.A.L. Scratch Pad
32 Bytes
$05
Port B Data Direction Register
$06
Port C Data Direction Register
$00E0 - $GOFF
System Stack
32 Bytes
$07
Unused
$08
Unused
$0100 - $01 5F
M.A.L. Page 1 RAM
96 Bytes
$0000 - $001 F
Unused
Serial Peripheral Control Register
$0B
Serial Peripheral Status Register
$0160 - $12FF
M.A.L. Monitor EPROM
4512 Bytes
$1300 - $1 EFF
Spare User EPROM
3072 Bytes
$DC
Serial Peripheral Data 1/0 Register
$OD
Serial Communications Baud Rate Register
$1 FOO - $1 FOE
Bootstrap ROM
223 Bytes
$OE
Serial Communications Control Register 1
$OF
Serial Communications Control Register 2
$1FDF
Option Register
$10
Serial Communications Status Register
$1FE0 - $ 1FEF
Bootstrap ROM Vectors
16 Bytes
$11
Serial Communications Data Register
$12
Timer Control Register
$1 FF0 - $1FF3
Unused 4 Bytes
$13
Timer Status Register
$1 FF4 - $1 FFF
M.A.L. EPROM Vectors
12 Bytes
$14
Input Capture High Register
most of the significant features of the
MAL-4. It leaves out essentials like
the power supply, speaker driver and
even an external EPROM which the
unit can be used to program.
The 68HC705C8 has 24 bidirectional input/output (1/0) lines and 7
input-only lines. These are arranged
as three 8-bit 1/0 ports (A, B & C)
while the 7 input-only lines are port
D. Interestingly, while these 7 lines
are specified by Motorola as input
only, the first line (PD0) is also used
as an output line, to provide the Tx
line for RS-232 serial communications
(via a MAX232 chip on the board).
Port A is used to drive the 2-line
liquid crystal display, along with a
couple of the lines from port C. The
liquid crystal display is an intelligent
device and it accepts ASCII characters on its parallel data lines.
Ports B and C drive a bunch of
LEDs which show the state of the
lines. One data line of port C also
36
$09
$0A
SILICON CHIP
$15
Input Capture Low Register
$16
Output Compare High Register
$17
Output Compare Low Register
$18
Counter High Register
$19
Counter Low Register
$1A
Alternate Counter High Register
$18
Alternate Counter Low Register
$1C
Program Register
$10
COP Reset Register
$1E
COP Control Register
$1F
Unused
drives the speaker to provide the occasional beep or two, to acknowledge
that the micro is receiving or feeding
out data. The 16-button hexadecimal
keyboard is connected to ports A and
C via row and column driver ICs. Port
A also provides the external parallel
port.
An IBM keyboard can be connected
to the unit and it drives four of the
lines of port D.
DIP switches are also provided for
data input to port A and port D.
Two pushbuttons are provided for
"Interrupt Request" (IRQ) and "reset" .
All of _the above features can be
gleaned by examining the block diagram of Fig.1 but let's face it, that will
not really tell you much about how
the micro works. That understanding
will come gradually as you learn more
about programming the device and
DIPSW1 PORT-A
,I, 1,1\'
l ll
:\'
1/0 CONNECTOR PL2
I, I
l l
PORT-A
PORT•B
LCD
J
I
...<
a..
.,J
PORT-A
INPUT
BUFFER
'
PC3
,,
A BUS
-.
E RS R/W
8-BIT DATA
ca.. "'a..<
.,J
<
a..
.,J
<
a..
"'<
ca..
<O
<
a..
a..
,,
•
"'
a..
a..
0
<O
0
a..
.,J
(
.,J
[
0
,,
,,
,
"
PA7
PA6
PAS
,,
< PA4
PORT-B
LED MONITORS
.:.
~
PAS
a.. PA2
l.
PA1
PAO
XTAL1
2MHz
[
PB7
OSC1
Ir
r
PBS
OSC2
m P84
,J
~ P83
,J
PB2
.,J
.:.
a..
RESET
T
P81
.,J
PBO
~
PORT•C
LED MONITORS
PC7
.,J
PC6
,J
.:.
IRQ
PC2
.,J
PC1
,J
PCO
.,J
'I
0
0
,1, I, I, I,~\'
I l I
r
.,J
"
.:.
~ PD3
a.. PD2
.,J
PD1
.,J
PDO
,,
TXIPD1
MAX232 ]PDO
RX
1
TX .I
DATA
IIDATA
RX
RS232
PLUG
8
U6
74LS139
COLUMN DRIVER
II
.A
D BUS
a PD4
'
'
"'00..
:::,
"'
"'
<
PD5
PD4
IBM
PD3 KEYBOARD
SOCKET
PD2
8x4 X-Y
KEYPAD
UP TO 32 KEYS
U7
74LS541
KEYPAD ROW
BUFFER
I
Fig.1: this block diagram shows the main features of the MAL-4 microcontroller
board. It has three 8-bit input/output ports (A, B, & C), while Port D has seven
input lines. Two of these lines do double duty as the RS232 serial port. Data
entry can be via the on-board hex keypad or via a standard IBM keyboard.
how it handles data to and from its
ports.
Physically, the MAL-4 is constructed on a double-sided PC board
measuring 223 x 153mm. It has a zero
insertion force (ZIF) socket to allow
an external EPROM to be used or programmed. It has a hex keyboard as
u
0..
A
~\
PD7
PD5
....
IL
.,J
T
~
DIPSW2 PORT-D
~ PC3
a..
l
C BUS
r
u PC4
Ir
SPEAKER
,,
PCS
KEY6
ESCAPE
~
PB6
U2
MCUHC705C8
MCU
KEYS
RESET
B BUS
_,,
already mentioned. The board is used
free-standing and it only requires the
connection of a 12V AC or DC plugpack to have it up and running.
As a point of interest, the MAL-4
board also emulates all functions of
the Motorola M68HC05PGMR "Programmer Board".
The MAL-4 microcontroller board
is available from the author as a complete kit and sells for $249. The address is E.S.D. Electronic System Designs, PO Box 73, Glenbrook, NSW
2773. Phone (047) 39 4039. The kit
comes with a detailed assembly & operation manual which includes listings.
Next month, we will continue the
description of the MAL-4 board, giving the complete circuit, construction
details and the parts list.
SC
NOVEMBER
1992
37
|