This is only a preview of the February 1993 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. Items relevant to "Build The Electronic Cockroach":
Items relevant to "A Low Fuel Indicator For Your Car":
Articles in this series:
Items relevant to "A 2kW 24VDC To 240VAC Sinewave Inverter; Pt.5":
|
MAL-4: Microcontroller
Aid for Learning; Pt.3
All the parts for the MAL-4 microcontroller are
mounted on a double-sided PC board, so the
assembly is straightforward. All you have to do
is follow the step-by-step instructions.
By BARRY ROZEMA
Numerous hours were spent designing, prototyping and programming the
MAL-4 microcontroller kit but all this
time will have been in vain if you do
not take considerable care in the construction. At the very least, read the
following instructions thoroughly before starting assembly.
If you are an experienced construc46
SILICON CHIP
tor, then the steps may be used as a
guide on~y. However, if you don't have
much experience, then the following
steps should be adhered to rigidly.
Step 1: check the supplied components against the parts list. Contact
the kit supplier immediately if there
are any missing components.
Step 2: check the copper tracks on
the PC board by holding it in front of a
strong light. You should spend at least
half an hour inspecting the board for
breaks, tracks shorted together and
holes not drilled. It is easier to spot
faults on a bare board than it is on a
fully assembled board.
Step 3: solder the IC sockets into
place. Each IC position has pin 1
marked on the PC board and care
should be taken to orient each IC
socket accordingly. Note: some readers may wish to use the more expensive ZIF (Zero Insertion Force) sockets for Ul & UZ.
Step 4: solder all resistors into place,
as indicated on the board and on the
wiring diagram (Fig.2). Bend the leads
E.S.D.
Jf<SRDZEMAYI.'i'll
Fig.3: parts layout for the MAL-4 microcontroller. Note that only the bottom
layer of the board is shown, which is why some tracks appear to end in mid-air.
Follow the instructions in the text when installing the parts on the board.
at right angles with long-nosed pliers
and fit each resistor with its tolerance
band towards the righthand or bottom edge of the board (this will make
checking easier later on). Trim the
excess wire from the soldered joints
on the back of the board.
Step 5: solder the capacitors into
place, making sure that all tantalum
and electrolytic capacitors are correctly oriented (the positive lead is
marked by a plus sign on the PC
board). Trim the excess wire from the
soldered joints on the back of the
board.
Step 6: install the light emitting
diodes (LEDl-18). Most LEDs have a
flat spot on their base to mark the
cathode (K) lead and this should go to
the negative sign, as marked on the
PC board. If the cathode is not marked,
the cathode lead is the shorter of the
two. Note that LED 2 should be a high
intensity type.
Step 7: install diodes D1-D5 & the
bridge rectifier BR1. The cathode terminal is marked by the bar in the
diode outline on the PC board. Check
that the bridge rectifier is correctly
oriented; ie, that its plus and minus
pins go to corresponding pads on the
PC board.
Step 8: install transistors Q1-Q3.
Ql and QZ have their base terminal
towards the righthand side of the
board, while Q3's base terminal is
towards the bottom of the board.
Step 9: install potentiometers VR1
and VRZ. The PC board has been designed to accept potentiometers with
different "footprints". When installing each potentiometer, connect its
wiper terminal to one of the two lower
holes in the footprint on the board.
Step 10: fit the four fuse clips. Note
that some brands of fuse clips must be
oriented correctly to allow the fuse to
fit between them. Fit the two 1A fuses.
Step 11: install the 2MHz crystal.
Note that this crystal should lie flat
on the PC board, as shown in Fig.3.
Step 12: install SIP resistors RP1RP3. Pin 1 is marked on each resistor
pack and this must be aligned with
the pin 1 marking on the PC board.
Step 13: install plugs PL1 and PLZ.
These should both be mounted with
their long pins pointing up.
Step 14: install linking terminals
LNK1-LNK3 with their long pins facing up and fit the shorting straps. In
each case, the shorting strap should
be fitted to the upper position (position 1).
Step 15: solder the display socket
to the PC board. The type of display
that has been supplied will govern
the type of socket and its position.
Display 1 has a 14-pin DIP plug &
socket, while Display 2 has a 14-pin
SIP plug & socket. After fitting the
socket, fit the plug to the underside of
the display (the pins are soldered on
the top of the display board). Don't
plug the display in yet.
Step 16: install 5V regulator U9 and
its heatsink. To do this, first align the
heatsink and regulator assembly with
the board by bending the pins of the
regulator through 90°. Once the correct location has been found, apply a
light film of heatsinking paste to the
back of the regulator, then bolt the
assembly to the PC board using three
3mm screws, nuts and washers (nuts
on the top of the heats ink). Solder the
regulator leads and trim away the excess lead lengths.
Step 17: install the rightangle PCmount DIN socket (IBM type), then
FEBRUARY
1993
47
Table 1: Input/Output Program
Address
Data
· 0030
B6 00
0032
B7 01
0034
BC 30
Table 2: Tone Generator
Address
Data
0040
B6 00
0042
CD 14 A1
0045
1F 02
0047
B600
0049
CD 14 A1
004C
1E 02
004E
BC40
install the 8-way screw connector.
Make sure that the wire entry side of
the screw connector faces the lefthand
edge of the board.
Step 18: install the three PC-mount
toggle switches (Sl, S2 & S3). Note: if
you do not wish to use the switches,
Sl must be replaced with a wire link.
This link should go betweeri the two
lower pads of the Sl terminals.
Step 19: install the PC-mount pushbutton switches (KEY5 & KEY6). Careful inspection of the switch pinouts
and the PC board is necessary to obtain the correct orientation. Try to fit
the switches so that the "RESET" and
"IRQ" prinL markings on Lhe board are
visible (see the notes supplied with
the kit).
Step 20: install the keypad. The
MAL-4 can accommodate several
types of keypads:
(1). Keypad 1: 16-key (4 x 4) x-y,, 9pin.
(2). Keypad 2: 24-key (3 x 8) x-y, 11pin.
(3) . Other: up to 32 keys, hard wired.
If you purchased a complete kit, refer
to the notes supplied with the kit. If
you want to use a socket with the
keypad, this should now be fitted to
the PC board. The keypad is then fitted by plugging it into the socket or by
soldering it directly to the board.
If you use Keypad 2, then skip the
next step.
Step 21: install PC-mount pushbutton switches KEY2, KEY3 & KEY4. As
before, careful inspection of the switch
48
SILICON CHIP
pin outs and the PC board is necessary
to ensure the correct orientation. Try
to fit the switches so that the titles on
the overlay are visible.
Step 22: install the two 8-way DIP
switches by plugging them into their
sockets. These switches should be oriented so that the "ON" position is
towards the bottom of the PC board.
This will set the switches so that "up"
is high and "down" is low.
Step 23: apply 9V AC to the power
connector terminals labelled" AC", or
12V DC between the terminal marked
+12 and GND (your supply should
have a current capability of at least
500mA). Operate switch Sl and check
that the power LED (LED 1) lights.
Now measure the voltage on the +5
terminal of the screw connector block
- it should be between 4.75V and
5.25V. If all is well, disconnect the AC
and continue. If not, remedy the
fault(s) before moving on to the next
step.
Step 24: install ICs U3-U8 by plugging them into their sockets. Make
sure that each one is correctly oriented (double check this) before applying power.
Step 25: apply 9V AC to the power
connector terminals, switch on and
re-check the +5 terminal on the power
connector strip (4.75-5.25V). Check
the temperature of the ICs by feeling
them with your finger - all should be
cool. If all is well, disconnect the AC
and continue. If not, remedy the
fault(s) before proceeding.
Step 26: install the display & the
pre-programmed MCU (U2) by plugging them into their sockets.
Step 27: re-apply power, check the
temperature of the MCU (U2), and
check for signs of distress. Re-check
the +5V terminal on the power connector. If this voltage is low, switch
off immediately and remedy the fault.
If all is well, there should be a message on the LCD (note: contrast pot
VR1 may need to be adjusted). This
message will read "* * * WARNING!
*** RAM POWER FAIL" if you have
no battery back-up supply, or "M.A.L.
Vers 4.XX Enter Mode ... " if you do. If
the display reads "* * * WARNING! * * *
RAM POWER FAIL" then press the
reset key and the display will read
"M.A.L. Vers 4.XX Enter Mode ... "
The construction of the MAL-4
board is now complete. The next step
is check that the various functions
built into the unit are working cor-
rectly. Assuming that you get the messages described in step 2 7 on the display, you should now perform each of
the tests described below.
Keypad test (mode 7)
Step 1: to enter this mode, press the
"7" key at the "M.A.L. Vers 4.XX"
prompt. The display should now show
"KVAL - KYBIN -" on the first line
and "MAL Keyboard TST" on the second line.
Step 2: press any keypad key. The
display should show the KEYVALUE
(the order in which the keys are
scanned) and the KEYBINARY (ie;
the assigned binary value for a given
key).
Step 3: press the RESET or IRQ
switch key to leave mode "7". This
will display the "M.A.L. Vers 4.XX"
prompt again.
Display test (mode 8)
Step 1: press the "8" key at the
"M.A.L. Vers 4.XX" prompt. The display should rotate all its characters to
the right from a flashing cursor.
Step 2: press the RESET or IRQ key
to leave mode "8" and display the
"M.A.L. Vers 4.XX" prompt again.
Keyboard.test (mode D)
Step 1: set the DIP switches on PORT
D (DIP SW2) as shown below:
DIP
SW2
7
X
E
5
4
3
2
1
0
on on off off off off off
Step 2: plug an IBM XT compatible
keyboard into the DIN socket on the
lefthand side of the board.
Step 3: press the "D" key from
"M.A.L. Vers 4.XX" prompt. The display should now show "Keyboard
Data" on the first line, while the second line will be blank.
Step 4: press any key on the IBM
XT keyboard. The display should
show the data that is sent from the
keyboard in hexadecimal format,
while the Port B LEDs will display
the da,ta in binary.
Step 5: press the RESET or IRQ key
to leave mode "D" and display the
"M.A.L. Vers 4.XX" prompt again.
Simple test programs
Tables 1, 2 & 3 list some simple test
programs for the MAL-4. Enter them
using MODE-0 and run them using
MODE-1.
Table 3: Yes/No Decision Maker
Address
Data
0060
CD 12 05
0063
AE 10
0065
CD 11 CC
0068
AE 11
006A
CD 11 FE
006D
CD 13 2E
0070
4C
0071
3D D3
0073
27 F8
0075
A4 01
0077
26 07
0079
AE12
0078
CD 11 FE
007E
20 05
0080
AE13
- 0082
PCB and
SCHEMATIC CAD
r------·~----------- ·-·?t~ :
/ TV IF AMPLIFIE
-
/ "I
rl-f-t----H.lm,.
1!,
,._
.
•
~
C-Uiiiflt•
.
·-:
j•4 :
.....
~
:
CD 11 FE
II
mllll
1111111•111111111111111 11>1 1111111111
• 1.... '·""''"'lf•Nn,w
0085
A604
0087
CD 14 F3
008A
20D7
0100
54 68 65 20 41 6E 73 77 65 72 20 69 73 20 2D 3E
0110
50 72 65 73 73 20 61 20 48 65 79 20 4E 4F 57 21
• Design Single sided, Double sided
and Multilayer boards
0120
2D 2D 2A 2A 20 20 59 45 53 21 20 20 2A 2A 2D 2D
• Provides Surface Mount support
0130
2D2D28282020204E4F20202028282D2D
• Standard output includes Dot
Matrix/Laser/Inkjet printers,
Pen Plotters, Photo-plotters and
NC Drill
Table 1 shows an input/output program. It simply takes the data on the
input port (Port A) DIP SW1 and displays it on the output port (Port B)
LEDs.
Table 2 lists a tone generator program, which generates a variable tone
from the external loudspeaker. This
tone ranges in frequency from 20Hz
to 5kHz and is set by the Port A DIP
switch (SW1).
Finally, Table 3 shows a program
that generates a random YES/NO decision when you press any key on the
keyboard.
Monitor operation
The monitor program, which is in
the MC68HC705C8 EPROM, allows the
user to access RAM, ROM and all the
various registers within the single chip
microcontroller. A detailed description of the operation of this monitor
program follows.
When power is applied or the RE-
EASY-PC
• Runs on PC/XT/AT/286/386 with
Hercules, CGA, EGA or VGA.
SET button is pressed, the display
will show the prompt; ie, "M.A.L.
Vers 4.XX. Enter Mode ... " This means
that you may enter a mode of operation by pressing any of the keys indicated in Table 4.
A detailed description of each mode
follows:
Mode "O" - Load, Examine or
Modify Memory.
Step 1: to enter this mode (Mode 0),
press the "O" key when the "M.A.L.
Vers 4.XX" prompt is displayed. The
display will show "Ad.XXXX". The
"Ad." is the ADDRESS prompt and
indicates that the next four digits contain an address location.
Step 2: enter desired address. If the
microcontroller has just been reset,
then the "XXXX" may contain anything. Conversely, if the microcontroller has not just been reset, the
"XXXX" will contain the last address
entered.
The address displayed after the
• Award winning EASY-PC is in
use in over 12,000 installations in
70 Countries World-Wide
• Superbly Easy to use
• Not Copy Protected
Options: • 1000 piece Schematic
symbol library
• Surface Mount symbol
library
• Gerber Import facility
For full info 'phone, fax or write:
BTC
PO BOX432
GARBUTT 4814 QLD.
PH (077) 21 5299
FAX (077) 21 5930
FEBRUARY
1993
49
Table 4: Monitor Operating Modes
Key
Mode Of Operation
0
Load, examine or modify memory
1
Run a program from a given location
2
Disassemble program ·froln a given location
3
No function
4
No function
5
No function
6
Keyboard beep on/off
7
MAL keyboard test
8
Test MAL display
9
No function
A
Print all RAM contents
B
No function
C
No function
D
Test IBM keyboard raw data
E
Test IBM keyboard characters
F
Shut down CPU & save RAM
ENTER
No function
INC
No function
DEC
No function
"Ad." prompt will be the address that
is to have data loaded, examined or
modified. While the display shows
"AdJOCXX", a 4-digit address may be
entered via the keypad. The increment and decrement keys may be used
to increment or decrement the 4-digit
address by one.
Step 3: press the ENTER key when
the correct address is displayed. The
display will now show "Ad.XXXX
Data YY". The last two digits ("YY")
contain the data that is in the address
location displayed.
Step 4: load, examine or modify the
data using the keypad.
Step 5: increment or decrement to
the next address location (use the increment and decrement keys).
Step 6: repeat steps 4 & 5 until you
are finished.
Step 7: press the ENTER key to leave
mode "0". The display will show the
"M.A.L. Vers 4.XX" prompt again.
Note: when the data is displayed,
the address location is constantly being interrogated and displayed at a
rate of once every few milliseconds.
Thus, if the data does not respond to
key entries, then the address indicated is "read only".
This also means that if the data
changes, then the display will show
the change almost instantly. This may
be useful in monitoring an input port.
MODE 1: Run a program from a
given location.
Step 1: to enter this mode, press the
Where to buy the kit
Parts for the MAL-4 Microcontroller Aid For Learning are available from E.S.D.,
PO Box 73, Glenbrook, NSW 2773. Phone (047) 39 4039. Prices are as follows:
standard kit (incl. manual but does not incl. speaker or plugpack) - $249.00;
standard kit with ZIF sockets plus toggle switches -$306; PC board only- $80;
programmed MCU & manual - $48. Please add $10 for postage inside NSW,
$15 for postage interstate. Payment should be made by cheque or money order.
Note: copyright© of the PC board is retained by Electronic System Designs.
50
SILICON CHIP
"1" key when the "M.A.L. Vers 4.XX"
prompt is displayed. The display will
show "Ad.XXXX Run". The "Ad." is
the address prompt and indicates that
the next four digits contain an address location. The "Run" prompt
indicates that you are in the run mode.
Step 2: enter the desired address. If
the microcontroller has just been reset, then the "XXXX" may contain
anything. If the microcontroller has
not just been reset, then the "XXXX"
will contain the last address entered.
The address displayed after the
"Ad." prompt is the address that the
program will run from. While the display shows "Ad.XXXX", a 4-digit address may be entered via the keypad.
The increment and decrement keys
may be used to increment or decrement the 4-digit address by one.
Step 3: when the correct address is
displayed, press the ENTER key. The
microcontroller will jump to the address that was in the display and run
from there. The display will have
"Ad.XXXX Run" on the first line and
"Program Running" on the second
line.
Mode 2: Disassemble a program
from a given location.
Step 1: press the "2" key when the
"M.A.L. Vers 4.XX" prompt is displayed . The display will show
"Ad.XXXX" on the first line and "Disassemble from" on the second line.
The "Ad." prompt indicates that the
next four digits contain an address
location.
Step 2: enter the desired address
via the keypad, or use the increment
and decrement keys to increment or
decrement the 4-digit address by one.
The address displayed after the "Ad."
prompt will be the address of the first
instruction that is to be disassembled.
Step 3: when the correct address is
displayed, press the ENTER key. The
display will show the address and a
1, 2 or 3 byte op-code on the first line
and the mnemonic and operand on
the second line.
Step 4: increment to the next address.
Step 5: repeat step 4 until you are
finished.
Step 6: press the enter key to leave
mode "2 ". The display will show the
"M.A.L. Vers 4.XX" prompt again.
MODE F: Shut down CPU
&save RAM.
Step 1: press the "F" key from
"M.A.L. Vers 4.XX" prompt. The dis-
Table 5: MAL-4 Subroutines
KALEX
Reg.Use
u.
ACC& IX
N
Make port A an input
None
y
Make port A an output
None
y
IX
y
IX
y
LIGHT BOXES
CLR LCD. Home cursor. RST AD.
None
y
• Portuvee 4 • Portuvee 6
• Dual Level
Home cursor line 1 RST AD.$00
None
y
TRIMMER
e ldeal
Description
Name
Address
SETUP
$1180
lnit. 1/0. lnit LCD. Set P.V.
AINPUT
$11BA
AOUTPUT
$11C3
LDISBUF1
$11CC
LDISBUF2
$11FE
CLRDISP
$1205
HOME1
$120E
Load 1st line of LCD with
message pointed to by IX
Load 2nd line of LCD with
message pointed to by IX
The UV People
ETCH TANKS
• Bubble Etch • Circulating
HOME2
$1217
Home cursor line 2 RST AD.$40
None
y
WCTRL
$1220
Write ACC to LCD control Reg.
Ace
y
PCB DRILL
WDATA
$1240
Write ACC to LCD data Reg
Ace
y
• Toyo HiSpeed
RCTRL
$1261
Read LCD control reg . to ACC
Ace
y
MATERIALS
RDATA
$1275
Read LCD data reg. to ACC
Ace
y
WAIT1
$1289
Fixed sous delay
None
y
• PC Board: Riston, Dynachem
e 3M Label/Panel Stock
• Dynamark: Metal , Plastic
DELAY1
$1295
100us times the ACC delay
Ace
y
DELAYS
$12A3
5ms times the ACC delay
Ace
y
SCANKEY
$112E
Scans keypad, sets KEYV AL,
KEYBIN & KEYASCII
None
y
GETROW
$1323
Used by SCANKEY subroutine
Ace
N
CONVTOA
$1317
Used by SCANKEY subroutine
Ace
N
* AUSTRALIA'S N0.1 STOCKIST *
I
VISA
I
40 Wallis Ave, East Ivanhoe 3079.
Phone (03) 497 3422, Fax (03) 499 2381
LSNCON
$13C6
LSN HEX to ASCII via ACC
ACC
y
MSNCON
$13D1
MSN HEX to ASCII via ACC
ACC
y
Old Reprinted Electrical Books
Beeps speaker 1kHz for 0.25s
None
y
None
?
IX
y
None
y
All
N
Ace
y
Build a 40,000 Volt Induction Coil ............ $9
Short Wave Radio Manual (1930) ........ $23
High Power Wireless Equipment (1911) $16
High Frequency Apparatus (1916) ........ $19
Build Short Wave Receivers (1932) ...... $13
Vision By Radio (1925) ......................... $16
1936 Radio Data Book .......................... $12
How to Become a Radio Amateur (1930) $6
All About Aerials ....................................... $5
Television (1938) ...................................... $5
Shortwave Coil Data Book (1937) ........... $5
. 1928 Radio Trouble-Shooting ............... $24
101 Short Wave Hook-Ups (1935) ........ $14
Vacuum Tubes in Wireless's ................. $21
Construction of Induction Coil ............... $21
Tesla: Man Out of Time (biography) ...... $22
Tesla Said, articles by Tesla 292pp ....... $74
My Inventions, by Nikola Tesla 111pp ... $27
Dr. Nikola Tesla - Complete Patents ..... $93
Tesla Coil Secrets ................................. $13
How to Build a Solar Cell That Works ...... $9
191 4 Catalog Electro Importing Co ....... $14
Electric Arc Furnaces ............................... $6
Experimental Television ........................ $25
BEEP
$13DE
DISPADD
$13F9
Displays address in LCD
DISPACC1
$1423
Displays ACC in LCD point.IX
0ISPACC
$1420
Displays ACC in LCD fixed
SETADD
$1447
D10US
$1498
D100US
$14A1
Delay= ACC times 100us
Ace
y
D1MS
$1480
Delay = ACC times 1ms
Ace
y
D10MS
$1409
Delay = ACC times 1Oms
Ace
y
0100MS
$14E6
Delay = ACC times 100ms
Ace
y
D1SEC
$14F3
Delay = ACC times 1s
Ace
y
01MIN
$1500
Delay = ACC times 1 minute
Ace
y
Displays address in LCD from
keyboard
Delay = ACC times 10us
NB: ACC must be > $02
play will show "uP. in stop mode" on
the first line and "SWITCH OFF NOW"
on the second line.
Step 2: switch off the power to the
MAL-4 board.
Step 3: check the battery warning
LED (LED 2). This is used as an ammeter and indicates the relative power
consumption of the MCU. When the
MCU is in the stop mode, the LED
will not light. If the LED is illuminated, repeat steps 1-3.
Subroutines
Finally, the MAL-4 has a number of
subroutines that the programmer may
find useful. Table 5 lists mos~ of these
subroutines and their addresses. SC
Allow 15 weeks for delivery of some items.
Payment can be made by cheque made
out to Plough Book Sales, PO Box 14,
Belmont, Vic. 3216. Phone {052) 66 1262.
F EB R UARY
1993
51
|