Académique Documents
Professionnel Documents
Culture Documents
MicroProcessors
By A A Mockford, G8ZGK'
AV E YOU EVE R
sta rted a p roject
then found that the
functions required
were not re adily
available from the chips that you
could buy? Have youhad to abandon a proj ect because the
numberol logic chips orl he board
size became unmanageable?
lf
'"
, '"
,, '"
"
D ESIGNING A PROJECT
TH ERE ARE FOUR STA GES to go throu gh
to make any MP U do what you wa nt it to do.
1. Wr ite the instructions lelling it what to do.
2. Loa d these instructions into the MPU .
3. Put the MPU chip in a ci rcuit.
4. Test its operation.
(Repeat steps 1 to 4 until satisfied wil h the
result)
To take mese steps in tu rn:
Ste p 1. Writing the instr uc tions is easie st
done on a PC com p uter, using a text editor o r
word processor. Embedde d mic rocontr ollers
are small MPUs that can not usuall y be expanded to biggermemoti es, their ins tructions
are written in Low leve l assembler language.
67
DIY MICROPROCESSORS
"~
"."
1arrss
"""'''Ii''''ptII1ll,,,,",
.." .
00'0
iqlt lO/l
por!A.'a l
:ilislow'.tu<nl/le LED1""
,. is hogI1. M'rl t'loLEDI 0"
""
.1uml/leLED I ""
'"
'"enss
00'0
",nlIO/l
",nl2
00'0
"",, ",
""'"
'" .,,,
00'0
;goNdl 101l1tlS/1ns1tv:t>Oll
00'0
<"~
p(II\A.ral
-"-"""
'" .,,,
.tvm IN LED2""
THE PROGRAM
A SI MPLE LIS T of ins tructions is sho wn in
Table 1(a p ro gra m) 10tum LEO 1 and 2 on o r
off in response to swit ches A and B in Fig 1.
W he n the s witches are closed, 0 vol ts or low
on the MP U input pins mak e the o utpu t pin s
high o r +5 volts, and the LE Os a re on . Th e
inst ruct ions a re obeyed one a ller the other.
So me ins tructions are identifi ed by labels that
may give so me indication 10 their p urpose
and a llo w a ju mp o rGOTO to that inst ruclion .
So me ins truc tions check the state of so meth ing. e g a high or low voltage on an input pin,
orth e numberin a registe r. Other ins truc tions
change things, eg t he num ber in a reg iste r,
the voltag e senrtc an output pin , o r the next
instruction to be obeyed. After each instruc tion a p lain languag e note ha s been added
afte r a semi colon , to exp lain wh at the instruc tio n is doing. Good p rog ramm ing is nor mally
writte n in small modules (typ ica lly , no more
than 100 ins tructions), an d includes ma ny
comments. This he lp s w ritin g, tes ting and
changes w hich often a re req uired a t a later
date.
SIMPLE APPLICATION
T HIS IS A S IM PLE application an d is idea l to
start learning abo ut an MPU. Each BT FSS
(bit test , skip if set) in struct ion makes the
M PU loo k at a n Input p in (Irom a switch ) and
e ither do the next instruction or the next but
one (skip o ne instruction]. In this way t he
M PU can make decis ions a nd ca n take different ac tions b y Skipp ing the ne xt in structio n. In
this examp le the different actions a re to turn
lhe cor responding LEO on with the BSF (bit
set ) instruc tio n, or oil with the BCF (b it clear)
ins truction. BSF m ake s the outpu t p in go hig h
to +5 voll s, a nd BC F ma kes it go low to 0 vo lts.
Wh en all the instructi o ns are ob eyed , the
68
...
....
'"
,.
-""
I I I I
'.
1811 81181181
I
'"
,""
".
.'2V
'"'
'"
'"'
'"
".
'"'
""'
S>,':V 2'W
'"
"M ~ ,.
".
."
I D E A S
FR OM
AB R OA D
Availablespacedoesnotpermitreproduction
of d etail d ra wings and photograph s - G4LOQ.
T R AN SL AT ED
BY
ER WIN
A ND
D A VID,
E DITE D
0 4 LQ I
arcn. the
antenna has a
2~,,,,
S7m
21-27m
lam p drive r co nnection , the connection to a f 6 key key pad , a se ria l sh ill register to prov ide eight
inputs, but using only th ree p ins on
...
Llltl
Inst....Cl II'
MIIIl
GOlO "'~
inl" rupl BIFSS portB,rb4 :is tbo rb4/SWA poll hiljh 0110"
~,
IIOM.. 1 :~ IS ""'. turn the LID t ""
m~
~,
IIOnB ,rb5
poMr.l2
OC,
RmlE
poM r~
BECAU SE COM MERCIA L AMATEUR rotators are inadeq ua te, a second -hand indu strial
m otor with a built-on reductio n gear was
used. 1/3 1/2 RPM is ebout righ t. If too test .
an additional reduction gea r m ay be used .
The ou tput shall, whi ch is d irectly co upled to
the stub mast , should be a t least 30m m dia.
The co nt rol box should pr ov ide a de lay to
prev ent the moto r f rom rev ersing d irecti o n
be fore the a nte nna ha s stoppe d co mp letely.
Wh e n the an tenn a is no t used, a servo,
co up led to a wind van e, park s the an tenna in
the posi tion presenting the m inimum are a to
w ind s over 4 0kmlh.
5 1o.Cm UI _ _
L o ,, ~r ' h..
c ma, t
""~ ~ario'>g
_ l.iPPf't anl!-1"osl
"..,.o;-'l
THE TOWER
FOR THE DESIRED LOW A NGLE radi ation ,
the antenna he ight sho uld be a t least a half
wave -leng th, te 2 1m. My tower is 16.5 m high ,
A se lf-s uppo rting latti ce towe r should have
a bott om sec tion of 70 o r 80Cm ac ross and b e
set on a concrete base of 2 m 3 [3] .
For a guyed lattic e tow er, Fig 2, a cross
sect ion 0135 - 40cm is suitable; it shoul d be
so lidly anchored to a co ncrete bas e 80cm
squ are and 50cm deep . lts guy s m ust ta ke
not on ly the w ind loa d o n the to we r and
a ntenna. bu t a lso the torque exerted by the
a nten na on th e tow e r thr ough the rotator. I
use 8 mm steel g uys , elect rically broken up by
egg in sulators; the gu y anchors a re app rop riately massive (3). 1must wam against the use
ccrwcr
COMPONENTS AVAILABLE
IT IS IM POSSIBLE in a few pages to p rov ide
an 'introd uction to progr am ming' co urse, howeve r, I hope that thi s arti cle ha s whetted you r
appetite to expe riment. All parts d escr ibed in
this a rticle m ay be obtained fro m any Map lin
store. The m ail o rde r addr es s is Map lins , PO
Box 3, Ray leigh, Essex SS6 a LR o r telephone 0 1702 5 54 161.11 you wi sh lotry you r
l.iPPf't Sh.cm.. ,l
~~a,...
Rol" tor
gvysl . ll
("9<' - -'V"
NOTES
MICR OCH IP AND PIC are trademarkS cr
Arizona Microchip Inc . Diagra ms and data
ar e re produced by kind p erm ission 01Arizona
Microchi p Inc,
SOFTWARE AVAILABILITY
FOR THE Aid To Eas ie r Prog ram ming d isk
se nd a ch eque for 5 to A A Mocktord , 4 7
Ke ndalls C!ose, HighWyco mbe, Bucks HP13
7 NN .
69