This is only a preview of the December 1992 issue of Silicon Chip. You can view 54 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. Articles in this series:
Articles in this series:
Articles in this series:
Items relevant to "A 2kW 24VDC To 240VAC Sinewave Inverter; Pt.3":
|
MAL-4: Microcontroller
Aid for Learning; Pt.2
This month, we publish the complete
circuit diagram of the MAL-4 & describe
how it all works. It's based on a
Motorola 68HC705CB microcontroller.
By BARRY ROZEMA
As noted last month, the heart of
the MAL-4 is the Motorola MC68HC705C8 Microcontroller Unit (MCU). It
has the following internal "peripheral" devices: EPROM (7.6K) , RAM
(304 bytes), ROM (240 bytes),
bootstrap, crystal oscillator & divider,
watchdog timer, interrupt timer/coun58
SILICON CHIP
ter, synchronous & asynchronous .serial interfaces, three 8-bit ports and
one 7-bit input only port.
A 2MHz crystal (XTAL1) is connected to the oscillator pins (38 & 39)
of the MCU. The MCU divides the
crystal frequency by two, giving an
internal clock rate of 1MHz or lµs.
This means that if an instruction takes
five clock cycles to complete, you
know how much time it takes (5 x lµs
= 5µs).
The MC68HC705C8 is a true "single chip microcontroller" and therefore provides no access to the internal
busses. Instead, it has four input/output p9rts. The four ports are called
(for want of better names) Port A, Port
B, Port C & Port D. Ports A, B & Care 8bit bidirectional ports; ie, any bit(s)
can be used as an input or output.
Port D is a 7-bit input only port (bit 6
is missing).
On the MAL-4, the ports have logic
switches or logic monitors connected
to them. Ports A and D each have
eight data switches connected, while
ports B and C each have eight LED
data monitors.
Port A is used as a data bus and has
a number of devices connected to it.
They are the liquid crystal display
(LCD), the hexadecimal keypad and
the port A data buffer (U8, a 74LS541).
Port A is configured as an input to
communicate with the hex keypad
and the port A data buffer. It is
configured as an output to write to
the display and as an input to read
from the display.
Port B is connected directly to the
input/output socket (PLZ). The logic
levels on this port are indicated by
eight LEDs which are driven by octal
inverting buffer U4 (74LS540). This
port is configured as an output but
can also be configured as an input by
the .user.
Port C is used as a control port. It is
connected to and controls the display, the hex keypad, the port A data
buffer, U8 and the loudspeaker. It has
8-bit LED data monitoring like port B,
which is driven by octal inverting
buffer U3 (74LS540).
Port D is an input only port. It is
connected to seven data switches in
the form of an 8-way DIP switch (DIP
SWZ). If a switch is ON, it shorts the
input to ground which makes the input low (0). If the switch is OFF, the
input is pulled high (1) via a l0kQ
resistor (RP2) to +5V. If the appropriate switches are turned off, Port D can
also be configured. as a communications port.
Port D has a synchronous and asynchronous serial communications interface called the Serial Peripheral
Interface (SPI) and Serial Communications Interface (SCI) respectively.
The SPI is connected to a 5 or 8-pin
DIN socket. This can be used to drive
an IBM XT type keyboard or other
synchronous serial devices.
The Serial Communications Interface is connected to an RS232 line
driver IC (U5, a MAX-232) and PL1.
This device converts the 5V TTL signals to ±l0V RS232 levels. The
MAX232 chip internally generates its
own +10V and -lOV supplies to do
this.
Operation of the display
The 16-character 2-line alphanumeric, intelligent, liquid crystal display can provide the full range of
ASCII characters. The MAL-4 talks to
the display via port A in an 8-bit
parallel format. The control lines,
R/W, Register Select and Enable are
fed from port C.
. The display can be disabled by a
link (LNKl). Position 1 enables the
display by connecting the enable (E)
signal to port C bit 4 (PC4). Position 2
disables the display by disconnecting
the E signal and ties the E pin on the
display low (0V) via the lOkQ pulldown resistor (R28).
VRl is a contrast (viewing angle)
control (VRl) which places a DC bias
on the VO pin of the display. This
enables you to adjust the display to
suit your particular viewing angle.
Operation of the hex keypad
The keypad is an 6 x 4, x-y matrix
or row/column type. The column is 4bit and it is driven by port C via a 1-of4 decoder (U6a, 74LS139). This pulls
each column low in turn. The row is
8-bit and is read by port A via an octal
data buffer (U7, a>74LS541). Each of
the eight rows are pulled high via a
l0kQ resistor (RP3). If no key is
pressed, the row will read high (1) for
each of the four column scans. If a key
is pressed, a row will read a low (0) on
a given column scan.
The MCU knows which key is
pressed by reading the row/column
reference. The keypad circuit can be
disabled by a link (LNKZ). Position 1
enables the keypad circuit by plac.i ng
a low (0) on the enable pins ofU6 and
U7. Position 2 disables the keypad
circuit by placing a high (1) on the
enable pins via a lOkQ pull up resistor (RP3).
Operation of port A
Port A is an 8-bit input only port
connected to the input/output socket
(PL2) and to eight data switches in
the form of an 8-way DIP switch (DIP
SWl). Its operation is the same as the
switches on port D. It is read by the
Fig.2 (next page): the MAL-4 circuit
is built around the MC68HC705CB
Microcontroller Unit. It features
synchronous & asynchronous serial
interfaces and four 8-bit input/output
ports. Ports A, B & C are 8-bit
bidirectional ports (ie, any bit(s) can
be used as an input or output), while
Port Dis a 7-bit input only port (bit 6
is missing).
PARTS LIST
1 MAL-4 PC board
1 2MHz crystal
1 24-button keypad
2 PC mounting keyswitches
2 8-way DIP switches
4 3AG PC fuse clips
2 3AG 1A fuses
1 60 x 32 x 30mm TO-220
heatsink (DSE Cat. H-3401)
1 8-way 0.2-inch PC-mount
screw connector
1 40-pin DIP socket
1 28-pin DIP socket
4 20-pin DIP socket
4 16-pin DIP socket
1 16-pin header plug
1 26-pin header plug
3 3-pin 0.1-inch SIL PCB plug
3 0.1-inch shorting links (to suit
above plugs)
1 plug -to suit display
1 socket to suit display
1 5-pin DIN right-angle PCB
socket
Semiconductors
1 MC68HC705C8S (EPROM
version) with monitor program
by E.S.D.
1 Seiko M1632 16-character 2line alphanumeric LCD
2 74LS540 octal inverting buffers
2 74LS541 octal buffers
1 74LS139 dual 1-of-4 decoder
1 7805 5V regulator
1 MAX232 line driver
3 BC108, BC548 transistors
1 WO4 1.SA bridge rectifier
4 1N4001 diodes
1 1N914 diodes
17 3mm LEDS
1 3mm high brightness LED
Capacitors
1 2200µF 16VW electrolytic
1 1µF 16VW tantalum
11 10µF 16VW tantalum
4 0.1 µF ceramic or monolithic
2 27pF disc ceramic
Resistors (0.25W, 1%)
1 10MQ
1 2.7kQ
6 10kQ
17 150Q
1 4.7kQ
1 10Q
3 10kn x 9 SIL resistor packs
2 4.7kQ PC mount trimpots
Miscellaneous
3 3mm x 10mm-long machine
screws, 3 3mm nuts, 3 3mm ID
spring/antishake washers
DECEMBER
1992
59
,!
Ii
RESET
KEY5
C10
1
r
+5V
!•
R22
10k
--
R2
10k
02
8C548 C
~
RESET
PAO
Cl
RESET/
S3
PA1
PA2
PA3
~E
PA4
PAS
':"
35
TCMP
37
TCAP
39
j_
I 'f
C3 .LxTAL1
27pf
2MHz
':" ·
C4
PA8
TCMP
PA7
TCAP
PBO
OSC1
PB1
R1
10M
P82
38
.l.
PB3
OSC2
P84
U2
88HC705C8
27pf +
PBS
PB8
2
IRQ
PB7
IRQ
VDD
PCO
+SY
POO
lu1
IRQ
KEYi
---;;;;-; PDO
PD1
R2
10k
_,_
P02
I)
1
01
R21
10
--
LNK3
-~
:f~> 2
C
0
.1+
':"
I)
R27
10k
29
31
P03
32
PD4
33
PD5
34
P07
38
PC1
PC2
PD2
PC3
PD3
PC4
PD4
PCS
PD5
PCS
PD7
PC7
+SV
I
40
1
.... ar.::i)
04 (
1N914 •
YOO
I
RESET
PAO
18
10 PA1
PAI
17
9
PA2
PA2
16
8
PA3
PA3
15
7
PA4
PA4
14
+5V
8
PAS
5
PAS
PAS
4
PA7
12
PBO
PBO
11
13
PB1,
P81
12
14
PB2
PB2
13
15
PB3
PB3
15
16
PB4I
17
PBS
18
PBB
19
PB7
C,.
PB4
18
PBS
17
PB8
18
Al
9
PA1
D2
8
A2
A3 7
PA2
A4 8
PA4
03
D4
24
28
PC2
PC2
21
PC3
23
24
PC4 I
PC4
2
23
PCS,
PC7
22
3
01
02
02
03
03
08
U1
A8
19
4 PA2'
5 PA3'
E2
Ei~PIN2
RP2
-!!o
PA3
+SV
t 20
PA2 13
A8
I
PA4
A10
PAS
A11
PA8
A12
I
ce
PA7
PC2
9 ROWO
08
D8
07
D7
8 ROW1
7 ROW2
08
8
U7 D5
5
15
74LS641
04
04
4
18
D3
03
17
3
02
D2
2
18
01
01
19
1
PA3 14
A9
OE
3 PAI'
04
AS ,-5__~5..,
D5
08
05
ROW3
ROW4
ROW5
ROWS
ROW7
E2
Ei
-t +o
VPP
E
PC3
r--
PA1 12
PC1
PC7 I
AO
01
PA7
25
,PCO
.-
PCB
00
~ D7 2764 A7 3
PCOI
22
PAO
PAO 11
PC1 I
21
PA7
10
PAS
27
PC3
r
PAS
27
2 PAO'
01
04
6 PA4'
ua
QS 74LS541 OS
13
7 PAS'
08
08
12
8 PA&'
07
07
11
08
08 ~
4
28
25
,,...---
t2,
11 PAO
-:1:10
.,!30
':"
...
+SY
R28
2.7k
R3
10k
VDD
D1
1N4004
GD
AC
VPP
+12V
+5V
GND
+8
SPKR
--
0-
-
......
I)
26:
10 0
R
2200i
-
4
RS
D3
R/W
04
3 05
D8
E
11
PCS
10
PC8
9
LNK1
1,--
GND -YLED
-!!3
R20
10k
~8
0
10
~
GND
C15
-:-
DS
R28
4.7k
+5V
C
03
BC548
8
PC7
-
SILICON CHIP
-
VOLUME
VR2
1k
-0
-
+5V
10
LED1 ~
POWER ·•
~
03(
1N4004
rt
2
':"
~~""h
C18 ~ I■
~
1::1\
\;J
'-::,/
1N4004
BATTERY
WARNING
~
R24
1500
VDD
Cl 1 ■
jt
IGO
'--
PC4
+SV
120
PCO
2
PC1
3
PC2
4
PC3
5
PC4
6
PCS • 7
·-:-
LED2
r.:'\
EOc
VIEWED FROM
BELOW
':"
U9
0
F2
":"
~
E
60
5
PA4
D1
LCD
02 M1832
B
CONTRAST
VR1
1k
\:;I
POWER
S1
~,.:.
-
---
PA3
VDO +VLED 12
VO
17:\
POWER
0-
8
D2
1N~004
•
--
PA2
DO
~ D7
8R1
AC
7
...~
l
coNNECTOR
8
PAI
PAS
I)
VPP
S2
PAO
~
15
114
PC8
8
--.fQL!
0.1+
MAL-4 MICROCONTROLLER
vcc
D1
01
02
02
03
18
D6
....
RB
08
06
07
D7
DL _
E1 E2
....
14
12
LED9
K~A
V
LED&
K~A
R8
R9
LEDS
K~A
R7
.... V.
....
l2 RIO
....
Q8 11 R11
~10
V,_
V..KLED7
~A
LE08 V
K~A
....
04
05
RS
18
03
U3
74LS540
....
17
15
D4
8x1500
LE010
R4 K ~ A
....
V!:j
LED4
K~A
V
LEDS
K~A
\D
PORT C LED MONITORS
PCO
PC1
PC2
PC3
PC4
PCS
PCB
PC7
+SV
+SY
20
PBO
·- - --
01
Q1
PB1
· - - - - 02
02
PBO
19
RP1
10k
P81
Q3 18
PB2
2
TCAP
PB3
· - - - - 04
+SY
RP3
10k
1
PB4 6
OS
PBS 7
i
2
i :
:
3
4
s
7
6
8
PB& 8
9
10
U4
74LSS40
PB7 9
05
08
Q6
07
07
08
E1 E2
08
14 R18
13 R1!.
12 R18
11
i
R19
w
7
8
9
10
PAO'
PA1'
PA3'
PB4
LE013
K~ A
PA4'
w
PBS
w
b
PA6'
PB6
LE011
K~ A
+SV
PAS'
PA7'
1
P87
PORT B LEO MONITORS
~ 19
6
PA2'
LE012
K~ A
w
5
4
P83
LE014
K~ A
w
3
2
4
3
s
7
8
18 15 14 13 12 11 10 9
+
LNK2
I
0
--
I
2
E
A B
vo
4
8
s
r+
7
~ ......
C1+
C11 : :
10 _
C1·
16 PIN HEADER
(25 PIN RS232)
2
y. 8
C2+
LINKS
us
ce C c12 .I.
MAX232
1o u
10 ~
C214 TX DATA
P01/TOO 11
T11
T10
POO/RD1 12
13 RX DATA
R10
R11
GNO
§"'"'
0
0
11
RO W7 10
ROWS 9
ROWS 8
ROW4 7
RO W3 8
RO W2 5
ROW1 4
ROWO 2
0
0
3
0
1
08
10
18
07
OF
17
20
KEY2
1F
KEY1
1E
KEY4
10
KEY3
08
OE
18
05
00
15
04
oc
14
1C
03
0B
13
18
02
OA
12
1A
01
09
11
19
PIN19
U8
-P07
4
8
7
8
9
P05
22 0
TCMP -
250
IRQ
-~-
10
P03
PD4
260
t
POO
23 _
P01
24
-=
:~
-f
I
I
"'
~
210
TCAP -
P04
P03
-
w
0
-
: 3 (2)
s
-
PB6 18 =
PB7 20 '::
:
3
""
0
9 (S)
. b 1(1)
~
13 (7)
2
8::.
: S (3)
RP2
10k
0
PB1
PB4 14 _
PBS 18 =
1
0
0..
15 (B)
11 (6)
+SY
... ..."' ......
6_
PB3 12
RESET
0
PBO
PB2 10 =
0 7 (4)
+5
3
N
J1a
YCC
V+
3
4
Y1 Y2 Y3
13=
t
C8
10 L
_
8
us
74LS139
PA4'
+SV
1
18
PA3'
-
2
T
1
3
9-
11_
PA7' 19_
,
11
-
-
PA2'
PAS' 1s:
PA6' 17 _
PORT A DIP SWITCH
,--
1:
PA1'
\\\ 1\\\\
SW1
L
PAO'
8
SPI INTERFAC E
5-PIN DIN
P02
P01
8x4 KEYPAD
(32 KEY)
POO
16 15 14 13 12 11
SW2
10 9
\\\ \\\\
1
2
3
4
5
8
7
8
-,r
PORT O DIP SWITCH
D ECEMBE R
1992
61
MAL-4: Microcontroller Aid For Learning
MCU via an octal data buffer (U8, a
74LS541).
The MAL-4 monitor program allows
port A to function as an input port
under a user program or it can be
disabled by switch 6 on DIP SWZ. If
the switch is in the ON position, the
octal data buffer (U8) is enabled.
The loudspeaker is driven by bit 7
of port C via NPN transistor Q3. This
is a BC108 (BC548) configured as an
emitter follower. The level of signal
fed to the transistor is set by volume
control pot VRZ. R28 limits the maximum volume level and can be reduced if a higher volume is required.
The monitor program generates a series of highs (1) and lows (0) to generate tones from the speaker.
Power supply
The MAL-4 can be fed from a 12V
Hear what the
It runs in the family.
test panel had to say
First Concert VII voted
say about Concert II:
'Loudspeaker of The
"On audition it didn 't
Year'. Now the smaller
take long to establish
model Concert II
that the Jamo was
winning hands down
something special.
in.a group test with 8
The speaker simply
other loudspeakers
sounded more transin the UK magazine
parent and revealing
"High Fidelity".
than the other speakThe conclusion of
ers in the test.... They
the test was: "The
imaged better.... A
speaker that resolved
deep, tangible bass
the problem was the
and crystalline mid
dark horse Jamo. Very
and treble clarity....
much an unknown
Imaging was virtually
quantity in the UK, it
holographic... "
was nothing less than a
With 24 years exrevelation when put to
The test winner
perience having prothe test. It was the one
duced more than 10
speaker here with
million loudspeakers,
genuine grip and grace
2-way bass reflex
Jamo is today
and, as such, ended up System:
Woofer:
1 70mm Polypropylene
Europe's preferred
the overall winner. "
Tweeter:
25mm sofl dome
loudspeaker brand.
When a Danish
Power Handling:
80 watts RMS
Timber Finishes:
Walnut and Mahogany
To experience _
loudspeaker is the
RRP: !Timber finish)
$1190 pair
why Jamo is winning
preferred choice in
(Black Ltd. Edition) $ 990 pair
time and time again,
the UK over such
brands as B&W, Mission, Heybrook,
call into your nearest authorized
Jama specialist or contact Scan
Castle and Tannoy, it must be of
outstanding design, And this is
Audio for more information and
exactly·what Jamo's Concert II is.
the name of your nearest dealer.
CONCERT II
uamo
AWARD
WINNING
LOUDSPEAKERS
SCAN AUDIO, 52 Crown St, Richmond VIC 3121. Phone: (03)429 2199. Fax (03)429 9309
62
SILICON CHIP
DC plugpack or a 12V battery. Alternatively, a 9V AC supply can be used.
It is full wave rectified by bridge rectifier BRl and filtered by a ZZ00µF electrolytic capacitor (C13). This feeds
U9, a 7805 3-terminal regulator to produce a +5V supply which feeds the
ICs on the board.
This +5V supply also provides the
Voo rail for the microcontroller via
diode D3. There is provision for a
battery backup supply for the RAM.
Normally supplied by three AA cells
in series (off board), the line feeds the
Voo rail via diode D5 and LED 2,
when the +5V rail falls.
LED 2 is a battery warning indicator. It is a high brightness type and
indicates when a current of more than
lmA is drawn from the battery. This
can occur if the MCU is not shut down
before the power is removed. The MCU
current under shutdown (STOP) conditions is in the order of a few microamps.
Reset circuit
The MCU requires its pin 1 to be
pulled low for the reset condition to
occur. The reset can come from four
places: reset switch (S3), pushbutton
reset (KEY5), at "power on", or via the
input/output plug (PLZ). The reset
switch (S3) works simply by pulling
the reset pin to 0V. It is intended to be
used when the MAL-4 is used as a
programmer. Alternatively, the pushbutton reset (KEY5) turns on transistor (QZ) and this pulls the reset pin
low.
The power-on reset circuit works
as follows. Capacitor Cl0 is discharged
via diode D4 when the +5V rail falls.
When power is applied, ClO is charged
via RZZ and the base of transistor QZ.
While the capacitor is charging, QZ is
switched on and pulls the reset pin
low. When Cl0 is fully charged, QZ
turns off and the MCU resumes normal operation.
Interrupt request
The escape or Interrupt ReQuest
(IRQ) circuit supplies the MCU with a
low (0) on pin 2. The IRQ comes from
pushbutton KEY6. This turns on transistor Ql via resistor RZl and pulls
pin 2 of the MCU low. ·
Both the reset and the IRQ circuit
prevent the MCU from being reset
when there is no power applied to the
MAL-4. This is necessary otherwise it
could be taken out of the shutdown
The assembly of the MAL-4 microcontroller is straightforward as all the parts
are mounted on a double-sided PC board with plated-through holes. A kit of
parts will be available from the author (details next month).
mode (STOP) if the reset or IRQ buttons are pressed and thereby cause
excessive battery consumption.
Link LNK3 in the IRQ circuit provides the IRQ pin on the MCU with a
pull-up voltage of +5V in position 1
or +9V in position 2. Position 1 operates the monitor program while position 2 operates the Boot loading program.
Programmer mode
If links LNK1 , LNK2 and LNK3 are
placed in position 2 and the 8-way
DIP switch (DIP SW2) is set correctly,
all the MAL-4 peripherals are disabled (display, keypad, monitor EPROM
and port A buffer) and the unit becomes a programmer.
Note: last month's overview of the
MAL-4 may lead readers to believe
that the unit can program EPROMs.
This is incorrect. At this time, the
MAL-4 can only program the EPROM
inside the MCU. The steps involved
in programming the internal EPROM
are set out in the Motorola MC68HC705C8 Technical Summary (BR594/
D).
Programming can be done in the
following ways:
(1). Program and verify internal
EPROM from the 8K EPROM (U1)
(2). Verify interna"i EPROM contents
from 8K EPROM (U1)
(3). Secure internal EPROM
(4). Load and run program in RAM via
RS232
(5). Dump internal EPROM contents
via RS232
(6). Run program in RAM
When LNK3 is placed in position 2,
the MCU is placed into the bootstrap
program mode. This mode uses the
internal bootstrap ROM. DIP sw 2 selects the programming mode. S1, S2
and S3 are used to switch the power
(Vpp) and take the MCU out of reset to
enter the programming mode.
The 8K EPROM (U1, 2764) is used
as the program source. Its data is
loaded via port B while the address
locations are incremented via ports A
and C. Data can be sent to the RAM or
from the internal EPROM via the
RS232 interface to a PC. LEDs PC5
(LED 5) and PC6 (LED 4) indicate that
the program is verified and that the
MCU is programming.
Next month, we will present the
full constructional details for the
MAL-4 microcontroller.
SC
We have over 1,000
different printed circuit
boards and screen
printed front panels for
kitsets from EA, ETI,
AEM, HE and Silicon
Chip. On special this
month only for half
normal price!
For a complete list of
available PCBs and
front panels, their date
of issue and price,
simply send your name,
address and stamped
self addressed
envelope.
Note:Duetocopyrightlaws we cannot
supply copies of magazine articles.
These are available from libraries or the
magazine companies (by arrangement)
ALL ELECTRONIC
COMPONENTS
118-122 Lonsdale St. M elbourne 3000.
Ph: (03) 662 3506. Fax:(03)6633822.
~
-~- - - - - - - - - - - -
I
I ;:.:N.=.am:..=.e_ _ _ _ _ _ _ _ __
I
I
I -----------I
I Address
I -----------I
I -----------I
I Postcode
I -----------L ____________ _ .J
D E CEMB ER
1992
63
|