Introduction to
I Chapter(4) Microcontroller
--- ---
1'111h,,blr n1,11k!1: 11 ......
~ .. ,re llf Lhc ~,11.,1,u, :-
I btroJedi.,,1 t.• n1i.-r,-.:,,ntn11lrr xi I
J ,1 , •rJmming mt r .
• ~iu,h ,,t :,,l'\l ,mh1h..:turc JII I '~. ~ ,
II •r.; 111 IIO:> I fam1 1y.
• ,n
t'\,,
· . 1
it-i,· 1,; 1,1lwr nurrncon w ~ ·
\prh,,1111111~ 11f mi(fl'll'.lllllTOlkrs
•
I ( l, I ~! 11 1
I
-
(.1. 1 \\ hat i~ microcontroller? Expl.ain in short.
. OR
,, rite .1 note on complete microprocessor system.
An~.:
1l .\ :::1,-r,..-11ntrnlkr is a cornplt:k microprocessor system, consisting of sf ;
;;,.7.;:,-J ~rm•tml of RO~I Cir F.l'RO!l-1, RAM and 1/0 ports, built ca a . . IS C J
::'.t ~,::..-n .. ,1:1111,ll,·r i, infact a mlcn,computcr, but it is c.1llL'li so beau• t
,.,rf,.:rn wntrul function~.
~I Tl,,. J, .. ,,;1 ,l'r of a mkn,wnlrolll·r ic.1.-nh(y .:111 tlw lll'l.'lls to t,ui)J ,1 simplt
-~ ~IL 111.,ud 11 ul~ <>~ 111,111)' J, p,i-,1bl,· in .i sin~I~ IC.
.;J Jnr 1·• .,1111d,• J mii r11u •r, trul!,·r mu, t indml,• full ur 1w.1rly full
:.111,!.1r,I lllllWpl'I~ 1--.,111, l(U~I m El'l(O~I. KAM, r,u.tlld 1/0 ~
• I ;,.J 1111th.
,-., i,_1 " • w11r11lll'T i, i11t,1i• wmp l,·, th.111 .1 mkm11n'l(L'!i..'iOI' \leca~ it
J, I )o t -lllJ•11Jll•nt,.
11 ; : Jr.I, I', ~Jill, llll'il.
Q.2 l)cfi,1e micru1cml11,lh·r. lll~t~ ~11 f ., ·- • · · · ··
Y our •u\•.anlt1KH uf lht wme owr
b JU'.J b)bll'lll.
\l.11 I''
I !
. ., 11tl
'
\J•.11,1.,-:,, ,,1 m i, 11•n'lllr11tln on ·r tnilln}'wH•,;:,1 •r·b.i-.,J ~)' • ll'rn .
th,• ,\):-111 1 mkn,.11ntml k-r i, I,•-.,; th.ln ,1 mirtl•rm,.••,,or-t,,l.,.,"tl , y,11.'m.
,.:I ,\ m1,-n1<:,,nlr,,lk r h.1 ~ 111u1~ 1/\.l , ,111110\111t·n1~ th.in ,1 m iu1 ,pnoet..,'(>r-b.1-.c·J , ,.,•..n~
1:'.tI !\hffi.._.l,nt r,,11,·~ c.111 l,• u-...·J in \\ id,• v.1ndy cif inh:lli1;cnt prriducb ~uch ,Ii lfl
f"'r.-.,n,,l ..:,1mpul1•rs l..,·y·l'l,,ird!'. M1,mpnx•·~or-l,.1.,._,J ~y~t,•rn.. c.,nr:ut be u...-.J in
~u.:h intdlig,·nt pmJuct.s.
,,, l ,\ bn.r l,)w co:,I proJucts :.uch .is dect ronic IO)' ~. cl,-ctric Jnlli;, m1crow.i..-e o\·1.-r,-..
\'CR~ ,ue b.1~-,J on mkrucontrollcr... l11ls is not lhl! ca~ with mkruprr,cec.'iCir ~ d
Q. 3 What ue the m~in fo~tun:s of 8051 ?
Ci, e ,my eight futures of 8051.
1\l,11d1!1, 114 11'1.II, I~. 1'1,::?0,0ct.ll'l.ll-1.tl';,,1,, ,,-,, ,~ !l.• ~ .:
AJ:j. : Th, main fcatura or 8051 ■re a.~ listed below :
· (ii The &051 m1cmcontroller has an S-bit ALU.
M The l,051 h.ls 4K byte (4K x 8 bit) ROM or EPROM.
I !u:J The &'.l51 h.ls 128 byte (128x 8 bit) RAM .
I
I (ll ) It h,1~ dual !(>-bit timer event counter.
1
1) It ha-, 32 I/ 0 lint-s for four 8-bit 1/0 ports.
'11) It rnn addrl'ss 64 kB of progrnm 1m•mory.
l '1 ~, It< •n ,1drlrc~s (,-t kB of data m,·mury.
rYlil/ Ith.,., puwc-rful in!>lructlon sd , con~i~ting (If 111 tmtruclions.
tixJ It hJ, t w o 1•i..i,•ni.1l Jntr rrupls.
1
~) l ht• 11()51 has d r>(.k upto 12-!1.1111. f,.·,111••ncy.
t (~ii l·u1J-f1:aturcd serial port.
t
•
I
II '
-- -
- --I-[
.---ffij] i
,
,,
;;
r
'- -
:!
~ !:
~
• • l~
j ! i:: !! 1 "
•• a
•
j 5
,.t
•
~ f! i
t- 2
Ah3. :
1, ,, .. •.!1 0 1" 1 Ill LI,•• 11,t.·rH.il lilu, ~
l•1J ,r« u•,nwl ,,,,,t.. 1l1J );f J HI o ( 1'41.'i l , th,•n• "~ 31 rint .,, ..
2J l.n add111un w lii,•'-t' 32 tilllil'f
co nlrc,J ~,~n.ib Jll d po w..r-rm:., H prn~ nr~ p ro1 1,'"1 t,1 n,ru
i.upply 11 wc t ck,ck cr)'ltaL
.._ ,.•nl~ • II 4-1
,oter •
,,. . ,,,J ___.
~
.. _ I,· -•1 .'•'•:.~,r-"'
'
·--,·,,, ... .
!:, ,., ,..
,· ,, ..J.ird functi11n<; whid1 make UJ>min,~, ntr 111· .• . . - - - - . - . ~-.
.,,A~ ,,,. AIU l " ' '' r, •mt}.,.,- - r, t, ,.,,,, .. ,.
r 1 I• tJlcludcs . • , ,1ccurnu ,itor, i.l,11 It p1,inll'r, a blr,c k ,,f n .. ,,. • •,. ....,;,-:,.
•·•
11'
r~F1~ttr
, (ll·«'f~L~h·r). 1,., r~ •r.d ;:,..,.~·ul • .
r -~•,,..
Ail th<""4' b\Ol.\.q Mr c·11nncckd tr, 110; 1 rntem.11 ~ t,lt ,J.1,. I,·,, ,;,.nl1, ,..,
' ' , \l'1~. I •f - r...-.:~, ,J
I rl'!\I
111,'!-<'. I'\-~i, lcrs h111tl• Jah• Jurino
,,
1/ 0 tun~ f1:r and rr,ntr,,1 th,: 1/ 0 y<if'•,.
11,r Jrchitl'<lurc diagram also mdudl-s RA~I ar.d ROM. n-oe 1-J;" I r ., • .
t R(l~t/ EPROM and 128 bytes RAM. __ > .n ... n ....: , ,?,
\ 5~ pbin 8051 memory !Mppin for 8051 microc;ntn>lltt ;,ilh th, kt! · Gf - •
~ diagr.im. 1 t 11~ ti- \ 1. 1 r, 11 , ~, , 1•1 . 1.. 1 1
~,~ E,\plain in detail how 8051 microcontrol .iddrntn two
l\l,11thc1s,;ll 11,
,ns, :
!I The SOS l addresses has two sepuatc memory spaces :
,) Program memory space
ii) Data memory space.
:) The memory map for 8051 is shown in the following figure.
FfFF
FFfFl l
Vpto FFFF
Upto
64 kbytes
of
:~~T
T~~
c~tcrNI IIXXI- and - OOF8 t:-r
ROM OFFF : . . . . - - - -• o-4 id:~
4 k b),e ~1-luna,an d ..,~
Of
intt-m.t tt),'l>l<n
RAM
ROM ot Ul! b\u,s
EP1!0~1 RA.\t
3) The program memory space is Kead-only memory (ROM) ~pa.re.
f) This me.rr.ory space is used for storin·g progr.ims .ind v,1ri.1bk J.1u.
5) It is possible to read program instructions from this sp.i.:,1. but t!-.e pro...~ ur.r:.::
write data Into this memory.
6) All instr\.iction fetchl-s are talcn from program mo:m,1ry $p.i..~ .
The data memory ,pace is a re;id! "'nhi m,•nwry ,p;ic~.
,,
71
The processor un re.id dat.1 from this memory ~p.i,e ,ind c.an wme 4a Ill> 1h11 IIIICM<'C')'
r.pacc. . . .
9) 11 cannot ext-cute ,~trucuons frnn, this m~mory iplCt• '111e lllll lnlelt II RAM a III lhit
mf.'mory bpacc.
10) lhe l2B byt<-'!I of Internal RAM provi llll'Wi119dltti. 1112 • 5oa-. pert of
this is uftl!ll rtlforri•d tu dJo h'Klbll'f
,_,;
- ------- PIUuPC?ffi£it
Q. i [1plnn in deuil other microcontrollen in 8051 umily. OR
Ll~t ~u cic:rocontrollers ol 8051 &mi.ly a.nd stale one feature of .:la.
i\1.n :1 1111 :1,J: I I
Ans. : bU51 ~ a ~-cond gt'flt.>ration microcontroUer.
r, i,o.s, &0.9, &050 :
I) lntc-l's first microcontroller was SO-a8. The 80-l8, ~9 and 8050 all hnL ii I •
arc.h1tl"CttJr(S with the exception of memory size.
2./ ln t·ach cal><', the ml.'mory doubles. S0-18 supports ) K b)1e of intemd a: .,.,. 8lfl
'>upporb 2k byte4, of inll'rnal mt.'lllory and 8050 supports 4K bytes of I 1 Mi
rrwmory.
11 7>~'> ha ~ M b} l(''> rnlt·rnal RJ\M, including 32 bytt-s l,f n•gistcr/mdllOIY IDcet"'
11 ,,. ~; i;~ ,,n,! I\U-,r) hin c .i tolill of 128 and 256 bytl'S of RAM n-:-f",'CU\'fi)',
4J I I., •· rr ,11 rnu,111n, ill'r!t MC low co~t Jlrti<lul ts .inJ lwnn• ,ire \ 't•ry p(lPWilf•
11, '>'J,-2 :
I/ 1• , 1
· • ~ " •,. ir,1'1 1 • l')p,111, 11111 of hJJ°) ).
ro l'J:? I ... ' ' l ,)t< ◄ f 1 11I I
!;!i',
1
' ' ' ui.1n l<OM ,and 256 hyll's of onh,1,u,l RAM.
1 ,,I.,, .. :, I ''' ' •r,11111111 t 1 ••1,t.
, •· ' ' ' \Hi t1• l.11t:•·r 1''"" 1,1111', jllll th,\t ro.1n u~ m,-tt-
H ll ,,. c" .t ,,t rJ(2 n
l I ' 1111 '"' tJ lolll tli,11 Iii lill'i j
51 11" I "'I 11 I I '
• • , .,, 1, 1 ) tlHt•. ,t, I I II"-"'•
1;, •,hit11 i ·• 1' ' 11 • 111111h•1-ti11wr. I hi, u1unlt'r•link'I' gh~
·c,, 11,r~re bc\wetn mlcrocontrnllen 80st ,~d8osz. ~
'
'
(,,!11\'~,e 3 foa\utn
<: ~\l\n'•-,,ntrolkr
• ' ,,, ,,
,,r Ell- · ·
o( 80Sl and SOS2 mkrocontmll,n.
,',\151 h.is 41. b>·ks uf ROM, wlwn•,H. bOS2 h•11 1'k b•·---•
, ... ~ '"
,
-
L. • • ,
(;r,, .... , .. l' ~•-f
~,;-1·,>.:Llnlnllkr &151 hJ~ llli bytl'll uf RAM, whl'rc~s 11052 hH :v, b/ t.."' d e;dx...e.J
)l.,\~\.
~1 i~ nx,,ntn1\kr 8051 h.is J du:il 16--bit timer c~·cnt rounttT whL'Tt'.i._~ li052 r..il an .... rr.1 ;,:,..
t, it 1i:11,·r c\'l'llt counter.
n-,c cl'\,I nf micmcontrollcr 8051 is k-ss than that of mirnxontroller ~62.
i;.,:h l,(131 .ind 8052 .ire us,..J in high volume applicatiOM and buth ,.;:.,.,.. "-' ro ., r.ic
\:.~e n1gr.1m. But in 8052 we can write larger prugruns th.in that in !lu5I.
9 Wh.lt is .l Microcontrolltr 1 St.TIii! three ,q,.andl!d ftatwft of 8052 ovn 90$1
111icrocontrollcr,
1. :
\11 Microco ntrolkr : A ·microrontroller i5 a complete 1niOoproct"SS0r S)-.m. ~ ' 1 ; Of
rnicrnprt>CL-s,Qr, limitl'd amount of ROM, KAM and panllel 1/0 prn-ts, t:'l."Jt on .l ..ir.~
~"L\l•~mtL•d circuit.
-a) Microconlrollrr is infact ,1 microcumputl'r, but ii is caUN «o t,,....;:J,_ ,t i,, u.....-J t.1
r (•rform control functions.
!3) bpJ nJ cd featur(!!; o,f B052 over 6051 microcontrolkr an: as (oU.,wt:
la) ROM: Microcon\Jolla 8052 NS S Kbyh.,o "'1 ~"flk..,arJ RO!l.l .:,
E!'ROM wtu-n:as 8051 halt-I !<by!'-"> ,>l IID!o,l
(b) R.AM: Microcontrullcr 8052 NS :!.."Cl 1')te\> ,-1 ~ml.U'd !t\.\l
whcn'ilS !1051 Ns 1211 l>yle!I u! RA.'I.
kl Time•evtnt counter: 8052 h.i, an e:,.lr.i 16--hll tin-:, "'°·n,t ~ ,..twrva,1,~I ~..b
.i du.ii l6-bilJ~m_er_en•11,,10"a=,e:""'"'c·-------~
IJ. \O Gi\'I: th~ ~ppliutions of mltn><ontrolln. OR
bpbin lhe various applica!lon1 of mic
mirroc,m1put,•r.
'.iicn·.::;, ,n! rnli<'r is :, &irii,;!.:, chip
'lh,•y ,in• u-..·d ·" i1uh·penJ,•nl rnntrolk'f1 in 1n.idtln,-s- •" .i. ,J,a,...,, in
]lr<Xl'~a!!l); ,
l) lhe)' arr used ,JS in.ichlnc \oub, ,hrtnl,•o1l pro••-"''" nwJi.;.al ·
sr,pb ,, tic.1lcd i;uid,1m·c rnnlrnl.
Min~Kl'lntn1llrr -·=-=----·- ~kro-pN
i\ Mlcn,prCJC'eNOr II a
I 11
Mt,•r.->;\>nln•ll<-r •~ ,, d1ipwl;,d~ I.
",••,Jl~,1 ;.oni;lt,hlp ,·omp_uh·r__ ,lt"vice which II callad a
~1,,r,x,,,ntn•llcr indod,.J R,\M, 2. Mlm,pn,cuaur do nat ST$
1; 0 r,,rt. i-o~,. nm,•r m a 1/0 ports, Tlmn, Memwiea
,_ ,1ngk. '".C...-::;;-;~;;J"-;:;~~-h~1M1~~~-;;j;;;J-;;;;;;;-:c
\1,cn"-"ntroll,•r 3.
t,,1....,,1 ~)'>tcm l\lficropJ'(J('eS10l' ha,rd If
1-'
a!
I Jt-sipi ls ,imrtt> JnJ ''"'I complex and expensive
___ :==--,,--,,---+-:---:-::------:--------
rJh\."1:\ ~
4. M1<n,-o:ittrollcr ha\'e no 4. Microprocessor have
ad\'anlili;e of designing RAM, versatility such th-• d!ligau,..
ROM ._.,J 1/0 por1 the amount of RAM, ROIi •
as needed.
Q.U Sri tel 1hr corrKI •ltrm•tivr •nd rrwrite thr following.
1 - 15 a r:rjcrocontroller chip.
{i) 6''lS5 (ii) 60286 (iii) 8051 (iv) Pentium
Aru. : (,iii &151
l. 80.51 rus -RMt
(i)l:!Bbytcs (ii)64K bytes (iii) 1K bytes (iv)l\oneoflhne
-
Ans.: (i) 128 bytes
3. The 8051 microcontroller has iru.truction sci of - inslructi,ms.
11)99 (ii) Ill (ill) 120 (iv) 110
Ans.: Cii)IIJ
~
WJ'iJ hJs clix:k upto ~ lrn<JIJl'ncy.
lt)l2 MIiz
An,.: t,) 12 Ml f,.
(Ii) ~ MIit. (iii) 9 MHz (i\') 6 ~!Hz -
s.
A""•:
llw •l;/51 a. 4
1 11
' " '·'
111) '-.'c:,,r.J
- " L'n(:r
,, d1
-ton m1crun>nlrnll,•r
lti)S.•,·ancl
,
(iil) 'lhi.-;
u (i\') Four th -
6
ftJH
Tb: I\OSI "'" ,, .
An.~.: (1111
•JIJ!h II.,, •~b ,11, ,, ,
• •
lu) lh
u ',r
•
tI •
- , ,1,.11•Jul)'·
, I) I~
,u • (i\') t,~ -
r ••
-
liil).'il.151
-
-
,•,)<·,';\
t · ~-\\ ~\,.nl..1.,nlnllk-r K'. han! - numllt·r nf" bit 1/0 pork.
{ii)2 !\ii)4 (iv)A
',I 1
.1.:I ~
,.. . i'r< ti,.15'\ micl'\~"\111trclkr NS o1n ALU ol ___ 111! (~p~dty.
ii'•I' 1n)lb (iii).12 (i,·)M -
- 1> n,11 a ch.J.r.Jctt'fi~tic fe.aturr of 8051 micrunlfltrolli'f.
11~ U,yte uf intm\,ll RAM
\r j ~ U,~1e uf int.'11\.11 RO~\
,,·1~ ,:JrJ\lcl bidirtctional I/0 port
:.: 1~d fCJtureJ ~rial Port
~ -, ,-~i .; kbyte (1f int,:ma\ RA~!
.., ~J :;,icro-ctmtrollcr ha.5 instmction sel of _ _
•:: W (ii) Ill (iii) 120 [iv) 110
:.111 1
l;-.:d S'.i51 has dock. upto _ _ frequency.
'll 11 MHz
11 112MHz
(Ii) ,I MHz (iii) 9 ~lllz (i1·) 6 MHz -
l[ C(ifl>1sts 111\un;,J RAM.
''! 'l<JM (ii) ~rn;s (iii) &l51
(:~1 !',l'J51
,,J~l Micr0<onlmll~r JC ha,_ numb:-r <1f Mbi! 1/ 0 I'""
rI I l Ill / 2 (iil) 4 (iv) S
,~~., r,.,; 4
.,. Arr,r "'Y, t"ll"w m;,: _ is 1hc l•tc>l ll•bil ,iu,;I~ ( hij' ,,,i, ,.,. ,our"U,,,.
1,1 >/11'1 (u) "'1J5l 1i11) H!~lo (I\) N>li
i,, J:,r J'; J ,., ,,. ,,f 1111,•r, ••l IU JM i, _ - ~ __
i1 om ,ip~u rn) ~~u
_.
-
,
'
""• : 1114 1; 11
-
1nl S ~ l'} I<'
tn ,-Jx ,,f $1151 Microcontrollcr Chip, tlwrc ,11e _ _ extcm.il interrupts.
iii 3 Iii) 2 (iii) -I (iv) 5
Ans : \U) ~
:.3 1n &151. !:? :-~,;.ii function registers occupy memory space from ___ -
(1) llSH to FSH (ii) 80H to F8tl (Iii) l!O to lfftt (iv) Norw of th(.,w
-
(u) ~l H to IIFU
t.Ucr!Kontroller 8051 have ___ .Ei..tcm,d lntl!rrupts.
(i) I (ii) 2 (iii) 3 (iv) -I
-
Ans.: (li} 2
___ b a characteristic foaturc uf 8051 Micro-cuntrollcr.
(i) Four !l bit 1/0 Ports (ii) Two !I bit 1/0 Ports
hiJ) 4~8 RAM (iv) Jiuur Ei..tl•rn,11 lnll'rmpts
-
(1) four 8 l,it 1/ 0 l'urh
:1; ~,1icro-tunlrnlll'r 1!052 hJs ___ cl<ll'rn,1 I inll-rrupt~.
11) :? (i1') 3 (iii) -i (iv)!-
Am.: tu)3
27.
Am.:
____ 1> Micn,n111tr11lll•r
It)
(111)
/;1Jt1'\
f~l'il
/ii)
chip.
h08/1
(iii) KO'l I (h·) 1',·ntium -
:,,,,: _.. _.
1,.,1,·,,.fi,,,•.1
!iti) ,-,, /I', I \ ]
;
(i)
___ _ ,s 11,,1 ,1 Ml<n,,,,ntr.,U..r
:;i1~2 rni 111n2 (,ii) l',·nhurn -
-
\ni) l',•nlluin
~ll51- lllt Mkru-Cnnlml\t•r.
,\\ ,
(iJ ii \ii) .i !iii) 1,, (1v) )2
(() ii
_ i~ a Mi,'rn· Cuntmllu.
(i) ~l~~, (ii) tll.151 (iii) b(M h•-J l'J.·12,v,
~1.
tii)li051
____ is a Micrucontrolll'r Chip.
ti) SOSO (ii) P-IV (iii) 8052 riv),S,,"_;o,;F, -
.,no;.:
tiiil W52
lnld S0511-.·lkrocunlrnl\crh.u _ __ R,\M.
(i) 12il x 8
{i)J:!SxB
(ii) .iK x 11 (iii) 6-1 X ij (i,·J5K,cS -
Th.:: in!.l11Jcliun set of Intel 8051 micro-(ontrollcr coot.I ins !ot.i.l ___ ~.,,e-..:.:t:,:r..
(i) HI (ii) 72 (iii) 7~
.i,ns.: \i) Ill
• ___ _ is a micrucontroller.
(i) Intel 80ii5 (ii) lntd 60Sb
(iii) lntc-! 6052 (iv) !ntd 8008
Am. : (iii) Intel 8052
37. The 8081 ~-licro-cantrol!cr has inslrue!ion !,t'l uf _ _ _ in.~lnKt:,,n..,
(i) 101 (ii) 110 (iii) ~
Ans.: (iv)ll l
8()51 1'>licmi:ontrnlll'r !C h,wc, _ _ _ numb,·r ,,f S hl lit l \",'t'-"-
(i) I (ii) 2 tiii) .4 \i\' ) S
An~. : (ii i) 't
31. The 805! Micro-<:untrollcr p.u1 JJ.Jn-,,,i _ _ _ pn,:un111wm,,r,·. ",,-:,
(i) 8kbytc (ii) 16kbyt.- (iii) J:!~b~lc \i\·} i,.i~t,11,,.•
.\,i..: (iv)r,-tkbyte