MC Unit-5 Notes PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

\ao\f

,W 8os t
*
Deshu,
_'\J

'Tiu^\v.rq Su.bx out-rr^e

Bosr .--, 2- .I-\\A^{-&.

.f-\*^grL
O
-

Srwr€fr t
D,r klb
<-- Tl-tt -j tr--'tU #
.Tl"\cf,> o I
C
hnnltli [1 fvro la*l "tt1] P^O

E-- Tfu ---, 14- T\rn"+.ru a


G;o.ta -) o g[c^: ty&f.rflcr-)
qa*a -+ I <xte.Y"ro.{. 1-l. lco

c- 1t =D T!uq1_
ctT :,L C.Oc-t-\rt*e.it

Mt v\o r',.odo opatu*iGt.t


Oc> a t3 -th trn-.ren- r'.oJO ( rooo *l Feeh)
ol I 16.b'tt tL (oooo - €Fmd
1O a_
ts -trt At ro re(o.e/ (o.
rl 3 -r' D
S'ff .(r,-a-cyr-
n"e/e.

4
Ex", Fi*d -ar@ ae 'm^oD .ta oPe\oJt€ & n& Awe&
e
t\A -rrr-ao -4ottoc^:\^3 m"clo-s.
Ex
") 0ado t T\u,gr
q
I

v ",)
Mo&
N{o&\
ft top
2- tu,tQn

'l*i*,rolu
(aale
ooo
\+
noc6 mt
I 0ooo
<V+
- Tivacvl
1
o r

Gpxc\fitno
l\^odo*z

=
Tim4erLl

lO,)
't't) Ti'}fl({o
l.{r&2 -ilu,aen O, y\DAA-> ftrr,rOn- /
Tf'^DD Ll
\_-.1,-\-,
<L--
t--^/e
v
UL
Pstr".0
J4
{o!t9."ig
exXsto'!'PYegute-rtaieA'
-
tz'MHt
'
b) '''tJ'; 05'q2 'f4 Hg '- ' t
") t/,. o+ Cr6st<-[
IL\OtE: RoSt'T\iinelui''tr(c- &q , rregoxd

o&- i^ac{&canc-til&- t1fl^q

Trlro
' ?{e ei^s
b,

I '
":i,fl

I ;4v 4 Cfiveq X.tAr- s


. a :.
(e- t.n Frt
,

I
I
it

rt
,

t.e

t6
:b) c-:ve-,,t KrlL = "t.l:,?I:: MH t" . ,, . ! ,,- i. , I

-C- tt,oSgLMHL - O'1Yt6M Hl


+ft1 -- =
c-rr c["1< fue+. --+c - : . 12 -ri I

)' I ': t'Q&Sl((t l


.-r\N,rerL c\K "f\"^a'P ffJ*d- 7 - P'iz t6 MHr' :
Llot.al I

[.*.'
Ex: Hoc4) q\.g . -$,mqrr o 8A t $tg"j.ted ( StgPed 91 f*Stn^UlH,.[
24 :
.i

' %pl'.-.
tz* i-'9,t t3'". +r-.Sl tD &3 K. ":
.rcod
'TC0*l t\ I 1- D
&fuq oaQy

Tt\ TPI TPO TC{O _, ffi'h

'iR .4t0 rfr*eru 6nF


( ripnen run Lr ftnzr(ru OAI "

Couuyo.( bi+)

) )
'i-r -- qtr*,..1Ju euen#too ,+W S.etS <,cl,-o-^" 't'ir.rren tri4
oV ar-rFteLcg, , (i e) Courvtt yo[\r o\rerL &gro" FF FF. tD ooco. "J D.

ooq c.o-\^ die eteL\< t


fu tto..:i"6 fvrS.fv uCf i6s,
ft,ct P€
't-Rt I Tco.-r ,6 I rn-t -.
\a{Ao -tr
T-Ro(rcoN.+
/ r.6
rEr fT(oN,? / eeh -) co
Teo 1 tco6l,g I eo4 to!.gr*
SErg 'rer{ Serg .rcoN.e tc>a_dod
lser_s &Eh
LR -> .lte,q TiL.\aL
C
TR i _) S.-t p *ivwrr_
)Se
y
,

Ass..
+ '-a
[] o\^qrL *o4q I pgrg Vg r,,n u.nt,e i _

.e
dc.
-- Lr>o.d -tua- 'rt rouva-{.,-^o V^q(stet [*&ic-rti 0 ot^ic].,r t.P t^-'€
tO
-tt"\^eJL is to toe- L^ged o-^^d u:L^ic,k t{rrrrgrr- r..,r.oc{a fa T rn Sec
SeLeue-d . *o cvec
- LoJ TL ( Ttst venisterl ' c*:o-rr,r t.^?t-iJ coc.r.L.r-t P2"Z
, vq-L.d-s
*)
.

Sto-ve -tu-L -ttylrcl,


w
- 6[^3',
'>
k"ee-p wronigo-v\\^A *1r^o rlr,trqrr- *tq tr-e) ofrq Li ) x-
{ua " TN.B rtrx [ato1o ]'
yaixd.
r a^aorg uc+ie.. 'ToS& t+ ft& aO
ItA
o
qel oL\* Df *tu\_o_ t_op c.rt.-A^t -pF kqcornoqr T-r'r
hi7t.^.
d,) -(c
--2 Stop -hr.a- .ft^^g[ .
[e?.'s -
e c\eax -tu.q TF *t*i (A
4oV +* Y\a-&e l.O.r-,,.CL

- Qo boc^ -\o S\qp to


2_
[oa& -rF ( ]H
o€oi \A,
tor{,*
r
(Fr
ly
1

\_
.^t
Scanned by CamScanner
Mov *lnDD,,Sot6. t

bo-ct< ,
Mo \)
r1iA^r,L o m.&'l
'ru; {foo h
E/

t
0\AO U
t oad, ?*i q o_o
1".
!r' .
rHl1 4*o"Ee h
Co._r_r.tT f1
Sers 'f Bo, - te, '
t' .\
"i'^^e-0-
I St ouL-t li,ntgrr
Aqaivn' qNp .TFo ,eqar* a
0 , 't^]ait (-ul"ipo
CLR
)
-id h,
= 1 1i.. TiY'r€rrov(
Teo :' &ro7 Ti"r*erz-
CPL ?L,3 6
CLR TCO
) -g i-oq4, :ri *g a. o ve&}l,,"- l{A
S4N{r 6+ue j xelocd -169 ti me-r 4

f^^qLl {r,.' rnoao- I +o'


4;:* **.-# sD)- d*t
.'
lv)
cl;r./q r--'
-'Asst r^e
ToFl .=Tspe :-? yvrkc_-
Y\*u = >r.f{t-te- t,

Stuvte\ Qrr 4yeq.C.?\ =


. .\ ,..:

'tru\ e-\& po1^oJo


=,
i r. " '- '
d
rn 3 rrrn-X" G 5.5-xrDS SsDo obct<3
o" K.qrRJr-!q' :=_

- - W'= 6'55'35 -$sOQ' *- 6ooS6 -, tsJg\


6SSSg b
.Rrr aX ?gms H'?,.
)
'r" ':3'G -sche+.otig, vl-e.1 4'rvoo xeg /r.-Moo
-t" +{,J
,Pvury"y vdug t" be t.JoJ in$ r
/ Mod€.
to Se\ec! 1'r wng-r1 I
MDU TMoD ,-$-rota , tin,qr_t
Koc_k
' .Lace1 t'^ov turSBqt4
t

Mov TH ) , fi o s* t, ,' lutd 't *iu*l cs uut'r--i,


frt't'rex fo*
S"ptts rR.t ,. .. . c\.
. AfeJ,Lf \_il,rqfiL {
atai,^
, 'xs TF t i ra€*ita,
qLR rB I

cPr_ .? Ls
cLR TFs
SS [^p bac6
a Pvel' uP
C1e-t"oYqte
*re4. ol aaMhtt ,
Fil,"- ust*,. s- \ \1^ fttu& f
4r:-" Ug,L T\P\LII
G^ - Pitnr &'3
\Oo KRA
r f.r
?ea XtA u = L2- l"'\ Ht "
;*, K-*f = toot<r+ai
-l9r p

>t tc{
t"t.,*r..-qn Q.\\( ,F[ea = Ir- =t 4C)v \bo KF+L SEuaru
rr<r cvq{tlc- k)o^rQ
: \'t33 /lHtE*
-F: too' - I( l\t.

.=i
v:

1u,- jt, rx rEt s& = t.q l[,ct

.i -<-AEt t Tosr :57tJ'ser


'or*t
+o
Xn*u =>uMH{'
'fssur^a .T\$^-qx Q\\(
: J ntkr. -[f.Z =
r-\vwlu. e\( Qeru\oJ.

I ? l.4HU
\n : S zt'tr-q-L
: Q.t666+ A, I ctoLKS
c>'s\tw Ay
L

6Es36 * ur. = 6vrle -\ = g'1 = LFLI' h


rth..\ ,T
L.
]KJ
e\ o?iBl^ -piwrtul tvrmlq
[,\ou Tt^ob , { toh ] r

EJi gv t)
TH -jl_ bo.-C-\< 0'^ov tut , Ho e +h to*d iu\+iJ.ti cora.w*
.c -t" {id t\ou tHlrSOfrla.', " ira
gr,.'Sn fe?.
H'-nooo "n1 g1]alt* T\l\ u
.'s\,rqoJel ' s ET\g TRt ', I

ot
A?o.^\,\ : JNB TF \ ,oto^n
\,LL\,t--
-o
tv1 cLR 'T8l
rQ? cYL. P2.3
CL.R TF
'
STt,\P f,o*e \r
r or}9-
\sV
ct/
3r%rcr*'-
t E*^, Creore q Srytr-a-\e U(=*uQ of tnt6t, poTti6\,I
t
:/-. bacv I tr
I ots Ale( + [ou: govt\orn tDts ,us(. ^.i';:\rwro- .n.
Cv6stoQ XTAU: ll.O5q2 i4Hg' U}< 't-rr,.rerr t Vro& t ' S
,. J
%on^
;,o!r'
4- C

C
-Gsili*rogsrrs
c(
Pu\gq uctcl+tn s to g_E l.tSqc,
sf
Lolrr pe\rt\crA ( \p.). l08-s /-rlzt-
+ti6tn povr\orn
C \*y. loKsl.{sac. 3' $qvrt\o
De-sived t\rne &(oX = IOBS .(rSec. 3 ,tnrSec +
() XrAu: . -,\
\\,DSq2- MRe ?ork o
J
T\tqer e-\K (-'{eg, ( e) -- -5.
(e * Lt'::..,
,r= tc"9u6MAQ
T\'rrngr c\k gesioJ c.,\ * t *
Lev) /-o-Lo-u
t t'' ? =ZGrt6 : l"o8s-ak( r

To Jtwd vo-fur.!.J to Le [o o.doc$. twto TH (.TL


o') hs &r Hi?u po
: lo8s-rrr
-rinrcir- C\K per\oJ l, O ks l.I=( =t.m
- ]]
c-ort ) /oto-t Deg?\'ecO t'-..'
b) ass36-_ h: 6-ss3,6-taco : 6hs-re (t , xrAL :
I
i s Fc !-^'J
\B
L^,\l q?twut C (r
.tI TH -TL

I
Ve$\'+\q+ier,"

I ( Ftrm+\- F3rs)x r"o8s,u..p,


a
T,n.Q_U C \k

I \ot\ rtvr\tio.l frMgL lo 8f ,.tt&c


i Ctry.wr oven ggu,nr ctK-dalq-Y
' dqired v)s 31"
t
'ri Pra- .l"W c'Sq t

-rl,r.,rqfL C\k. 6ss36 - L.


CtCtU .

Fc 16
Fc tg
t-C -\
'--.,, \
l rrrcr ..^
\alu < !.. .-
lo ts /,rs
f"\ou TMoD r jH toh ', t rvno&
Tirvq:r- t
DftiGA{
bacvl Mou TLt, Stgh I (oqd iuitioJ co\^M i,r
[ti^!_ . two u TN\ , *.oech rs?
:

ht, sBrB tel ', sto.r-t


I $NB TFt, o.Soivr ; ",'J:**
Keep terei".g +itt TF = I
%PX^
St-B \RI i Stop , tirvr€rr t

_l--t
frrs
- e
CPL P('tt
CLR TFI
t.
' Cteo.r rinterr r ove#lo.^:. {taA
g5M? 6o-cr

$e-uo-to*e
a. S?uolo usose .-,rit!. s,Nt $x^t of,
-}'
3 rnSec + o.\^ of4 t\uwq o( totnEet olr o-Ll p?t^r 4
?o{t- o . -AsSt'^*o ob XTAL -= gz l'4Ftt

,', Llge rTrl,ror,- D , l"\a4q /


p-eu6 M 1rr 4,
,oss-trkc,
:
ftLt. 3 rns .

; TH(.TI- 'T"ee -- to f!\{.


I &s Ht7^, por+\g-
N -- tom ac>l (s.o poy+rg*)
'l^s =. Destued t'r,tl'q &ur."g ,+o\t
\*'3 ur'r1
' \P* : ttrrrvr''t.
(t , KTAL . 92 t^ttt_
hf-A. = >r-MHt
qtN^.qx ctk -tre. (+) =* .t a ,t
e l. 83.3 M F{t
q{a.,.s!- c\r .reni"J=*.D.Svsy'11&
" J.
pen..0 6,Sqsr{
r
L
t^r: iH-,"^ : ssoo q\ocrcr
O,SqSq jU& :
r,A= *S.t-
o,StfLt
r tBgss
?
6ss36 * \f) : 6sC35 *S{bo 6Ss-la- \ :6frre-tr3&
uo"'
=- 6oo3e =_ EA gg.h =' w8&61-*
t'' Yr ff ?H 'rL
,.a-

i--ru J .,a" . s;,* ":I-i, dethor (F ppr-+ r


- i;,idv6lue) *r.
_<,rrO;o r_,,
ir,itor\ Va)r,,e r
Eggg
TH TL
k
9ro?tcr^g"
Irt
Meu {tol
TM0D,
Bara Mou
I ritn'rtrro Modor' I So"
1 TLo , *f 6zh I tead ifttie.0 ualue ,ou rL4 TH rq ?et.tt{
Mov -rtto ,c* ogth +o Ee\N_Iqle Lsu.) porris..r of guaruuw
)l'1o'\'l Po ,. F* oo ', [qaWa Poft o bits Lot;
4cquu deto,X I c"-Ll &t*U S.rbtou+tw
Nnqt 'tr-o,t+ grr\ ,, UJ2d "'^itiJ uaha ,"trn Tt 4-Ttr Y<t. +o
tAo\, THD, S osA h g4rrcrate H(aH pbktio- of s7i,o,rL r,:a( Mcru

frrov ?o ,HoFtrh ', MQ\<o Fo\t o btr ttg" Bacs Mou

Ac Auu t\sst: l.^o\,


De14^0 I cq-J.l &toU S..byou*irq.
sTt^t BaCK . I\DU

D\: S Etg TRO ; Stp.,ud,' ttnrqrL o SEI


agdan: Sr.rG
"€"*n : 5NB TFo , aTAvt oclit 491 "1{tn 1qr
t
tr6t(o ven .
I
CLR Qt
TR-O Stq *ivvtqn_ o
CLR CI
{po cleo.n. Te
Rrr
+(.e? u
\
) tett-rTrn rc molvr Pry*'-
C.

S.

_9 *g
-ASs."rni cx$SrJ r M Ht t"-rt'?te,
,frW
9r6ut to
a.
'2 ev\ p?.rr eg'9 .
gu^lirq*a + p^Lr" tvd* c4 2- R-c-
14Dd
" _-
tLg,L fiuaruf fnedO t '

w -i') .( = nt,Tn: :
( r---
tt (, 33 r.^H+
f+ ts
vM

'- J v.) -Tl


"f
omo
t'i ) &nfon u:c Cov g/"^ard{e cr:"fft^
L*rnen "lt,*.-
.o noi*,rolt
f.,qri"0 (orrw\ oooo
tu
1 \-.

r.z\,^j)
q-H f L, \otts
Det"U s ( frFE +t -oec6) v D-(YFqfl
i-
La\8zj,.f t?r^o- .&t U = 3!-g vq&r .' (,fr,n, fwi+J
Csqur eqo g^
0Tu9arc-ul^r.lugr
t' {t'' '-

--

o\€t4lau:

S,sr';
L*'7*
t.rha^r-^-
_
"Y
t tr-soc

tit (oe..d -ru\a_


Tt"to0, Vo-L^a rf effistq\ tr"&c_aq,9
eohcl^ *\u,rQ) ts
tt: te- u_kd or^-& P.,ta-+ +.q
*(n.elL ,rl.a4a-,
di) Lrnd *H,\-o .-I-H fuffa* rr>ot*t'.. *aa twi+r.J
Cou-tr..tr v^Xl^"
Cou-r,'.jr \r^X1^" .
I
ait) -$anx -1"^o- €,,uo,u I
GO Keq Mev.,.aan^r^g -+L^a tg ub?+-
*.^4_ -- ,-^^ I
3NBTFX , (o-LeJ fwg+v.,.-r{rga
*o e€q *ffi
\{- ?us Vr2i.sad , +* 6>r-u* op -+..e toop t-,.:l,tor,r I BacK: SN

CP
-1iF :- \, I
CLB
L,) ctes.rL +uq .rtr #n, s
C'\) W ,-e^. .fo I

_s.teg
t tiul
- -So.v.1q Mwea_r_ t i
**uovnle^d |
$.1, -.{ss

ur-v\*-e kost ,4* +": *"ea k--


rtw pt. s Co."*i**,^o Que;u{ \O ;tlS,"e- Lt-&
f 0.t tst-g 5,,..o& > -te Cjrec*€ -tk!-
Sr'

)ek*a.
5o!:, -A*s.^"rS*g XTA I: tt' D-fqz- i4t-(L, u .fiuen_ o 146/4-_r_ ,,

&stv.d ftav.a- dr-[*-q -- . 40 ll 3<c,

^a
'l-t$.\Q_f\ eu( #va7 . :P"s." tr.o19 xro6
t!- :-c o"t>lG tl+t4.
qi^ a-tt c\k ?e_Nio., (r) . t'oEs / !ec,
f
- t*,'#-) o.,\uql .tx pe,.^e/ *
o
J-ostued t\c.\o &o-rav -= (sr
[^oa\, \j,
fo(l Cc)Lr\tl
oLet4b.r, Ccrutg o UG\
Ao.tt S€{, - r
*tns (\ zSSt( * i.^iti-/ \X t.og f

hry 2 fl,.(*',o$ cou\rt :


(-t)ra'r* /

9tq ( ueqw"-)
x rLG

.,

D S L.ttex*- &u,-^D.
?^J-ic-.ai""y ''' !v.i+\",i Qo-lvq te qrp toa-d*-d t.^-*o TH f€fl t
,
9<-t4-{t J*.a.q
-TH s DBh,
1'9ef.,ct-S

*-=*Y3bDt'ots/i
te=D TF=6 .TE;o
^ I
'otsJ,!-l
Lti}---r@
.

t*iri "J -IF:O TF:r


., ,
4obl<-t'
Mo.l Tl"\@, *t o: i .}tual o n,rodo I
fu-p- .?+ffisr
MDU THO, {+oOSh ', [ud ',,^ft. Co.$l* ?r,tto THo
gtrTB &r _

tRO 'r Sta.Jrx *tr*e,n I


a^rl,^qtt^oL
Gacr: TN\g TFo, Bocr
C^.:tt0^-f
'z LDa!1 L-r!\tfl .[-F: I
LPL Pt"s'
CLR TFo ', C[eqn t-tr fu -h-^a he..l4 fow*il,
SJMF Ba,Ix.

j- t cofiP eo }-eurafa',l'
^do- :D,, -,-\Ss ".l^l.\Vg -{-r.^s.t c-\IB-$a-l-= Ll-f Ht^
O. <+votrt- .,^>oue c{- }req"'to^-n 'tRe(t-
+qiE u_ 9^ fiu t,z W9€ .t\il^{-tL D r.v>&'
Mo& z- '
u.g,<_r. tJ-t{ KtAu: Lzl.\t\L t?l,r-l-sr- o

)&Lr"x - G \K${r T= \\^^sq ,['r.t,Q


[+rw{-ef
d,xire0 &o-t.ru i1;nr = Gr*= b tJj* '
,t""g"st -tt+r,e- Ada.y pDSftiq ' Lti.^ . S*Bi"-A i.s,-..r.^te*
{air7%- &o-l^3 : t FF+ i -" a) x o'fuJrrx l[g'

o' 9 ua. (.cc , &]-n fr \^or- po(3 i g ta usov{^ f^^f $e{ ,*"0
",
LI.UL cot,._rr.*eA_ @\

: o,S vw$r.
-o'S
S'trt s 3's-? A' q c'ss.-r*{

t-^.ov TMop
o:- I

6le-rt:., t4eU "


1=S tri -*r. o .4&e do z- '
RO, Sog
q8oJ*t A\bu Tu.s
rsoc.
Sa.rB TRo
Bao+ I 3US T Fo. Bo.*
,eLR TRD
aug rrtrD'
DrN b PO , orgo.iu
.U
CPU P[,L
srup €1" uA

.lF A*"{ Dqta- TYo.l,..Sw,.tS Si gr^

Saqr:

tKD

R,x-p,, .

.-. r I
Scanned by CamScanner
Scanned by CamScanner
.*L gcoN
Snt / sutt
l^ot_ u&d
jtt kosr
lv\de
O ., Bo!.d Ra&e s 4rs.
St"V+ Yq , rraoae
It-
al
a, I | 9-bh uAF.r rro&" , R,Rs vq^i..ato
{ l-(.d-a-,,+rar^^{. (<sa_taltag
(cr-rtl# t stoJrf, / g d-ar* bi+3, t swol,
ol b D 2- g*b\t uART i^odL, B,p.Qs_. Cql&ss
Soto +vou"{ Ce".rt*i',-l , isr*g.,3- -
-'-}

r I 3 q-b+ u$?* rr,to&, -;T;T*$:


rLt
PE Nj -) Rucoirr. tru\o.h b- bfr
rR b t
..r f3t
+ Ok-d ?.,r N^e;4" > e r.,to&o Z
T1- -') rlViaa,'-*ry.\r
AWrf n^ot-
.?\ 4 ' t
Rocoj*1.
a

g C\o.va Ua.^i*lotr- bq.rpX Ro*< :Tt^\


I'^o&s-l 4- p.edr-
I go.+e V-b.*e Cs^^- be-
?e-l,*CI-rc^ted by Tinru-'_1 * For
*(^!s Pt-^"rPD,. .t a,.e-n- I f s rko tq [^&c0
fvr
r* 2
B@*d zs@ o os.. ,$*=*
MQtln^u\o
3,
^(zAC
r;;0-
c-ac_[o_t
Ml c $r,"eq s -fosc-
\>.
1

I
-Wf@-rliffT-:
i
Rosr krUR, Cogr\r,1u1, u$ Br Jivid-qJ
I
r+ /c
3> Left*e (s L^kC Lg
ir_ ftnrott / -tO
t_
l.* -h" BK .

t
t--
?roflr,gutlui*t }o-. g.sr P {'rs$R S" M
Seda.\\U:^ M
==-
5 L5>-d .+\^q TN\oD tf.en-1'S1qr. ur":?ru vo{r"a- "^ [ to I'I
SE
LJ.Se- qtd.NtX-r t,n ttto& u *e Set 1t^a Bsr^& t1-*:fe"
FIqx* : cL
itqd Bq-u-d \{t?r4 q--
\ L.,*d 'rHl +u= S*5 11A c0 oI

3+ Lo*d gcDt \ lt=q . .-.:-.-tto *- \lo-!"Lq so \ =t.D u'k t'A?

3e: Ju
S.ri.-l $.,todo-1 , \-,.:\^aa!- o-^,r E.-h:rt &o*q ?s fiau'-/
er>-tfl^ Stc.Y\ 4 Bto7 L.9.|3
\, S.; TR\ "to ', ' 'to Sto.ruiltt Nran I ' Er,.
,---.----=noa*
5 c\e-o.n TS- .r?t ^ c LR tI- fws+YwLFi srx .
0
I t,^{\\te o\ dJrg[yo-c1err tc lae- Eejr\t t\ *'{} lua- S RUF
b e,\n-qcrd -t!\0* TtL +t^t tott "^:^s-tt^ J-\tts Tt. L^g:?' g'
-
1L€(-./

otrxS.$rwCJtr$,t to Se-o* f€ +1^o c-t ^o''lrarc-tet t"\o"e g'-t &a


<ro-l.-r4e-re-& Lou\^?tofq[\0'
8^ *tL^o \ art- al^olfa-$q
-7 :o -1p grt€? 1s) to 1"1-ou\fen
l4,4{
g-oS\ AU? to "${b.\^\,+et- (eqrcfu .q
Y, t^tf'r.te o.-^,\ ,
MO

-9e-srio.llra ort q(ffi &at^il Rq*e ce\,.ti in uool*L.6 MC


I .

St
S'!^'' ASsur^"\5 qr.dt.t-"\0 :- \rlc>s?D- 4{flt '/
1 3z'- m_ C

i
94* rg K wr€ fir:e-Lt n*o& r- " l
t' KR 5 ?6ao
Ac
l"
.lr2 .f-^d vaJ)^a- .t-o he to*&d €.^+o TH t t-D
Ar
o,s
9* BR : g6oo i
Stta4,
2- n DSC. ka+- T\k"r^$fo. I
W) 6 Roft- = Gacx
I

Szxt rx Crr, -rd :

16oo - z"x tt, otq" x rF


3zX r )A L e56 -TH I
Scanned by CamScanner
Scanned by CamScanner
lrW slb"{
Y .-U.=:
Pl'o*rornt^nt,*gt -tqo_ BoSt tt> Veceiue
U
- P*{!
'-[or 4trrgt 'steP3 rel|e-\t )&tqPg .ao. lronSf<l p

Ao*a se_\\o\\.{ t flv-eutous


'p-qe) .
P
(!rt) c(eox. q uot$*n c-uQ e trnstVucliS,la "

Ni) chqc* -H^r Rr "R*g u:itt^ SNB h,


*to - See ?+ -t\^r clnor\athe\ V\Cr! bqgq gaCk-l
Ye-csive-$ o.*.
, Qii) Sf Rs is se* ,
gBuF ag a bgte
,bre -H^is bgte,
Lviii) go rD stqp's +o fscoi\F :t-LQ hsrt
., ]

'e'xl" t".-\vi\e_ c.^/\ kosr AUp *o ,


'--'" fecoivq rlu\e!
-ser\io{tb , t,.fi-pr too.\^d \:crte g.6oo , R do.tc,r bt+s ,
tJ.g
I ' '$qo* Sto,? bit ,
Sot\mu-Lto-Wan:**&d S<-u.d neoiver/
't-
-A
\ogte -ts p-(1 9. '
(r-
,ti

MOU TMoD {t rqh / lqx


,
,,
Tfnne.,f 1 Modor
t\oU "tHt r*Fo trDb i Ka-i^d fqte_ = e-6oo
MOV Sco$, $t sDt^ : t-fit 4otq, I \toa loit,
t
StrTB tRr Rsau:t. (t.e,l
&tqf,t l CTR ..e1 ,?s. e-riuo-Ubd-
Bo-cr : SNB Rf Sto.rut ..r-?a^aa_ I
Rt ,Bace
uealt .$ot, chor
t^.DV
A, SBus *o
7
l.{o U P2. A J
leP IADV pz, s BuF.
sT^,tr Sles f .
l.lrt?te- ar pYoEYolM *o feCoive -tu\o dota .^i."fc.u lr.qJ
J#, -'fElf* au&
beevr 9etlr. Tvr Se^i*I SQhd tt oed +o
lr\.11!t ,^
:___Jj'
. Poxt trr Po\q\\etr '[or'rn' A\go Sa-vq -fl^o- &o$o- a*

tr"uSfu R A\\ \oco-h\el\ 6oh'


.ASs.,"t^^-\.^q Cvyato-[ s 14 [-{ {
IAOV .TP\OD, =fl toh
gt"^oD s
tv\pv THI | {+ otrD\ fkr^e yq*a = 9600
I

t\^c\J goSt .S SOh t,.&q*a- e-trc 4 S-tcc+irg


, tobe-l SP.[B TRI SaInoc/ tt od_a, Stop lai+ .

CLR €A
gatk- l SNID pa,Bact<
ATy A. SBuF
,€ I\,\DU @ ,.4
Mq, 6oh, A
o'4 toq NDp ag heve I SSf4 he'C
it Clnata+-

@Lue g fu& Ros r


o
o
o rlaV1
t
r *5'1 )

rte! qttotps o-ccosS n-o etqwre-vrt 3 0p o* #regue,n*(g


tt
i+s ,

U.Sed to'bb to.ftt. mtvrtunuq oTevo-fievU. # o,.. exov*pk


otueil *ASS.19.,,.-0= -{^O* 4"V A. Cev\ai\ orp?(ico+1g,t^ i,,-rlq U.qAd
,& VO/r'n q. ?rn -h^-o Yauge r>$ O .to 9, hte- Cor- U$s
(e>u * rrp .\aU:\o iln sted- o(* c-o-tc".\a+\,^g fr.
oR(\ 3DoH ov.'gt.l d^vec*ire f^&tcorel +^q
(re) tso.r) l:or)
) mgd*tat : DB qqln, Ssln ,3c h
beg?vr(.,t .aM(
og q,r @t) daao
r 6'.t , m.6 dotar : D,3 fi" ,'i,, .'f
:uo-bhd. t"tg&o-ta I t DB sS ,6g,qr_
t,tgdo.}o q ' Ds .'T fanb
o Ccilrr< in U.o&n*o 5 ; Dt3 o ou,t ff llotoik
lo.r"t6,'1--\ -y\-,)
\ '
\-- 1--r,
3tt k)D
ENTD
Lr-) De€,wo B,Ute tDts) uSel *o da-fiwi-re &-tcft
\ Ao*o o-d S'ror e tL^.Q-l ^. {.,r "_W;6wd
L_> tALu^ [email protected],
D?vee?ve 4o* ot
a^ d of 4,lq*,
8K=213 13 address lines (A0-A12)

8K RAM address range 0000000000000-1111111111111

16K=214 14 address lines (A0-A12)

Each memory location size-8 bits (8 data lines D0-D7)

 Write explanation of above fig.


Testing the Design
When we are designing a 8051 microcontroller based system once the hardware has been assembled, it
is necessary to verify that the design is correct and whether all the ports are working or not.

By running several programs we can verify the design.

The initial test is to ensure both the crystal and the RESET circuit are working

CRYSTAL test:

8051 has an on chip oscillator for supplying clk signals to internal circuits of 8051 . It needs
external crystal to operate. external crystal decides the operating frequency of the 8051.

ALE signal will be high two times during one machine cycle.

To test crystal, ALE pulse is checked with an oscilloscope to verify that the ALE frequency is 1/6 of the
crystal frequency.

If ALE signal is high two times during one machine cycle means crystal test PASS otherwise crystal test
FAIL.

RESET ckt TEST:

To test the RESET ckt simply press reset switch and check whether all the ports are in input state (HIGH)
or not. If ports are in i/p state means test pass else test fail.

ROM TEST:

If 64K ROM is connected to 8051 means

64K=216 16 address lines (A0-A15)

During ROM test by running one program we will check whether all pins are properly soldered or not.
In the above program we are verifying that each address line of the ROM is properly wired by using a
series of repeated JUMP instructions that exercise all of the address lines. In the above program observe
the jump addresses (only one address line is high at a time)(0001h=0000 0000 0000 0001,
0010h=0000 0000 0001 0000)

Suppose if any two pins are shorted means both will receive 00 or 11 as input. So above program jump
address will change and program control will jump to some other wrong location and above program
execution will be disturbed.

If above program is executed successfully then ROM test PASS else FAIL.

RAM TEST:

55h=0101 0101 AAh=1010 1010


Scanned by CamScanner
INTR is active Low signal (INTR bar)
+ 'rhe- Eost pc is useJ +o Prr"viAg the covrt'r"l
si3mo.\ s to tl"e ADC
{-o j'
F\nS ?2,5 r?2.6, FZ.+
-rl-,e A^6e ar6rnrnfcLed

, ,NTR oF the
' Pins ET, G ADC

+ whe', the \lf voltu{e 4'ot' +he gxasel is varried


the "lf oF ftDc a\s a Y a'xieg
+t',e crL it- ls c\e^t thab tl^'e Aoc
+ ft'otn
y 1-o *Le cxo c,ntrrc tt e T ' rhe P"-ut 1
\, t-evfo. c.d d i r-e ckl I{,,

tS used o.s A.n ilg Qort ush;ch -d?ceiVeS the tlgib*t


Jnto- {oo.'"r the ADc
ak ? Z.e i s o=.J- -[.rr S Lo-^rk .& CotVeltsi"-t' (S - c) ofe'irotion
i..e tnr\e.'-. :,^,E: o ) A DC Jcorpes \lf 'lo^( co,rlQ-6Sioxl
&rtr<^ &ro^"^ AnC / go5[
-rrr&E€-S
ir rfo -aeJ dlg,UJ
6 =o
i* tphe- the CosV eT SioY) lt oVQ-)f tj,., e ApC t"\\ Se-nJ

tsxxrPb SiSvo'! frr"'-i- e)


-lp the
o.y1 Tvr -
o0
t: T^"'"
co.rve.rssioo'ot';#sr:t]
tl,e p\y_, 0 L. + j*+e-, e,a
diSlto'l A';* throur$h tlne
Norr {1.e ILL ="IniveS
poek I *r-\^,is d-t<r. f*&Uex Corrr{QxSlorn {o {eci-'"ql
efn .tl-,e LCD .,ood.,\e crd
4"",J othey
&^r*) \S Al39\*3 c
j"isg\ay Jev ic-€

HC^\ APP\ i ca' frovr r o'.meCt ftff', sef' S o"f G t LM35


"rF {or p,,..e
'\^c, bet^reer C-)
"tlp 8iY'S
Tevn ? . 6e-.n so-r)
V,","' L+) 9a V i"'

OP ADC
ADC starts conversion when it detects +ve edge on WR bar pin. (make wr bar=0 and immediately make
WR bar=1)
DAC r^n kex4acinS

rhe dl3;t*l to At*\og crnnvexbqx Cu nq is c Aevics


.t"l Jelg u se-A to cornVQxt di3,Ut y u\s e 5 t6 o.- o\q s i gt'o.\ 5 '

DAc o8!8

To cRo

-\9V
t{oe 3o ll
[. lv,lserFec;r3 D Ac ogoe {E
-rhe DNc o?og \s o- si*g\g rrnovrolr bh;c B-bi t- DIA
Coove{tet^'
+
d;scxete vsltage
+ 3-\nfub Dftc o$oB p-eovides "56
pv cu-x.sevrL) leve\< oF out'qub '
J- t|'e ; s a6tl"'r€c*-d to
1r-, the atove 4t3 Pork oP tt \
rrhe i/r d-ta \r.nes Coo- D+) o F DAc osog
eithet(
rhe olf to.tr.vr {rso:-n DFc c^-n be- olose*svC
afr A Jlglt*l ,>,:ulti..n epe Y @ 6:11 & cPo
ck-t (^)e c.^'/Y' &i'ppgYp/1.!l'-
ugi*8 the aborle feYterate
u^ul{cru-s
Pxogxawr -f-ox qey,€-6cH'rnq o. Sautoo Fh t^nvefo*e.^

To g Qtl eTa-te e ule ho"ve Lc otf da..'\o-


sar.J too Fh LD qv
uP bD FFh'
-f,xo-,^ oo rrnHalty , o.r, d \E sho ulA be \rrcxQ"rne-teJ
\rclre.n ',b rr<a.clre3 FF \\- shao\I be decxe'ag"n[<-]
ta ooh'

Mov ft, * oo
Bacr'. l.^ov pl,, A
lNc R iFF+l :o o

SfMP [acK

T)ri o.rn ul c"Ue

Bo.cr:MoV ftr{oo ) A=o


TncxS MoV PlrF ) o/e volue o'rn PT
}NC A A €tr up,^raxJ
t f-rnCY€wnevrE t'uarrSibioYt
eJNE A,tzss,Trcy i checx i€ F =255 , ",f rob F€e p irc-xQvaraT-
trj
Decx : Mov p i,A
DEc n ; dec"$e\rne'flE -F {o*r d owrr to'^*d txarrsitrott
c fN e B, *oo, Decy )c\ecr \pg=a , ''c yrot YeeP { s6-{e)denrHf '

S;uP Bccr @r ST},t P TNcY

i?
uax e g"te
To genersaEe S? uo\-6€ unv€ 'fi:ss ts
tt.r e"n oo o:n Post a
"t BOSI
8ac'r', Hov Pl ,4foffh ) o)f val e orr ,.r

A cAt-L uelaS

Mov P1 , oo'
A ch LL >ela3
sTM P Bo.cs
oe\o.y I MoV Ro, *oPtrh
uJ o.i L : DTNZ RG, t'rui L
6La-ix co.sg uro.ve forsro n
rc:r 5 SbepS

5 skrPs

ry 2
:5r sor the iln cxQ-rQf t a€ each 6{ef
-
Cw)esE--

Nelb : Mov fl,ftoo \oc-


s\
rgov Pl, fl [ov) o
A cA ul- oelay
L> stee ,.,r\dtln Aege*ds
Gn de\a3
RPrd'. ftDD Sr#5f
l.{aV PlrA
A cA LL Delo.y
cTNE Fr*9-55/EPTL
CLR C
PPrL', suBB A/lF5l
M av p \,6

F cRLL uel aY
CTNE ft, * oo, RPTU
STM P Nox t
Delog a
MoV Rnr* t5
B o-Cr< Mov RI, # oFFh
tpai t DTrrrz Rl, uuclL
DTNZ Ro, Ba-ctc
?€a
5in€ l,l:o,Ve

+5v
\ !

.v -9 ,

3o io"
v a\uee seoE- _ \qr 255
to PAc
-5V
To 3 e*enute 5iroeuuqv€ rpe houve to *lp Jigit*f ft,u"rrater'ts
Valu g s oh;c-h l\ xefnesevr L S\\ne uoav€ A.s Shod:1 ahow€ '
"r

Ar,3\e vs - vo \toge r\agm\ hu d e +tr sivrQ t-ooruQ


32)g-,
Avrg\ e 0 Vpub (vortrye M{ra;b*de) Vqlu0S SQvrL to onc (Ue.*"-)
LJegxeeeq 5\ -t CSv X 6tYl g) Vo tbofle Ma-grnrbude Xas'6
S,NO
5 \28
i
-1 "5
rQL
?_ 3a ---- q .?3 zzt
60 --' 9-sS
q 9 o "--- \o 23g
s t9o q.33 tQg-
-==F .s
c 150 '1
-t lrc .---- 5
t ?-8
6+
g Lto L.g
q 9-4 o o " d69 l+
o
\o L*o a t.+-
\r 3oo o.669
330 2"5 6+
l?-
l?-B
i4 3 6o J.
J
the -fox v{lriou s a*31e s,
To -[,*d the vo-1uo SevrL tD Dftc
aara
t\ e Vorir I o\la$ a b3 ZS - 6 bg ca us e thev€
\Ae e i'rn?l! -r'ulhi 915 > zs '6 tn{"r.E"
\Lut i 6 tov
g-s6 seP s an" d 't"11 ec^le ,rt, lro '

k,opuFjs'ble oR61 3ooh


\98, lqq,L3t,L55,93B , 1g L,
rs8,69, tl ,o,14)
5in€-tablun*, DB
64,lzB
P6ost* eourrb €qu 13 -------------> *o'oL sa^".rples

o.$ervr : Mov PFrR, * si'ne-ublg


M oV R2 , ccuvrt
tso.cts: cLlP- R
Movc ft, @ A+PPrR
l.lov Pl, fl
Dp c' DPre
DTNz tsq-,BacK
91IM P 0.3o-\ Y'

'To 3eb b- bettex Ioof'v$ Sirneurave rreQ? m €xctt€ abatt? '

,t'o.b\ e {o'r ,- J r.q^{Q.€ avgles


Mu IHP\e a61[152-uf E l\axA r.uo.{e

p-r\ oti$ ]:rhexru-uP|


?5:5--eB:

Devia€ ?. D€uice3 | -pNu.Ak

Pr ?"P 3:T3;

Trrte.s';uu.Pb

3"rr tefiwt- &cLnoPl9le"t"t

hl3\est Prio6\ty dev'ce- -- Jqv'ce L

VR D Vecboy addxe.S C 11S R alAxess of deU.e)


6\c*v,a*red5e ss*\
al.1$ '
&o'vn eosl ' r!''"e"ifir'sh:1.;J"ilil='R,:I
, duf,".";S:"1#.
adtrl)Jrl abQt-.;;i'': igr.,o.\
" '; ?iL*,
t" the ^nalt dovicq
B sse s
tloxouSh ?o .lp a'rly i P &e-v\ae
-l- is ..nob rrq?u€sEtra3 c}-\^
\rnlex'rupf - tF {,av i c.e
-!- ho.s o- pe.r.,J rv.,3 }vrte-x-eu-pb , , E Ir\ocE-g
tle cCEvroc,leJ3Qv-nc'rrt si3vra.[ -F.ror. the
Ne*F Jeviae by p\o.ciln3
a-'o'',Y.T tLe Po olF.rU tJrer, pxoceedg to iv,gext \ts oLDrn
j:nLezxuPt v€cbox- addvess
[vnn) \y1tD tt^e syse,,.,r d-t- brs{o-r
the East {o use }urrt ra3 tl'e }.ntexrcr-pp cgcl6
A Jeviee ur\h a- o i.^ \ts FL \/r teylexaes a'o inib
Po to i*'{or-n the "nPt b - \oweg5 ptri arriti3 d euice thaL lne
"l f
G.c\crau-{.t a*ns<r rr giByra,l haS bee'' blo Cpe)
LCD }.rn bosSaci{,J

B0 5l
Do V..
.Dt
D2-
D3 \ee

e.s Rls EN

LcD to
;! t antex{ac\nJ
LtP__!I:_{e: c-ngrign to pSr haS ll+ Pirg
LC D Co^nxreckeJ
zy 16 LcD
/
lf ow S
\,Colu"vtlrE

Pr'n s$mlol DescrrtPbion

Vs s Gxouvr J
$". -+5V Porlrex SuPPIY
vnn porire'r S uf Ply +" corrbco\ c ovrtxu'SF
RS Reg se\ect, selecr .^;In -::
i:;:
*l ,r
R/W=o -td-6tox'ib€ ,RIi.:l {i,-6 xer-d

EN e x ahle
Do -D= rl",e I -bi L &o\il bu s
LcD iov",^r*a.d coJe s +o.ble

code Cor.nxartd tD
(u ex; Lc D am str u ctiorr Feg i s tez

I
clea* drspl^U scyeey!
9
Reh"x".t hor^,.(
+ bCcfavn€9t CLL1rSoy f shlft cuYSoY to lett)
6 lYr Cxevn e"n L ,l r, :righk-
c sh;Ft- d;splaJ rrigh b
+ fr
le# I
I D)'s lau
P oFF ) CUYSdir oFF
A lt
AFF /t'ON
C I, dN J ,, oFF
tr
ON
'r b llrEilg
tr rl
ofrt I t' blintsin5
lo
sAtpt C uz 36v Posrbiorr to let f
t+ .n;g h e
tt
ls shiPr evrbz^e disp)qU tu Lhe lelt
lc Ir rrfght_
2o Fo:r ce 4 U- TS 6z- begrllrnr1J ot
tn .1"F I,14
CO tt
d"J Ilte
38 L \ ioes a,n d 5x+ zna-Ltix
@
pro 3xavn to disPla3 ,yne$SaSe N O oln Lca oL Iixe l, poS. +

Vo
RS 8TT P9.o co
Rt^l ts}T Pz.t
BIT P g.L
EN
i

t\oV F,*38h ! i.rrit LcD 21i.,,"e S / s.xry r'natxry


F cftLL Corrnrrn6s6| unsibe
1 call Couvro{dunn'rc au666utne
A CRLL De lag ; call de lay ,t

l4 av B,-lFoeh r d;sfloy oNrcuxsa( b\rtnriS


RC,ALL C-ov",marnd t^ltibe
A CALL Delo3
MoV fi, "$ a I
; cleav t.-eD
ftcf1LL Lorrn"rnavrd ulsite
11 caLL la3
ne
MoV ff, * oe h ; ehlPt cuvsoY 'n;3ht a$tev Tlr'l)s€
a &a"roc*t:f
A CftLL (ornrrna'v1J r,,:rsiEe
A CFLL oe'lag
tl ov fi, # 6+h i cirxsox a-t lir,e lrPos'
F cFLL Lo-r,"rr,avrd t;rribe
N LfrLL lelarl
M aU n, #r.,' , dtsp'lag \ettex 'N '

Acntt J*a urniFe ', chLL A"fa uu-ritt Subrout\ve


ACALL o"lo3
Mov A, *'o'
R CRLL dtta c.rrib€
AcALL oelay
[J e tvt : sTi4P LJo\'n

do.Ua-axl K : lvloV Pl ,ff )n --)Pd6t !


SEIB Rs RS = | {,}, Uto. 1e3'
CLR, RU) P/f = o {o-rt,rrtite
S€TB EU ) €=l
AcFLL oelay
cLR EN ")E'=o
RET
car YnA"nd Cotrife : M6V Pl/ fl t A-iPt
CLR. R S ; PS : o {ow Cat'"'tta'nJ Ye-3
CLP R\^) ) Rlfri:o
SErg E N -, EN zI
A cBlL oela g
CLR E^,} j EN:6
RtrT

D ela-g : ,-,1dv P-o, * oFFh

DTNrz Ro r t^ioi b

RET

J - segvnero I uispla5 r'ntexlacinj


+ -se "yne^ok Ui57lo.5

?t" a.
P1.

?1"
i-l , I'
.ll"
P

Pl.
Pr.
Pl.r
_T
Pl'o &
c9

Jp i Bo5l Covmectl on to {.se3- dlsrlaJ


eathod € -Se3taeoL
the otov e {,3 o CO'trnYn A:n
t! ,
S€Ve'YI

us in3 p6rrt 1- .

Jisrl"U is co'nYr€cteJ {D tl^e BoS t

Seg +ne.r, L tuvns oN r^rhe-.,n i /f -t I

o?\ oN
&zO oPF
P-cogra.". to .l i sp\ o! ' dg c-i-- a'[ Vr,.l ,,,eS O -5 cortrrnurs I g o:y\

the dis play UifK Sorne retS


Pl-? Pt'6 Pl,S Pt"li ?l'3 P,sPl'l 9l'o
..g -l e J c t a.

oir o ol r1 3F
.l-l
l- t
Oo tl o6
I

o-, Ol 58
c-_l
l- ol
-.
?-l 6l 0o tt +F
J
_t
(.' l-l I 6€.
o t
'l -
rj o I tl 6D

store k|,is LooK-uP "bob\e i.. R o l"\

d^t-o. o.k loco'tsiovr s Lottrtrvt 4


h
" S to"Y€
) 4-ro - QoZ h
ORG Ot1.,
5BL, KF lr,Le h, gPll
.- Se3- kab\e
BFh ,o'6h,
S.eve^n "DB
END

2$0 Ji3rs i'€ 36u..<'ttY

Mov R\,+06 ) R.l


-
"i
SLaxk : R.ola Pdirote.if
M oV DP'\-R, * t+ooh '
; Lo-A
i k=O to
Bo.cr I cLB A
't Ylo{? A-td- {-fo"'r RoM
A

Movc A,@A-IDPTR ?r; ( n+o PrR)


-
11

a5lrrj it
P\, A
o, o/p dor* to P J- '0t- &igP\
f4oV
ca ll d e lc-g 6ttb'ro
tl t\ rne
)
ftcRUu De'la 3
E (-.ala Po i<t k ^/
) ?.rr cae?re7r
]/uc D?T7 zo
\ ooP u"nH\ c otr'nteY
DTruz O,l Bo.cK )
ves\
gTMP sbo'Yk ) Ji gPlry ct'aFa covr bna

^-l
oelo3 Mov R?, o't-rn
DTtrZ RIr, ura'iL
u:alt
RET
rr 8051 Microprocessors and Microcontrollers 17 -107 Microcontroller 8051

17.14 Applications

17.14.1 lnterfacing Keyboard


Fig. 17.31. shows the 4x 4 matrix keyboard connected to the port 1 of 8051, 4 lines of
port 1 (P14-P17) are used as a scan lines and remaining 4 lines (P10-P13) are used as
:eturn lines. The algorithrn and program for keyboard interface is explained in the next
section.

5V
'19 P17 -7-
8
VC
XTALl P16 -E-
18
XTAL2
P1s -3- Return
P14 -V- Lines
P13
P12
T-
-z- I

-T-----t I
o @J@l@
tl I I .,,
P11
P10
P27
_
P26
P25
o---4 Q,)
-4
@
--4
o-4
P24
P 1.1 2 2 2
l4
P23 -N-
P22 @ @ @4 @
--4 --4
8051 P21
P20 -a1 - i
P 1.2 --d
P t 2 2
E-A/cC P07
o---d @
--4
o-4 @-4
P06 P 1.3 2 P 2 P
P05
RXD P04
TXD P03
P02
P01
P00 P1.7 P1.6 P1.5 P1
13
INTT FSH 29 I s.un Lines I
12 30
INM ALE
15 16
G T1 wR'
TO RD

Fig. 17.31 4 x 4 matrix keyboard connected to port 1 of 8051


The steps in algorithm are as follows ;
1. Irritialise P1.0, P1.1, P1.2,P1,.3 as inputs i.e. write'L'to these pins.
2. Check if all the keys are released by writing 'a' to PL.4 - p1,.7 and check if all
return lines are in state '1.'. If No then wait..
If Yes then go to step 3.
3. Call debounce.
4. Wait for key closure, Ground all scan iines by writting '0' and then check if atleast
one of return lines shows '0' level.
Key pressed ? No step 4
Yes step 5
5. CaIl debounce. (allow sufficient time for debounce)
17 -108 Microcontroller 8051
Microprocessors and Microcontrollers Microg
,0, and then check if
6. Is key really pressed ? (Ground all scan lines by writing
atleast one of the return lines shows '0' level')
No SteP 4
Yes SteP 7
7. Find key code and display the key pressed on 7 segment display'
(By grounding one scan line at a time and checking return lines for
any one line to
go to '0' level. )
8. Go to steP 1'
Program :

org lookuP-table-address 17.11J


db 3oh, 31h, 32h, 33h, 34h, 35h, 36h, 37h,
38h, 39h, 47]n, 42h,43h, 44h, 45h' 46h
+E
P.
org Program-start-address
beg: mov P1 #0f h ; confignrre lower 4 lines of port 1 as i/p lfldr
TIE
movdptr,#lookup_table_address;initialisedptrwithlookup_table_addr.
sastegr I

aga: mov a, P1 outFrt t


anl a, #0ftt G

cjne a, #Ofh,aga check for key released -iIIIS


fi BCD
tcall delaY cail delay routine for key debounce J(3ut tf
agal: mov a, P1 gI- lrt
anl a, #Ofh *ryte1c
cjne a,#0fh, go check for keY Pressed $rori
ljmp agal
go: lcall delaY call delay routine for key debounce
mov a, P1
AI
anl a, #0ftr
cjne a,#0ftr, go1 is key really Pressed ?

limp agal
go1: mov 11, # Olh initialise counter 1
mov r0, #Oefh store word for column selection
mov r3, #04h initialise column counter
aga3: mov P1, r0 select onIY 1 column
mov a, P1 get the status of retum lines
jnb acc.0,disPlaY check bit 0 and if it is 0 jump to display
inc dPtr increment lookuP-table Pointer
jnb acc.l,disPlaY check bit 1 and if it is 1 jump to display
inc dPtr increment lookuP-table Pointer
jnb acc.2,disPlaY check bit 2 and if it is 2 iump to display

..,rin*mfi
NOTE:

 when you are writing LCD program

Instead of MOV A,#nn

MOV P1,A instructions u can write single instruction MOV P1,#nn

Last instruction can be again: SJMP again or NOP

 In sine wave program

Count EQU 13 (the EQU directive is used to assign a value to a variable. In this example When ever
assembler finds the name count it replaces it by 13)

Instead of writing MOV R2,#count , u can write MOV R2,#13

You might also like