0% found this document useful (0 votes)
235 views122 pages

Digital Multimeter Overview

1) The document discusses various topics related to computer architecture including CPU components, memory, buses, instruction sets, and pipelining. 2) Details are provided on the fetch-decode-execute cycle, where instructions are fetched from memory, decoded, and executed in an optimized pipeline. 3) Caching, pipelining, and parallelism are described as techniques to improve CPU performance by allowing multiple instructions to be processed simultaneously.

Uploaded by

Krishna Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
235 views122 pages

Digital Multimeter Overview

1) The document discusses various topics related to computer architecture including CPU components, memory, buses, instruction sets, and pipelining. 2) Details are provided on the fetch-decode-execute cycle, where instructions are fetched from memory, decoded, and executed in an optimized pipeline. 3) Caching, pipelining, and parallelism are described as techniques to improve CPU performance by allowing multiple instructions to be processed simultaneously.

Uploaded by

Krishna Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

,g Downloaded from VTUSOLUTION.

IN NOTES | INTERNSHIP | VIDEO LECTURE

t'1 t'CXo Co..r fLe t ( ",r- -*-l


Like us on FB for regular updates

n f ^. e l* C.,- "*-t 0.J,1.


/.
* l'[4
t-

b*t
Mt,
-1 Lo \ cr-., *1 €fY
s,rf13&W
-
rv>f C"-aPi.e C"'t a\
" --r
,r) o*ca,r.,'--r r,?-t :R:I,:frY,[*
v ::::3; ff[-,trffi,o 1rd

n
"4 +t'--*Lv o--. *d' P cL-r
ftr^;:ff]), g LT '-',ot bt"t'k-r <'<-
J) n,-r^ 9,, "971;*' [-tc=-tze---e1 @

tio
$utk-Pe)* Ce-*-pe-L7df, tte 4-J b-" LLF e-*-a)LLe
@
z \
'3)
9-. ,nt**-S-tLc
(6\ J-l o- , -rl r-tto-$ilr u cL4
\:z
dLL'ed'-F-
\) 3+ ;. Lr'z-wa]tb f--" e**7'^'A z" Af '
a^ .e,L-J fl {*n,
U
l- o
^ ur' rl"

(, [Link] .^a a-
Ctf,t e'--" c'-
**-t*
L,t f c\--e
lu
F- - C t:* @&-J r,--tFgx-o Cani)Lte LU*r'l aAe' :
So
A
r),,.-, "*Er^7'7'c-'<- o"*'f3'(*'1 .r-', eed4 zS ut-C-t+zzo *97e-e-d,
--7 '
CD*3-eL4pLZm, 2 Pd-lla ^^ eal
P:owztu1, -/.*u4 /
][o Vf-.-> * !g^^*X-
& Rr: ; el-i?, crtLt*t:-c4-
A
a+ c-t--!
r) ".-.,g tP .,f f*":j : '-'7?. P,YAq-a-+4-z-
^--
t*"t'"4-" co*-'I"^"-tfTt"* t-ttl">s'a-'-'-^: I
7o"'-''i
U

3-) C-e** P ur- ct*: 1*

a.,) a-o^7f 4i-a-,€,:*"'7., *:'-AA* ' & ^W'*-'


e*c''L;G4-" 4e-el^-"^t2"'1 "^cTpalt
VT

a Lff--. .o*-p
_U U "t,1,
oLc .
t) i ead-J T*:,^ bf (:(i 4 /"{1ece'{ete 4'anua-c-e-t
0
<rnncxi a*LteL<za-:

*-1zzr--f e-o P.\* a, .Ta2eTa br-y :) {.4:l 2f ',^?C7


Co \i4t-"
-nlu"'3 11au> <Se^ -' ( oLdt' tZ 4
J^t.], t4t- e'l , a'9ftn't'u-y, -De, 'fr/
a- lo"^d-f ez'
(.1

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

Ran 4L( ak_ OL


RAr< l9a ,2(:6 "
t2&
(T f;"-, et-<> ua
q q3 L2

acl ?q ,-9D
) 1a Ps^*o L> C\1

( I
oS*"o-( 7:a\ b t

n
6 Cl
2ile,^f1* 3ot''t'te"o

<>*r,-t€L-D ? a+<- /1e+-


R Loe-k-

tio
e".DL-e-Ligra*a 6 l/
l l^.
ua'
l -.\1@

oN cLY 128
Cat^3+
,?om orrcN/ +2 )-lPc
n&-
p"xa7,(a^
Eg.t/L ol
C-W^e.-,)
lu
So
ffil
V#r
h-
Po Pt Ps
.TY
'L
D
Rr D.

/'a f c)-o ee-^&'e (tq


- ' -H-< t'' co^+ A
t
7 L-+ p't'^-t''^-- 'tr t' z o-.-frL'*iftc'
U

c
* ,*:;*- ^-';
TSi-l
-U"* :-A &nTak', J';et fi'r'^rz'o-'c
o -1 tu [Link] L--PJ-I/'- JA.<y(c*
(c"- e*c-J(L- t'a-1
VT

-_--=--- a;i(ct'
*)^. '*PC+o &>n-1ro
-i -, * xnlw)
;Oag"l
i-";",* **a pe,aA",o(7 ,-
e--ro co.*taF--J0:o-- '

tckl t^[Link] io t'otd


(1"c-n
nlv/ CL-' P ,{o M :
"'-___-===L==,-- -(-/ t-l ?.t olon tt(a-lf(< r>-e*ct*,
p,^-.ff*^. ,*r.(
f -Fta*:*-
t ,&J-a''-'- a ccz"1 .rz<z*aA1 :-t'i eL- 'a c'o""i c-

d:y:fgi e(c'
fi*f'"\1J *:'-A". ffuo cla(c' ' Lu5:L€-a'bc€'t
tt). fuJe& ^
ffo t ,*-r/ cGLL--t,L- )t , - ,* ,- ?^"&*a cL"t
^'/
- ( Ltc*'c1
t< p" ln t't ' ':'fCl"u
*1'^* tu
'? '<\z z:4e- L
c

;,a,-=-ab e

-;---il zpf*+r,t k Gu^J</a


*cu. p'nJ" t^^,<d.. o**L
Z&futlr Jr t, an-*.r,o^,'cJJt** .*rf.
d"*
p&e+f PLz<^-l' dttG tr-a^
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

fi )tc {nl-t; : <a:t--zaa a'-t''r- porl6 <-'n-"-ol .2;'- -t., @


(, e. -"U"'*d
v---.\ L\ 1n ,

eto-il- a--d1et-
-==t:--
,.*-*-^A A
Eq c.e-l-' 2i- CeJca'Lc lt--z ,7i(* a^'d Lddj-z+j Lr-c

t Co^Jtt-o I : l + ?. 'fL-a L) L@ c k c^-tl u?- eln* Cz)--la,a b LL'e

)*Jul-.-n>( l- 1fo'"-'- a( A-L- Ptgo "5

#f'1
roC,<-oaW
,(/ *bf t hta et--o co;b-@Lce*
J..-, a, C<.on -^ o- af QJ_ CCu" p, oc< pot^a e U f-e-p*ca ^--Z-o/ !gu

n
t (/ ,
Lo4 J b.-a
V L.-r ao
(
-- q tO?^-t ,t
*f "A
o?Lfc [Link]-Lr- A
-*-*-'-f^n
Qo ,>--t-t!.rr-lae a^-d f"*}f
L-814'>'\:' a^-^L^ Pe^At />1 *fif ' it:t bU

tio
Qa
. --rt
Ptn
Pf n ?**
cV1 e-ezoa.A-,t ch J-tt-*- bta-4,,oc- ,4ct3z, L^-@L4 b!+-'e.r,qu;}t' La_ C_"_(d
J
+€ /L -"ifqlr"^*"-*
t-l a,*.t7,^iZr^*uy: fn c d-c-( q* 3l Csu,Jz,<a Pcr< Pon. a&-,",v
o
q*
t,
@aa)W)
3j
[Link] : +-tl-1?s4

^t&;d-,^,l"
CoP* eo
akl : tYsn €a t t
Tf : Tr4s/v?p
c
lu
Ja:lo
,la ; ds
16,, 1l
.Za!,e s
J

srl

ej
.$1
It<
e(z
It< ^3
lcb?t- /lo4
e<s a( brt- I {o
So
rlost-fba! TcCS4V
tk <Ea drpuT
41: ss- q
u /2a 3r<- 3 e<fa.- bitl{"
4PP
..t t,'ca'{t-^--a
F

)
1-t a e-dL t*L-
'*n:
cte lc<'tq t4
*t-'d4
_.
ct-zt -t*t<-e- ( - dJP Ce ,,*p tJe-+
S) o-€p}e a*a-24 aJ
,Et)ft nf ru*"*h-*-tPt
a- -t''a--* H; fi o -n' L ('r'--L t^'<- cb dra
"
: frdI
U

J:1;r.r-*'L-i CtL-
lcLo cu*n'o
L-t llt u-oUn-te -. /'a bf t 'n^ -'-^eP '*7-C
(t t u "-f Ll
oetis*a*^@--o2- , /6 'y 3 '2 b'u
tu
VT

,; u- $r"u*J*Z *T.l L+oat-d od* 4-*' *'*^oJL q--P;LrT


-ta-4k2,
t, C--o-pab(e O*";1 €tta-xl4 .1o }--v)evL*@)'
[Link]-Lilx '1o l-l'-e LI^ZZ-'--' .
"2) 2+
A ce"-trte / k
-c)
3) 4
-,--;_r_ L,eltt
b^)Lt - ".sd.d ,^a-"Xr,.az e8' ^^*-3
,,:6-d i'
--{rxf N^7^q Ot
rxaC -.*olc ot lrLtYCD--Lt-e-11'
o.-. lrge2iALe--1 '
oe ee-et[ nJ-s .st ao:t"'
€"' c>-{o7 s 6'c'-d P'-T 4t
q ) *s "o-u<t1
tute- 'd-
&l*L o,lt-tt-^-5ec(
*U
a/ J

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

a1 p a'f t" /v'L''


*tA c!-ani" U-4 u)
a
,[Link],r^n_O_ __w4-a,1 (v*
sral[un-\q/-1oc*,{- ,Pr-^-tt.I [o aul*l-r*,
._r. + LU LeL_\,- wv-
' tA::]- Rory- - oLV
<..%tZ) | adt__; C",l:,
f,vvae-l 1 9ozL9 4or;q 4^</ I k- 9-d nne-^,
to I t<_
?dteJ { P o-s/ [Link] 02 128 &k z;i ,.'ne,r4
-Zr lA& L<- 2
Je-r,,*<.l !@^t
\f-<*-eet -ey t pt LL 6 cs-6 f t2*

n
18
02S I l<_ JqPo @)
Jf-,,kl t c c^A cz- )
OoD f' ): t /-e t<-'t '
^S.J(l

tio
QC, ose ' $r-' ccf (-
No-L"a.^e-l '" bP82o "?8*p4 4
e* tk_ 6geJ-eol faPt Jlo
ffio-to t--e (o- t, 68 o { 28 e 2 o t4 A
( Ik_
yeG t--e Lc<-t A E+tc t I ,9) 4 K7 e X
q p-f6 g t<- sej-blpolh ; *tO.u
daT .
eoce-r,tn91 r $toof +
pL:Lfpae s7 c-.l:.L 6st a B
.TI : Tf-13-?,3-O-D,)O a_e2
)Oa_zp
-3
I
t 6ry
.LJ- 6

tzz 2k_
lu Jk
g k_ Setf<J.
ca_D f
.nu^ k 8u q-
Pe+ j *(P -;
So
"-J
'[T "- -f rn 332oca9o 6S a {f 2 Pr-6 fi *_ a.J *nea-to t/t-U4,'
4tD ) S.r-tnl- Pd,f )
A-
cJd_) I
U

L. ut4ry- (I
Jl'4 (Ac ri ^-r ?*-r \o e hgc_d
ab* gct en<' c€ - "l-dLu-'-c ^7 "
. ii^ Pun ct't7':
-"- r';
I to b"
VT

M oc^<'Y- Pf"nt *"'


/a+Le4-2,,t-::
\/::
* t"'"^rrr;At*"-"
I
\-/
(]

4 "I {;{
'Q' L - {,-
lk- Qk
, t-, es/- c.-ff +qe{^

d{Pf {s z' 'T


+=4 I':'"*
n;
{ i6icc'-. t'
(
qlD fd't
<tSe-*,ou( '

/ ,$ ';/1c
6"$';t1c J 'tP'or't
r.,^-l<-r i sacr? € J-s-z ggkk e-,r r>-t"*,
o).s: -r.o

€4<i o3e-'--r"J
paxl; fi//);'
Nzt,.,,l-c,t{Pct61d4 €s',"r2 4 :/p t^
(ts
S 1,6

n; Je*ec\
6^*
\-rJ"r^
P^t +{ o; ;
1-'sDT " Pt^r'a'
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
e\
vt
-<)
.]2.N !)< <t-a-Fu_o ceib-sCt"+

qe^J o U u
- -
c5-x'. o"ttt'*a co"iLt-ua '
G-t'-Jarue a'g Loo elA'
-Y,e
wl-4-S.l+*:Af1-71'.*-rei I oq t c
. Gu^,xoJ - v
-l-t I as ) <,,6( to<--<- -*$." () "'l:J-

ts:-p*''u ces-a'^rc P*'*A- 14:jr!:"#;;ffi''1


'n.-
Jt, t+
m-l Ctk r. ur,-i, (J
(l c-\-^
,3"2 6i+t' bL4':) (r;' a uJ /-?*'c'/4
;1 rct') F:i:"ft

n
r*cr"cn
pG-va p+ :*:, d'nu'-
r r c.t r-1-(-,1 t-A-Lt-<] c\j-r* @ a<.:, s
\tt:.^-!\ u '*-- ;L':Le c aetLe-ta-' (J
s tDz e71*
r'*n::""
cz-Jue

tio
l^,JLf I

py:4*luo;*,,,^_*
A.x-trya 'P":n /-t
).nYw'-
to-X,o,
-
)L-

lu ,
cry\
! h6-
-9*t-a
.fio' -t
So
N\\\\!
[5N
r'i4='l* I ea-*::: tu'a-'T7*v
P"tu
/
(- -
^-[o'
(i4
-(l
L u'icz 5**, "-<;;:-
" ffi'
s.r <"fr-- f-, r>t-eq<-&- rz\ tlecL,,, A
[Link]'-ri^ f:f; pq A ,*9 nv.;*-Lt
) i;:_;"P;T"l^Iu'tf
-.:t,,-,-,e-
'23;,t:#;g;-
U

.t^9. ,€L;rg-,L . -s aca


(/
/-)z.l\ ,[Link]+)
@ "ftJ-p.r:l'---+1'-"6'4
"
^ ?,^nL7' cLb"-
VT

g) P'r*uA
O rro P€?uE-*ff

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

EeS-1 o. f Cx-o 6s 2a-:tlo tb\-


14-

T-;tA ocLtt cc'o'^


-_1o -fl1 D

8os t 'Btsc k d^'aT<ai"--


^ llo
Z ac- nq
-9pec:al Do-D+
$4i(t*-,&f c
*<[Link]"-(io'*
-
k "ruOr- t- -f I0
/"\*r+ ---,
.? 1o
* bt?da[-

n
4g -A t{
.r lo
DP1 R- r,nl,jl^nt
= Cntc^-titl
DPH

tio
-
nS e-u"a-tdfr^
Rb -coR
|-t AddA Bt^
8lt;1gtr Spacr"c!
fr Add'tov>-eo 8r-"_.
ALE JEV
PsEN
YtALl'
YTNL
PEsE
a994€*
J:!"br!-*Dt
te"r-ot)
tt^-!i B"1d-b
k-"-c
,lQ^t<-l'

A-:
e&t p.
' R.q
lu
LP
p coN
3 Outc
3 csx
I
I

I
So
Vcc -r1en c"",^Lo t go7J L 'T CoN
6r,9 zm&
P'1 -T Lo t
Di^k-o tlt O \

aLL
*Tr t
I

X. )
L<<-to(Lt*e
U

ctq-F(I' 7"A*;,,,*r')":;t;:?#; (.NrR)


f

t) g .brt Cpcr
";: N ce61.e Pq
i ,: ::[ ,;;-;*-o6nur")
VT

3)abfrPf-*ff'*-'t9tL(cloLaoLd(P's'a)'sFcu?ffUe-)
&) 2,iae',-^,-a'l- pit"tl o'oo'-(g+rt) ? ^:'' :**e'o'bC;
i?;;; k::47^ :r:::ru t'fi ' -
,j s( i4' A P ctdlt'' <-1e).*1
A Px-6 Po*Ps
*) sp r/c br*o *'o5'::,: r:;:;t
tj;xTr *" t ! nar
?r l *i' il "
}1:*Zfi"#:! "::';;:;:
rt). cc-ia':' s*Te\uLpt c e tc((ezt
t9 P :E' -"';,:;
e4-x-
c k clk cr'<eLLf'|-'
iS €ls Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
@ go r I o ser ttdtu\ u c (k
&(-.. cc/ eLC 'o 7 2l{A
e-q,-;7
",'t ?1
; cLsck P+cae-'1
* p [Link]""-, o't--e *U - 6 (-<et'>-b <<!' \'/
&ut--Lur€cC''.-- f'^:Ctc*^C h Ca'n'neat
l.r-\4: p&c:'uea*-zd
"+ Pr,^a XtnL 1 4 X'rALL

C( k )A-uq1" q &4C- '

(J
' {ut *-i C )--en o"t'^-fo\
t CeA<r
".*,

n
^{f n^ e &*t;"1 P<cL*-< '3
ZA'to cLCc- L *f-^e F'-f-r4-t'"--t
.'s
*> '

tio
;/
Pccbuc to^*to- a<"t-
lX
e_
e<*-t{ oP%.- /-{ c' ''9e'c c'- c)'-') 9
d--tb ? '-u*1
</
apeae\-t--, d .n""LY op coele' e-4 e ct 'rr^7 a.-^. opc^aok--
& u,*-il-e1 cfl-a:{e' bUO'
:.'cC'Fq e c'' cle- ' aC-LJn1 I
*\ f -S GtLZt -SA
V -- L ''' '-rv1 (l 'n
('o! t-
fn--fz+ etn-( t-'-<'qc'f*ec{ 6 '[Link]- p
: t' -.p
"
e"F-i
/tr
U
o1 ,'l-
--

U
=lf*^Z
r>f'--7c
I
.
V a - L&'
8*:- lu
r;,-^. cI

t8 xTAL>
^t.l=.^^
'is't-
-
So
so fl- Dr {'
t1 itz * ct
,,,1-lt;
Pt JZ
rl
I su"' l'* n
I s*ot1 | srnu'
+
\ -" lsato
U

Ct-1cQ
P,,
fnaCt-f-'r- 1J

'{f*.--e
<) 'Tc> c-a-! etc( ''-!-[ n'
VT

q '
?f,*ot = CY/zca) c-*>ry tacza{*fn<e
arTa^-t A
/*"
Pl-n
;fir."ou cL\e ,2 t6-b'Pt xeVfaLA':

?*v:\-t ,et-i.- bj te fu q eIc-t- e-z '

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

0
+t -tt-t cuP
o?ant,-t-a oFFl:L z n-*iu1^--f
a-cQc{1u':tz-':
7rt
-l-C^a-t .Q''7x-Q'l,-d c F€ F L'-,

a-LU\t e-d. ?-'e-*Lo-'


':1 L^- &oe-': b Aa-u-e- a<-+'
p c Za er-l-1 c'-t-o--'pc- "'p
-) "-'5
f ,ntt r-^rnl o-*.nr! ( l t ,

n
U L->'d # -Lo 7zurt)a [''- (7v1Q'rn'i atc{-otc n
Cn
-> -?+ eniltlolo-( Cade o-C cz""> d*-el ooc'tnx-''-J,

tio
f,ii-u.',r'-,rrL ---t/-
d-&z' 6tCet'ztz '
L^-27_LtL ar * r<f- P--T<x"^o-L a-c<z:L< '

D 0,t-t *) 3 -s 2 OPL

A u L7 cit_!-%t,@
--
--> 8@51 &-;fal'"n'o '94 Ao-e's-o-'( ?u'Peo"
"8"->''ot o s l' Lo-t-<-'e;1;lL-
lu /-'-te
So
'iC a ccrrr*rL'ra -) b.-,
-\- *7 o Pe-<-d{i-en-:t' f''-c'Ltt-cLr-u,
A')--1 i. .*1
*7ou
r*-ti7-*-
no
'k t-!iu'1 \J
= c^ cQ-'Ln, oscttt--.. , -7tt&"P('fca--T'bv''-
8 e:o [ee^*', b f t <tqc? ''^f p: 41o*li-e"zt (i'c"^'A^
e. o c" ui & o{-o-Ll' b1''- E ot- t
-> i f- fl
cvl^'c
o^--cl o*-l e"'A*''.t-!- -':-It
_
'A' /-cza _ t_
(' ! L' (T
Lcx c ttf
t-ta zc-( (J)j1
n-"' t t F "t k'
U

-) 13 Ita t-ua L
-J
"-A "
df o'"^* * P* !
VT

f;.,-.trto'ra.-( ,< rq,,l 8-'}1 4 b a,' k ( 13 c - t3'z ).

(Plogrcz*" "Cfa-L'a toaLd )


'ffi*_,r;?,n,:3
f Laqrt N p::y aDtz .c-e
S::::3:" d --, aka
t__,2.>-,1'{ ? 7iL,,,p^^ .::qr_,r"::;t?T*,
,'r1-- '
ba'o '-pL {L-i "g+a-I-L'
c:l e.e-r'rt ';-'
f *'-:FcCt. P.9 ,c , 4. pelasel- C*-;tCe (
-LL-,1 *2 ftlpe-c;(
(Pce ru ) x'1 '

n--rJt L, .J Up C , O, .AC, P.4 d LLe<.,<*

+<-^-7c
Online Chat Support
' | Technical' Seminar Guidance & Support
Fo, 6ec . drttProjects Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

c "^yT;"lr,lo
c-o*te-+t --') bg ono ed &" c:''Lf C7"-^4'"rJ u"-t P , '\ofa-Lz,
oY.-> ) 'J U^w-) LL
N tsoO(e-ct--
y'\ C *"rlri"-r, c'rlry -?4o1 j ct'><d
1&
tscO [Link]-
*---> Llzt<A A{^a
'^ -> .!co--k .> eloe:f t'tf 'l:
F*s t Rso ---\ Rz.<a

RJt R-l o <fe{.c-f /---1


bA_^t< ()
t- o

n
(o, 1
ba^k- t
{ e $6^k "l

tio
( I b.a--,Q 3.
t-c+'e c! P-.< cag-f ic''-- e'L'c 'o^'t l-
o\1 g @Lr-zt-ry'{e: tJ J"^(
" u-ae-

a9 L-elct't Pax-"'ba
u74
P 4 u?l 1
Pe-G Lq ?

J*t*-4 ka..o
-> ( '= oda P*!5'
_0
O.1 e) oa-Ct'>11
'11.1Li - -1
-

+.1Gl- U-e-Ld
lu t cl/-C'll-
/-L\':'L-\/ 1L'-LueC'L-
cL- -'
Lcc-z':> 1L'a'
So
te{ cealL- xdo'ca-'
I
-+ nW ;:Wir"; 'uu1e^ox/<z 4t-
/)Cq- e /
(, IeA f"1
7 'rl'1t*mcr-
-----
ByV
4fid-+
w
tf
{1s
U

r8
t? Bits

Br- riii,
2F.
AddL-r+1.4
VT

lo L€.
oF

w
BI
o8
o?

Bo
O^
Pt------j
l-Fo' T*- 8.
6 nr-',
oOO t kf^'l $ t{ec*dt**c a* l e- ")---(-
P c<,<-Paze'
r7
.)

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

_> ta8 *ba.u P*ff'ov"^'J '?'+


r-< o
-b Ol-ga*-tce& F*Co e3

d_b-{a-, c* O,t-a-A4 C '/\ '


l' L,o.l-
(1r':t'?"v doL Zo 1 F -1 .>11L<, U ,T
-3 p-
(il
h >t(A
- c\A-o '^^ <:-rcL&L {-'L "
7 (/
<l 6r) 4 !r--ko 1 g
r:1 * 2-a cx7'tn-'%tr/
t.:otL u
w c
.J4
-J
.A-a-e, €rrCC,l
@) : !c c^ R <-o, cp^- b e azt-elt-
/^o n.4rc.!* k., ot3-wt
.y1 C3-wtpt- tLLC,\-eav ft{
<l -*
' 11 c-r' <a <LL' : "
fuc;^ k f' 9 'l'nll * & h.'l f L; ir'1
w

n
rtL-,-*a Ro 9 ba-*k- ..-z e' '?.o (J be'^k 3 ?4
R's t N ks" 4 aciat+* tg l''-
auloe-L1a '-*
/:a*-t<- h

tio
_\) t Lu.L'fc-Cu
@ RS ( V ,\-so 6l-fl-o-*4'-'a- A "'fl
c-L*an- Pfr e'
F4 cta4 a* c"47 '!fn'te-
6^
6r--wr*Lj
' A o*-k ct 'i' c{ €d el-tcC &'
h-op,n,, 't^-1
*:: 16 bi* oceL?rel'} '4r?r'-t
I
o.-cj-oatL-,4cl6t<-
o- tc GJ
@_rJ1ft araoLq- JO h 6 2 F /-'', 4U'* "^ f '.i c
br,z6
(J
I

.u\-/
2 8
tr-'
<x cla!-R-z'Yt

h ao '7 F t'-
_r^ta
L\&) tL -etf lu
d1 .9 0'f C{
?1
<f
/La
.n/-
,!,)| L
So
o%*
aa
ct.-<a!at\_
v oo
a-dcl-t- 4 Qa a t.-((

Ea d; aFh-
2.,1 : g?+ [Link],* 2?L- t" A-Qtc +lt urt ? bat' 't-ctt{;
,Q l= .
(ScxEtct-p"r7)
ai a lo ettp- tLq- b''-'/
A de,n e/-o-l P-eLt-f)a'- c- p 4 ft< cll'e ':z-t-n'1,
L- a-b Le a-)
-N-<^,l 30 h '1, '-Z tr cL ridtz'us
*
+*''1,'.
Jb*t r-{r'Lc'
b+ L, un.d ?.e- iure!' (t
f s6*^, d,1r' P&^n*--r0t-<'t 'q{o
U

3tP 6p1tt1t/(tJ1op"'<6' i'*"Xtie':ra


S;tack a---i

ceccr^ cLtT
abVt 4 h iLLf "'nt '*atc'
VT

16n
4
1<J oALa-c k'
f' 'Lo tc<: p tn-ene! m t c'-<' 'S (Z' 2 1"
c&c-r4,\ d-n-!'l '
-> n're*'L'a ec e{ cln a7r' B''''-? t4ct( c' c4-\ 'S tV't k
-S ? f ''-t Cl-e
c9 o (t-c-f c'9 (6-ck 7<-f.'(Lt4 "Y'

o-*otlt--- 3P d61''4e'-"te-'I:1
,/--oL* gurv-1 \/c.-7' 'S(aZk,
r - T'pr.1- "7, qt e.,'x'f c;.tta-f Lotc(e UA'&*
-
.LC,
.Tr--t- ostAck tz -2P'*f'lecN- -L' ^'d' 71 t''-tt-\-.>'tz( Pa*l'
'

-> -tt\t lsa'f eu-# a'L " h Q LL!:"'LLL/-f t;


1- t---r u*9 (5.e L+ l'--a-'s
-2 i'}1) l-u7 ba*'k' bf t * ct:c{cL< c'cttc p4 r''1''
cut 1frL-rr tate* d-o-tA
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
fz\ Downloaded from [Link] ,/'1LECTURE
(6
\-' 1 ca-*Jtr ae CX-a-TcNOTES | INTERNSHIP
C' Sxtcl | VIDEO
P?4 c>./-,,e-r;t-z
Like us on FB for regular updates

.j--an r>ot-a-P
I
a-7b(e
Qc( e
#o-uak-fm1
l)-.v\e- 1 L,'*- -9 fa- C k <-*O eo .nc, t b --4c,-, z{ ereetVe*-<
l'>e u'^cb !
7*',"
E.-,- Pn--l&4--,".a-.( Rf+Nl, t"
cx-t.a f c{ , ,.gc<BrL p o-ctr ,eAn< -

a*tlio* CP{L
EFU c.-ctd,u- '*a&\- sA (.eiPtli
o9 Ldl-e kLC;

J{cZ. r,c-I,i Augar- eq

n
..staa- DdCc'
e8 6ol at" I
I-sP=-4
--r_

tio
fsV;4
o9ta,tr"-o Aafa sr-
f*aarA' t@
s6tL J,vftiv--1o'L P*n 6 uff-f ,^ 1 d-ol;
-
C -F-nCte ^e-J TL^e'^' r/.a*t krocu
J 6ke) 1ke* <:fuaau4)
Ci-r"*
.9pec,e<-( Fu"^cU-o-"t R?2"L'J'"

Lr r-, I t --ti t.- t17lct


lu 6ff: o

m 4-4 ' Uot-' b 'a/ -1 L-'DP/- ctc+' c4-t-t--"'t


e-'s'
So
*{ a-u
P*eu a-aloLt-t*'''z'c @@ L; F
'7
(
go H J
1.-\-4- aLc4 cca' ' 3OL-l
oddlc PnNl -'Me%U*1..?^'-"'t-F'<o
7l
-t*t odeu-- J o ta tr F +1 '1' c*2'r4 41
-) Nc+ Jf "Fio ? w "*t"c4 TEi1
gactA;'"'t r-'e-a y'tt-L*"'! ^"
SF R' ct"""A
Sotl P^"ff**La^e)L-'
U

y')c c* €)(zL) I prn a)lo


', (T+tt
Bo ^
OFo / '" /I r*t ::
gn
t/ h OAc' /
VT

,,n.-,* oDo I
I fz
'- I
/ n- ..v
Scprtrv 19
fts"-' I p"n 0t3o I
sP Et sauT _,<)

,;;" & I T:" ;' I ?':;' ;:


JPt-
o//'r c- gp
x"2 I
I _: ^ eq l
.Tti
tv-'-'o
.^^ I
Ecg 'r.. *-9
1i

,DPf( 8S I *n '
E c-g
I t r €n -a-o
*- bit / bYt; a7-dc&-e*aa ble-
I

'I

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

!rt"^-,a--l
#
Kat<
?Y\^e--/1-'
-.5'o-S/ (>\1e -vL a
u ol7rzo-L. ed aa-tt-^-o-t d-afa
k-> P A*n e@eaa- --)..-r€ .*-r- ;{- be- .z e;|t'ka7 o[Jd"<--:f
. a
pC-tfi,eCa-/
\l n
-a're_rw-, e--rt( -ja/df Lt-co .
v
V - .t. ^ ^
LIAA )/\ r\ *^ eo (llwv'
CLm< od_oLL
^t L .l-e---s-e-
': -
ba-e L- (-
->

S pa-ce Ozffi) to otr€tr+('

n
e- -tL4 ges I -i"
(2ex-r-ta *;(ic..(t,
o.4--*tD -l efiL (E<'/z

tio
(/ (/
b-lL. g\b^ - a,,*'l .yk <-rv)eM .

(/ e- 7: "*
1'' )ot2,aL
cp<-aF4,ne-9* decsctt4 ' g^'c^ZTt''/- Ca-''Ar ":-
.cvL p",ftzx ,. Ro n^ ---
-n"-Q ,-to f-"'t
'Y
2"*t Rcl-t* f-- --;
T* C*ttt,
^toLi1
F^--f fu €o<t'
n6)
rt
Cc:,->

-n*
-!t-r'rr-e-[Cc-.- 7

rl)
^ Ltni.v"-YL, q
,\ e2 cv- f'[)
l/ -{I

,.pp()l
\/
.q'es-r

ryp(!?,--c
lu
'1u-tr^e- (''IP i't
So
Yc c- -) "S (t
p/,^ 4/o, Vc c-
P/-* tt ,''r'&.V
- [ r,,. o'
-,1
cl-+ r cl\- ;, /)<ra t<f'r'C ccl:'t_l
6,,o1- *> [Link]- \/YvL(g, r
tl
FP'- 'zat'

\:*:--t lTftlz (b;b* L,.-,1 k-zrti,.Lt-..i


n C-c.r/) o a€-f
U

s)tJ 3oP f c:l P a c:-rt(e;/'4 '


VT

- '/ -d" tt cc,-fL( be d*.ne[tu'N /; x7/1 A-t zv

t4 (l \.' \'
Y TAL,2
a,a'u-/ - zn Dlc N 7h La-
j r---\x rta- X-1'A L(
14
la-
I

-)
I

I-
',x T ALI CrNl)
t _
t_;
'= 3oFt' r-L-'t
/F\ -\.t lJ
(/*t,i(t(lv
'(i - /'"'"
(rf -, , .'f /r(' /^r A ,'a/,'rl< lcL Lc t
'"t' I
O(t |
>ro
t4 L LL^f l-l I *r"i--f N :Lz;'^? --, a-L;. a-[i at{'"'ii-i Ltt..o
/',n t
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Seel
Downloaded from [Link]
PL* NOTES | INTERNSHIP | VIDEO (LECTURE Like us on FB for regular updates
<
ru
v

M
l*n:s L:t_i
t ta1c,.
I

t< <9
),-{;*u*.f , nA
U

cTf *,<X
f
wwffi
6a2a1,itu.e- R
7LJ<-tc

w wwffi

n
sg ex-tc./ oah og Fta-q.t-

tio
1-it-;-1 V 0
+€ [Link]
Pctxpoae
a o Akz-<
?
aft
I
o

cq-aee,C

,Qg,
Q't-e-a,-
tn^ks
8
--,[Link]'
.DpH I
ss/ I
P Ll
De ! lu {
PC.
ltta "r{.!-L

ffiwffiw
e
I
l"
P.V ua 2,
So
LLC

c^c

B
PZ s"*t
c't? p1
o16 R6
a
p?-
e4 P4
o,? Pg
o 12.>

::ffi I fJ GD-Di
U

],n/zo-rr^A
ffirr"-W
/2-'o
rQ-a rn_
a-

* '-) Rft erc{ A,o1., a7-s€,e{.ia+'a-n-(t/<- '


U
VT

pnc I D T N .Z: eca-f tz

? < .\
,J
\'& \3
<s, -r-_
n* o6

F
'u.! tr\6
q. ql
cl-
.\
\..
9L
9'!

+q sma o.(

(5
1o <s- .Y
+
.O Edi)
It o
:1
-a
.x
AL
,S
cl lN
.+.'R
\!
s(<
\
\^_--.- s -1:
tE o\3
Ci --:\
$\'e t
\-.
x- \,

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

R-,
?1 0ea*'e 8 rq,S
R e-*J Lc-crLLLt-t) 1
(/
r) U o,*lttz
R-4f
<r ha <1Zl

C-r-'r-o
.-> t-t gto'n. P.--.,T pc
[>c
Ac c- offi
L3 cT'rz)
ur-\ r\t )
CrT-t-rs

n
p5t,-t o1\€ '>! . [c' <-
-3 7> c- L- 07 O-V'>'et

0P'r iq- c-d-vo' *> ,?Ctut*7: to (p,>-1 .,1eCt


,"

tio
R-s t Ph.t ao '

{ca' (:-

torr f- 1
l
{

l'_L -
'=
"Pl'
I
l
lu I

,]
So
F<'<-t-tza--on QS t C k [- tt-Q),- o-n* /23 7 zt$ (;. .

P<,e
Ae 4:, c! ((/v't.( e,

4' Qsr T. Lc€- .01"'il'rr'1--, fl o^'t(cji bu l^ f .1 L-c


(/
p ^1t- L4et;-c L' u--1t\-.' f t
b
/--4 2r-LLcrt.<tc*-
0n
44 toeo.
e,
U

4.. a1a)f q(c{,"a\


6,rr/--LLa-
-/)
l-> ffe,-s t ).
c->
VT

n 6' x-e-d-' t{- t 92fr'-t


P t -* ff-
e-r-tt\ r.-o-t
L4
fri{;','t
o'
A:-AT(

t>.\4,i,-; C{.1

a-cilc('--
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

'/^:,' 3,-, p-*;f f ottlpa..t (,>t,), poXf: .- h cttf 6


t: -----( C-f

19 P.- e e ILLL-L L'- P o t:ta 8oS- I c>-le- [r\d<etyeZk6a^aJ


A
1 ,:-/ a, L-a-u-z qy L te c c.t w1z o-3 A*^ IF)o >) e--:7-< f t-- I C-ck
s9 L{c.c-{sLc-z
:
) D /'ztct'
a) c cr(f>t tt ot-<rqtccr
3 ) J ->^ 1_'t,i b,c?d ,-<_
, ,]l

Pet-+ * L (R "--^''=U ^t p a4i*rp- P:**)

n
,<c***

gt vtc-
< e,fu

tio
Pt'l%
L.x

-)
R.*${
Peh't I L--o-c 'Y1 o
C-i1>aat e&-'-aL a.j t, e fl- t,
4l\l

._tc -l u-'-t fJ*'


lu "o
a(P
€ e '7,
-+.4
La1 Ll L- t-.<)
So
e-4, 3 Lrj-,-t t1 e-* -to
U
-a c---r- ( cgG c'- ' D ktlcL L.-,a,4 " |'-eg-C"'
U

c'1'r fFE Q=l -'<'


Q--o

qgt^C;+et-G4>1/)-c',1nJ(4'71n1s2-l-21\tcflPP'\--\'k
U

<J , ! ,, .\r_ ^--r. J tb -LLf -SGIL- 'rBl

f - -J.
1t-t** r(r Pctl-t'.
VT

-' 4. fl =- , {-,1 ot) , rt p^*1t-8'aa-?-'


t 19'
e _o
r

:!: 2a-^d t1 'x rlp Pr--


tu4 pa--Cr--to ?*-d *
X,
-A
'*c:.-z- o^t *gcJLt; 17
n P fu
($,tc ea
4t1 *71<-*!--'
r{Lu'- ( '1
u
ff^*
-.>tct*Lc{-vtl'ct"tL+zta(('1fi^kczut'<:*-=l/coltulo'"''.-l-ii*
6'4u4 1u<o /v1 { '<
N '&c<-4 vcc' u ^fTnt(7o ltor"a
-tt;;
,r^. Ot1 .blac-: a+J mrU. a-j-)'-@-tq '( F'*bl'--'-. , t-a){ L^4'-.
o3 -1-zc t-

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

L"j Lc,-{'c' Lr(c


R LL)./ latx:-n-,t-=
lok -k'11!-"7
Cu-ts-zJ q(e*t
f o,\r*o't- t1.,, o ,-.7
*^\ rrepv"
mV)
_

g,5,;

n
pt-t -> Le c:
ttek+ -z k31-.

tio
-T B'- ^)c.c-

74 t+.t ,* Y li"--i t;-

I
lu Pr
x
oVCc-
I
B-.1 l-z <*
v
So
-7lQ /
U
VT

tYv-fi,,{iJ'.-J
F-
A
LY

k- cL/
r
^rr.)L'
lo \'"{t"

/,-
a-lu)-^3,{.
,lP
Port > ^9 Ll'"tk't' '.'J'"-1 @

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
(t, Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

P ,---cl L"-ti-u uaa


l
TL3 1'

t [..r
C{tt, f:t"1

l^lfL,

P.,a\1iry- pe^,ell-
+-_-<r:- 1
lnlc-c,

n
'=-t-J-
Po z
C-e niJte | *,"J-noL"
A c<-o't-1-

tio
vcc
,R e^& LE-tc.r- brr

1;itrx^J
- t5u'/'

-t^ iJ,t-

neAP;
=-> Pol-t- A *^"3
c!le-T"
1:z u.z"d a- 04
lu f*p,*{f o"-Ip+.f Fo/>f

b(* ,-, *;,:.Q:"*:,3i:;y," a ',-A*^1"-


So
*LL&^^-;Z;

-P paL+ 2 p?-- czLe -r'-oe-eenzh-5p(, 2c^-^-- jz-d ro j ctcler+- Co-Z,-a t


u:j c+L-a- *trlt*-j -1-(u r-,(7r- urlr!
-)( g I ,, -b,* a-c!.*L-.

Po xt- 3
U
VT

Ll .c
p oJ &fct
9*a P"'' o,t/I
r''P;-
-.r: 6 ,a
c!N.. raLa

l-"."4

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
I

Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

*2 c.*-a-r o )L dr"J.t bl nr, p a -v aTl^-'z' pe x't' A tLa-.t pO L-e4 -rtt


U " -U\l ^ +, D, *6 [Link]"; l('
-to ,r*.-t4i p / <'oL a-<>LcLst- a. aLa-tc' )
*.p-:k
/ a;[Link] 6\-
f

bt dt* e;l;o---^l l r,- ot'du- o-'*-c{-\

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
rrcj Downloaded from [Link]
Z i-(':-Y.''1-e-t av1 't'Lc
NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

gtt .^3 /z
'11) -,. FA
a9
sd rtl3

Ar,
PC
'*44
/
-
-
te r1 -Jl
I

n
t?
lr, 3a LlS h- /5.
l3 t*'-
r
lz {
al
{

tio
2 (,
, ql
ti tq 't{ t

R eo-lo^-,- qs\ *-*'*j


lu
ex.t .}-lc _ L
So
r) tLLl*P< -tr pL(f e--t fo p*'ilfun StTz,Tc-'

:':;:;'*,x1* *73.;7;3
" -Or' , p^.c t-f t i {,"c<- T.a zzC(cec.-Pa-{<--JL^:. F*
l,/
b
l'.a-ec93

.t-a<:t-t<e- zt-ttezJita-ble t!pr?".,- (S ?{t ')t'k )


?
z) j) pt-E )no* e..<caet-4 lc* O** .u"*l-'
c(1
U

C<r -^,,-e'V -34*il 8o's | 4' "e;1 n't(oz


-?'w
q-9/-'a-c<'+c 6q <-6f'4'* b/*-
4 be<-'z tt7 - S(Loltc
a4 3k
e.^fq<*s-:iL* coo-linafo'", ) 1{ /4 CI EPkeru-' 1
VT

(tu_/u
Pn*
a,\ € ctze-e'fu-a! ' * %"i- 'Po *-t 2 accz4"2-d- u'**-" E* - ff'tl

g-_ F,,,-:f _4 k_ €o ,rt -

i. e it $*-' pl-aulcLeo 1c-' ._Lsu'c+ t4* A


tA blt 'nQ Qln cldazl
t Ae.-r- ac2" a4 () Lcf d'f *e o(&-'J daft. L, r-'> t-c ct-ct-l tc- fi *.od
"
tzu LL
"A h ?
at"qe .*1 daG-

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

Da err-esr> 4 Z .Px4u-5d.2-4 -tc.r- L-f


PoA.+ a fit--^c-t-
ffie hn Gd-cq da'f"^A
q'-
bA{r ?
La
tl<- 1 o-nltf t e ry€'n'e11 /-ea oL f "ld'l^ e

2k 11 .*,8\ arc(e,
LI t qt*,.v" -U
LT &k-\5 EP 4H - -4-d-\-
la runi b.z k' $d ^ pc &'l c !:e
t3 bk 2
l/l lAL !;aLr-!;u *'Y., &\ e"4 oa 6

n
rf &ak /) a-u--e- 1t.t- ,
d'
lb 6,q t- '-./ J ]
.-.nae% A-C('L+) %
e"il
.:. b S,Ll- 44

1? t28k \l i-1 .Ro01, frs7:nt

tio
tg -- --2 s-6 ,c P/-.1 Ccc{a. Ptu-
-iLD
.fl p4 7
^-J c - e
t? "..rllt 9)
V-
o Cc ''-'.. a- L-t Ie c.--e

Pe<-'-. -t. p (c'c' c c)- C?A L' 71 Pks


)o I r'4
4-t c{ e 6 i.'\ c'Lct G.- trc c+'t
vq
21 2^<
eP \ <vt
,22
.,24
q
I /-t
{6
/./
rt'
*
^-?(-t
-v't
c---P ;> p;
o .a Lc L"n ,1 <1 a ( i -(c
c< da:La) bnt'
;
lu
cq-ft, e, (cc;_
&'c- - !r/ 'n ,Q4 -.-
So
^
3 ;, :' :':::'-
u
a
".,P;,:
H*=,,
Po^t.2.-LPPLetcic{-^.!.ta1e--)Allt_at96CLJpl.)
*:!r"-", :'^!';;#,
e At {<'
n) P-a .-^, C-a- pa.f ?
.'^^:/ $ e n^ P etu-csLzd 6 "-t ^fl
6 ea6q r' cL't'!3
k 'u'::--r'r- v- t-4 ^n':J A D e'"+ p Fw1
C-r-| L 'x^ e 'w'- C-e

>' pot-tt pr'sf ":r


o-^"**4 .*.J(J pe *'t x
U

?
? *
9, e,vr
6) e-t"-l
e'r. e-t, euL JI to
IO'
Ul-/,.-.
foAt Ao - A'+
VT

AIE {ta t' <tct cl-t-

{arr p+'r'*a

?>ro-b(e: t,,8c n:r.

w_-
--1
L_

_l t-

^-al. te F-eo-tt

d{tt- lt
t 1ad. bt e *t<to(t''

i
Online Chat Support Projects | Technical Seminar Guidance
I & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

'"( ',J, J-' ';'


,t
, ('1 6 L
/tr j J1t:td-+c."r>-f rn \-a-d?-) LLL ft.r) ftC€cn"
'".1r d---j4'
z<:,fa<o -cl-
o
__!!r-g€*.
t) -f *1 -- [Link]-Lf,
e) p"_-[Link]
3)
. ,.J
c:L'l.e c{'
4 ) t "--c %La i *t;L'Ac, -t

{l
S) 'J*et:r.---.1-
f :::A!:yu
-L.*.

n
.--+r-"nu qsat<--\- c-z- o p"Xn*"tr 8" C*'-^-+ --a

*) ,i **.lf o-{- <>L.-t : o--t4,-1' b e-' p 4y +t lstt *-


^^ ^--;Lu:t

tio
-r \./
' C/v- C--, O 4 ,4 ) ,:^ C-/
Ll
<-,oL) -Dyrp, $4f tr,gJt
cla.O L) Epc,4+ ? s+/
o\-ot) )p+1 , H 4ftt,
"4ao Pl, # f$Jt.

->
aLza4-f -ra1tis,-.
>X-tl -]24 rur-.a9 *Jt;\ L' t -f rr' <-;L' cr--ol Qto Q O
-1 )
lu dt
So
61--12 - L<4-. rt-..v)-tt t.44 -fr--. ":l % oL ta-'! 2-l -
-Lb
? e*f,-LJ-
*-€-
?-1 A^
/ ^LLE LLlt4 l Lu ct-tz + t... Lot cl,zlJ-t, *ilp'.!^r.
a? "-A
.t\gL,
-)b A, p,o
, r^"ue,L) Ql,4 4t+L
(YLOV {?
, DP L-
LJ ? C,a-* (>,'LE.-42 d-^-t* Ll ,',--- a-C'L 4< Pr- b-"* bln B._
U

f*A, L 'lo* a-l'Lu-'"-e e(


'Cn'@V P-4,P2 e. f*''-cJ'e<;d"
VT

-Dt'h e-"-l-
-::- a-f X e-L*- ,.,tt')t-- Z a'P " c i7" "'>l f'1-- 7 tq '--y62-e2;;
-) a1 e-\-t--- 6, F

t^ d q- 'sf b U*
R'fi
z:"|oU *9-6_li, /{ n*\,r l^ir'r*' ,-a, /
U'"' -J ,1Lq"^^","
odP
cntou l\,4 1, *_!"_^_n_ 'V)C rlir\c' I

[Link] fl r la| )
<y-eo aEa +( , 4 Tr+t
rt I I f
.S".,,.___,_=
<14rr, /\,4 I

l,ttt Lc,s*1 lal; 2r--o-^ .._ clt.\ a,-crzl^- ..1 o t+-e*lQ L cne'f
Ptu{l
-) r/ c oJt .j " / <<, , I t u..&,s
"'ru .

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
#Ei

w
,y9 (ia-{< ba- aUA e ea
- '-l t
PLLAL- * L4 l^ ct wt-L) aL-
D toet- C C'o +( a LtJ 'o c(
/\2
*'t in i ry1 L c&r-i G
P*P h +z-.-L;-el
Fo tr CI3

- r) b) L
J v.\t2{_t /_L_C)

_-) -_-l c,a_q__- *J t ct-t-c{ a,4 XctE. "t, oQ_a_l<t .

n
c\r--L . eA
t r--t-c.{.LPrp n r,; t
(/ f 2.4 16 a,i*
-> _?+- ,-.>v.-L!.=J Lc e p/-€c"-<=Le<=l ,,V @' *^A^.

tio
->l^ cnott @ Ro, A
_/
{YL_oa A , @Rl.
c-t7-_,7-t-ip/-**t -t, ,*P.7
cL
'
1-t-Q-Lala- r r d1 S---a-- P-fi.-t ->< a&.(. Lc e-
Ly6+-t-.5 4 r+rJ .o^] "') D'lt- 4 'crt' €) p-: 'o-.-c&-\-- c-q;tf o"7
t-oop (9 C..,'1i. c\ \-.Jp

-)
-)
t-

A.4o [Link]{' L..ol"')

.el 4a1a,LL I J1e'u^c.''{-


fu-l
po-uP"l
':l''lr
't}---t-
l-;'ft'tz4
S bia; ,1^*-+
lu 4'<;
So
6e*9 4 -J4 -L- S^'J-!ts-."'e'-( ^-.c '.^-1-

[Link]-iF Qa<^'.'L t-^-L< Lt-'>'el 16 b; t Ff '-'C'DP1R)


4
_? *2Ln -._=l
-'=:-=:
* ) t*tclJ1 t-u'-c:[ ,'-
L^3Li2" Leto-.f"( f -'
U

c-,'tL A (
-7 l+ tw)

*) t-o{ ,>,r,<>t) A, @4 +ePTp, 4 k"''Petn'LJ


t-L5ca,l Jo ,a tCr-'*te.' -'-te'-uL Dpr rt & P, ; L'1L'l
P143)''4'1
VT

-;>
nte+Lt-u)
<-.-L;)-.^-]
ffi-1;;
?-/- 4n.6'tex @ .opT R ,4
C/-afL
(
F--c'r;,-zct'
^*a
X -> 2"':1-n-t-'t-.'J

*-- .-g y>cta-<- ,: Tr'q t{J crl ,.J3at t to'-tlLr';' "


4l SS."^^ ,'*J 11*.f {o -(, L,.u..rt,\ {ztc' ltc
'( (aa '', ,.,t.-| (r
4 --,-t-L,,€ l'ta ""1 h.-,'',ri-('
/.J 1
,l , " ..,,)
,\-.9 La)-L:-] <r,'-l "L, nl I
rr+.Lr.e- - fa' & "ro*-4 '') * ,f',
tc-t-;(- 1,* j -t ?O 'Y
ff*-

# Online Chat Support


0]'Y]
Projects | Technical
-?ra
Seminar Guidance & Support
"8** #
Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates

n
tio
lu
So
U
VT

Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
Module No.3
8051 Programming using C
Compilers produce hex files that is downloaded to ROM of microcontroller. The size of
hex file is the main concern. Microcontrollers have limited on-chip ROM. Code space for 8051
is limited to 64K bytes. C programming is less time consuming, but has larger hex file size. The
reasons for writing programs in C. It is easier and less time consuming to write in C than

n
Assembly. C is easier to modify and update. We can use code available in function libraries. C
code is portable to other microcontroller with little no of modifications.
Data types in C

tio
A good understanding of C data types for 8051 can help programmers to create smaller hex files.
Unsigned char
Signed char
Unsigned int
Signed int
Sbit (single bit)
Bit and sfr

lu
The character data type is the most natural choice. Unsigned char is an 8-bit data type in the
range of 0 – 255 (00 – FFH). C compilers use the signed char as the default if we do not put the
keyword unsigned.
So
U
VT

Write an 8051 C program to send values 00 – FF to port P1.

#include <reg51.h>
void main(void)
{
unsigned char z;
for (z=0;z<=255;z++)
P1=z;
}

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
Write an 8051 C program to send hex values for ASCII characters of 0, 1, 2, 3, 4, 5, A, B, C, and
D to port P1.
Solution:
#include <reg51.h>
void main(void)
{

n
unsigned char mynum[]=“012345ABCD”;
unsigned char z;
for (z=0;z<=10;z++)

tio
P1=mynum[z];
}

Write an 8051 C program to toggle all the bits of P1 continuously.


Solution:
//Toggle P1 forever
#include <reg51.h>
void main(void)
{
for (;;)
{
p1=0x55; lu
So
p1=0xAA;
}
}

The signed char is an 8-bit data type. Use the MSB D7 to represent – or +. Give values from
–128 to +127. We should stick with the unsigned char unless the data needs to be represented as
signed numbers.

Write an 8051 C program to send values of –4 to +4 to port P1.


U

Solution:
//Singed numbers
#include <reg51.h>
void main(void)
{
VT

char mynum[]={+1,-1,+2,-2,+3,-3,+4,-4};
unsigned char z;
for (z=0;z<=8;z++)
P1=mynum[z];
}

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
The unsigned int is a 16-bit data type. Takes a value in the range of 0 to 65535 (0000 – FFFFH).
Define 16-bit variables such as memory addresses. Set counter values of more than 256. Since
registers and memory accesses are in 8-bit chunks, the misuse of int variables will result in a
larger hex file. Signed int is a 16-bit data type. Use the MSB D15 to represent – or +.We have 15
bits for the magnitude of the number from –32768 to +32767. The bit data type allows to access
single bits of bit-addressable memory spaces 20 – 2FH. To access the byte-size SFR registers,

n
we use the sfr data types.

tio
Time Delay using C
There are two way s to create a time delay in 8051 C.
1) Using the 8051 timer
2) Using a simple for loop
Three factors that can affect the accuracy of the delay are.
The 8051 design
a) The number of machine cycle
b) The number of clock periods per machine cycle

lu
The crystal frequency connected to the X1 – X2 input pins. C compiler converts the C statements
and functions to Assembly language instructions. Different compilers produce different code.
So
Write an 8051 C program to toggle bits of P1 continuously forever with some delay.
Solution:
Toggle P1 forever with some delay in between “on” and “off”
#include <reg51.h>
void main(void)
{
unsigned int x;
for (;;) //repeat forever
{
U

P1=0x55;
for (x=0;x<40000;x++); //delay size
//unknown
P1=0xAA;
VT

for (x=0;x<40000;x++);
}
}

Write an 8051 C program to toggle bits of P1 ports continuously with a 250 ms.
Solution:
#include <reg51.h>
void MSDelay(unsigned int);
void main(void)
{

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
while (1) //repeat forever
{
P1=0x55;
MSDelay(250);
P1=0xAA;
MSDelay(250);

n
}
}
void MSDelay(unsigned int itime)

tio
{
unsigned int i,j;
for (i=0;i<itime;i++)
for (j=0;j<1275;j++);
}

I/O Programming in C

Solution:
#include <reg51.h>
#define LED P2;
lu
LEDs are connected to bits P1 and P2. Write an 8051 C program that shows the count from 0 to
FFH (0000 0000 to 1111 1111 in binary) on the LEDs.
So
void main(void)
{
P1=00; //clear P1
LED=0; //clear P2
for (;;) //repeat forever
{
P1++; //increment P1
LED++; //increment P2
}
U

Write an 8051 C program to get a byte of data form P1, wait ½ second, and then send it to P2.
Solution:
VT

#include <reg51.h>
void MSDelay(unsigned int);
void main(void)
{
unsigned char mybyte;
P1=0xFF; //make P1 input port
while (1)
{
mybyte=P1; //get a byte from P1
MSDelay(500);

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
P2=mybyte; //send it to P2
}
}

Write an 8051 C program to get a byte of data form P0. If it is less than 100, send it to P1;
otherwise, send it to P2.

n
Solution:
#include <reg51.h>
void main(void)

tio
{
unsigned char mybyte;
P0=0xFF; //make P0 input port
while (1)
{
mybyte=P0; //get a byte from P0
if (mybyte<100)
P1=mybyte; //send it to P1
else
P2=mybyte; //send it to P2
}
} lu
So
Write an 8051 C program to monitor bit P1.5. If it is high, send 55H to P0; otherwise, send AAH
to P2.
Solution:
#include <reg51.h>
sbit mybit=P1^5;
void main(void)
{
mybit=1; //make mybit an input
U

while (1)
{
if (mybit==1)
P0=0x55;
VT

else
P2=0xAA;
}
}

Write an 8051 C program to turn bit P1.5 on and off 50,000 times.
Solution:
sbit MYBIT=0x95;
void main(void)
{

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
unsigned int z;
for (z=0;z<50000;z++)
{
MYBIT=1;
MYBIT=0;
}

n
}

Write an 8051 C program to get the status of bit P1.0, save it, and send it to P2.7 continuously.

tio
Solution:
#include <reg51.h>
sbit inbit=P1^0;
sbit outbit=P2^7;
bit membit; //use bit to declare
//bit- addressable memory
void main(void)
{
while (1)
{
membit=inbit; //get a bit from P1.0
outbit=membit; //send it to P2.7 lu
So
}
}
Logic Operations in C
Logical operators
AND (&&), OR (||), and NOT (!)
Bit-wise operators
AND (&), OR (|), EX-OR (^), Inverter (~),
Shift Right (>>), and Shift Left (<<)
These operators are widely used in software
U

engineering for embedded systems and control


VT

Run the following program on your simulator and examine the results.
Solution:
#include <reg51.h>
void main(void)
{
P0=0x35 & 0x0F; //ANDing
P1=0x04 | 0x68; //ORing
P2=0x54 ^ 0x78; //XORing

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
P0=~0x55; //inversing
P1=0x9A >> 3; //shifting right 3
P2=0x77 >> 4; //shifting right 4
P0=0x6 << 4; //shifting left 4
}

n
Write an 8051 C program to toggle all the bits of P0 and P2
continuously with a 250 ms delay. Using the inverting and Ex-OR
operators, respectively.

tio
Solution:
#include <reg51.h>
void MSDelay(unsigned int);
void main(void)
{
P0=0x55;
P2=0x55;
while (1)
{
P0=~P0;
P2=P2^0xFF;
MSDelay(250); lu
So
}
}

Write an 8051 C program to get bit P1.0 and send it to P2.7 after
inverting it.
Solution:
#include <reg51.h>
sbit inbit=P1^0;
sbit outbit=P2^7;
U

bit membit;
void main(void)
{
while (1)
VT

{
membit=inbit; //get a bit from P1.0
outbit=~membit; //invert it and send
//it to P2.7
}
}

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
Data Conversion using C
Write an 8051 C program to convert packed BCD 0x29 to ASCII and display the bytes on P1 and
P2.
Solution:
#include <reg51.h>
void main(void)

n
{
unsigned char x,y,z;
unsigned char mybyte=0x29;

tio
x=mybyte&0x0F;
P1=x|0x30;
y=mybyte&0xF0;
y=y>>4;
P2=y|0x30;
}

Solution:
#include <reg51.h>
void main(void) lu
Write an 8051 C program to convert ASCII digits of „4‟ and „7‟ to packed BCD and display them
on P1.
So
{
unsigned char bcdbyte;
unsigned char w=„4‟;
unsigned char z=„7‟;
w=w&0x0F;
w=w<<4;
z=z&0x0F;
bcdbyte=w|z;
P1=bcdbyte;
U

Write an 8051 C program to calculate the checksum byte for the data 25H, 62H, 3FH, and 52H.
VT

Solution:
#include <reg51.h>
void main(void)
{
unsigned char mydata[]={0x25,0x62,0x3F,0x52};
unsigned char sum=0;
unsigned char x;
unsigned char chksumbyte;
for (x=0;x<4;x++)
{

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
P2=mydata[x];
sum=sum+mydata[x];
P1=sum;
}
chksumbyte=~sum+1;
P1=chksumbyte;

n
}

Write an 8051 C program to perform the checksum operation to ensure data integrity. If data is

tio
good, send ASCII character „G‟ to [Link] send „B‟ to P0.
Solution:
#include <reg51.h>
void main(void)
{
unsigned char mydata[]
={0x25,0x62,0x3F,0x52,0xE8};
unsigned char shksum=0;
unsigned char x;
for (x=0;x<5;x++)
chksum=chksum+mydata[x];
if (chksum==0) lu
So
P0=„G‟;
else
P0=„B‟;
}

Write an 8051 C program to convert 11111101 (FD hex) to decimal and display the digits on P0,
P1 and P2.
Solution:
#include <reg51.h>
U

void main(void)
{
unsigned char x,binbyte,d1,d2,d3;
binbyte=0xFD;
VT

x=binbyte/10;
d1=binbyte%10;
d2=x%10;
d3=x/10;
P0=d1;
P1=d2;
P2=d3;
}

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
Accessing Code ROM Space
The 8051 C compiler allocates RAM locations. Bank 0 – addresses 0 – 7. Individual variables
addresses 08 and beyond. Array elements – addresses right after variables. Array elements need
contiguous RAM locations and that limits the size of the array due to the fact that we have only
128 bytes of RAM for everything. Stack – addresses right after array elements.

n
Compile and single-step the following program on your 8051 simulator. Examine the contents of
the 128-byte RAM space to locate the ASCII values.
Solution:

tio
#include <reg51.h>
void main(void)
{
unsigned char mynum[]=“ABCDEF”; //RAM space
unsigned char z;
for (z=0;z<=6;z++)
P1=mynum[z];
}

lu
Write, compile and single-step the following program on your 8051 simulator. Examine the
contents of the code space to locate the values.
Solution:
So
#include <reg51.h>
void main(void)
{
unsigned char mydata[100]; //RAM space
unsigned char x,z=0;
for (x=0;x<100;x++)
{
z--;
mydata[x]=z;
U

P1=z;
}
}
VT

Data Serialization
Serializing data is a way of sending a byte of data one bit at a time through a single pin of
microcontroller using the serial port. Transfer data one bit a time and control the sequence of
data and spaces in between them is known as serialization. In many new generations of devices
such as LCD, ADC, and ROM the serial versions are becoming popular since they take less
space on a PCB.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
Write a C program to send out the value 44H serially one bit at a time via P1.0. The LSB should
go out first.
Solution:
#include <reg51.h>
sbit P1b0=P1^0;
sbit regALSB=ACC^0;

n
void main(void)
{
unsigned char conbyte=0x44;

tio
unsigned char x;
ACC=conbyte;
for (x=0;x<8;x++)
{
P1b0=regALSB;
ACC=ACC>>1;
}
}

lu
Write a C program to send out the value 44H serially one bit at a time via P1.0. The MSB should
go out first.
Solution:
So
#include <reg51.h>
sbit P1b0=P1^0;
sbit regAMSB=ACC^7;
void main(void)
{
unsigned char conbyte=0x44;
unsigned char x;
ACC=conbyte;
for (x=0;x<8;x++)
U

{
P1b0=regAMSB;
ACC=ACC<<1;
}
VT

Write a C program to bring in a byte of data serially one bit at a time via P1.0. The LSB should
come in first.
Solution:
#include <reg51.h>
sbit P1b0=P1^0;
sbit ACCMSB=ACC^7;
bit membit;
void main(void)

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
{
unsigned char x;
for (x=0;x<8;x++)
{
membit=P1b0;
ACC=ACC>>1;

n
ACCMSB=membit;
}
P2=ACC;

tio
}

Write a C program to bring in a byte of data serially one bit at a time via P1.0. The MSB should
come in first.
Solution:
#include <reg51.h>
sbit P1b0=P1^0;
sbit regALSB=ACC^0;
bit membit;
void main(void)
{ lu
So
unsigned char x;
for (x=0;x<8;x++)
{
membit=P1b0;
ACC=ACC<<1;
regALSB=membit;
}
P2=ACC;
}
U
VT

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]

Module No: 4
8051 SERIAL PORT PROGRAMMING IN ASSEMBLY AND C
Computers transfer data in two ways: parallel and serial. In parallel data transfers, often 8 or

n
more lines (wire conductors) are used to transfer data to a device that is only a few feet away.
Examples of parallel transfers are printers and hard disks; each uses cables with many wire
strips. Although in such cases a lot of data can be transferred in a short amount of time by using

tio
many wires in parallel, the distance cannot be great. To transfer to a device located many meters
away, the serial method is used. In serial communication, the data is sent one bit at a time, in
contrast to parallel communication, in which the data is sent a byte or more at a time. The 8051
has serial communication capability built into it, thereby making possible fast data transfer using
only a few wires.
BASICS OF SERIAL COMMUNICATION
lu
When a microcontroller communicates with the outside world, it provides the data in byte-sized
So
chunks. In some cases, such as printers, the information is simply grabbed from the 8-bit data
bus and presented to the 8-bit data bus of the printer. This can work only if the cable is not too
long, since long cables diminish and even distort signals. Furthermore, an 8-bit data path is
expensive. For these reasons, serial communication is used for transferring data between two
systems located at distances of hundreds of feet to millions of miles apart. Figure 10-1 diagrams
serial versus parallel data transfers.
U
VT

Fig: Serial vs Parallel transfer


The fact that serial communication uses a single data line instead of the 8-bit data line of parallel
communication not only makes it much cheaper but also enables two computers located in two

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
different cities to communicate over the telephone. For serial data communication to work, the
byte of data must be converted to serial bits using a parallel-in-serial-out shift register; then it can
be transmitted over a single data line. This also means that at the receiving end there must be a
serial-in-parallel-out shift register to receive the serial data and pack them into a byte. Of course,

n
if data is to be transferred on the telephone line, it must be converted from Os and 1s to audio
tones, which are sinusoidal-shaped signals. This conversion is performed by a peripheral device
called a modem, which stands for “modulator/demodulator.”

tio
When the distance is short, the digital signal can be transferred as it is on a simple wire and
requires no modulation. This is how IBM PC keyboards transfer data to the motherboard.
However, for long-distance data transfers using communication lines such as a telephone, serial
data communication requires a modem to modulate (convert from Os and 1 s to audio tones) and
demodulate (converting from audio tones to Os and 1 s).

lu
Serial data communication uses two methods, Asynchronous and Synchronous. The synchronous
method transfers a block of data (characters) at a time, while the asynchronous method transfers
So
a single byte at a time. It is possible to write software to use either of these methods, but the
programs can be tedious and long. For this reason, there are special IC chips made by many
manufacturers for serial data communications. These chips are commonly referred to as UART
(universal asynchronous receiver-transmitter) and USART (universal synchronous-asynchronous
receiver-transmitter). The 8051 chip has a built-in UART.
Half- and full-duplex transmission
U

In data transmission if the data can be transmitted and received, it is a duplex transmission. This
is in contrast to simplex transmissions such as with printers, in which the computer only sends
data. Duplex transmissions can be half or full duplex, depending on whether or not the data
VT

transfer can be simultaneous. If data is transmitted one way at a time, it is referred to as half
duplex. If the data can go both ways at the same time, it is full duplex. Of course, full duplex
requires two wire conductors for the data lines (in addition to the signal ground), one for
transmission and one for reception, in order to transfer and receive data simultaneously.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]

n
tio
Fig: Simplex, duplex transfer
Asynchronous serial communication and data framing

lu
Asynchronous serial data communication is widely used for character-oriented
So
transmissions, while block-oriented data transfers use the synchronous method. In the
asynchronous method, each character is placed between start and stop bits. This is called
framing. In data framing for asynchronous communications, the data, such as ASCII characters,
are packed between a start bit and a stop bit. The start bit is always one bit, but the stop bit can
be one or two bits. The start bit is always a 0 (low) and the stop bit(s) is 1 (high). For example,
look at Figure in which the ASCII character “A” (8-bit binary 0100 0001) is framed between the
start bit and a single stop bit. Notice that the LSB is sent out first.
U
VT

Fig: Data framing


when there is no transfer, the signal is 1 (high), which is referred to as mark. The 0 (low) is
referred to as space. Notice that the transmission begins with a start bit followed by DO, which

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
is the LSB, then the rest of the bits until the MSB (D7), and finally, the one stop bit indicating
the end of the character “A”.
In asynchronous serial communications, peripheral chips and modems can be programmed for
data that is 7 or 8 bits wide. This is in addition to the number of stop bits, 1 or 2. While in older

n
systems ASCII characters were 7-bit, in recent years, due to the extended ASCII characters, 8-bit
data has become common. In some older systems, due to the slowness of the receiving
mechanical device, two stop bits were used to give the device sufficient time to organize itself

tio
before transmission of the next byte. In modern PCs however, the use of one stop bit is standard.
Assuming that we are transferring a text file of ASCII characters using 1 stop bit, we have a total
of 10 bits for each character: 8 bits for the ASCII code, and 1 bit each for the start and stop bits.
Therefore, for each 8-bit character there are an extra 2 bits, which gives 20% overhead.

lu
In some systems, the parity bit of the character byte is included in the data frame in order to
maintain data integrity. This means that for each character (7- or 8-bit, depending on the system)
we have a single parity bit in addition to start and stop bits. The parity bit is odd or even. In the
So
case of an odd-parity bit the number of data bits, including the parity bit, has an odd number of
1s. Similarly, in an even-parity bit system the total number of bits, including the parity bit, is
even. For example, the ASCII character “A”, binary 0100 0001, has 0 for the even-parity bit.
UART chips allow programming of the parity bit for odd-, even-, and no-parity options.
In Asynchronous Serial Data Communication Pins TxD (P3.1) and RxD (P3.0) are used for
transmitting and receiving the data serially. Figure below shows synchronous serial data
U

communication which uses a common clock for synchronization of transmitter and


receiver.
VT

Data transfer rate


The rate of data transfer in serial data communication is stated in bps (bits per second). Another
widely used terminology for bps is baud rate. However, the baud and bps rates are not

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
necessarily equal. This is due to the fact that baud rate is the modem terminology and is defined
as the number of signal changes per second. In modems a single change of signal, sometimes
transfers several bits of data. As far as the conductor wire is concerned, the baud rate and bps are
the same, and for this reason in this book we use the terms bps and baud interchangeably.

n
The data transfer rate of a given computer system depends on communication ports incorporated
into that system. For example, the early IBM PC/XT could transfer data at the rate of 100 to
9600 bps. In recent years, however, Pentium-based PCs transfer data at rates as high as 56K bps.

tio
It must be noted that in asynchronous serial data communication, the baud rate is generally
limited to 100,000 bps.
RS232 standards
To allow compatibility among data communication equipment made by various manufacturers,

lu
an interfacing standard called RS232 was set by the Electronics Industries Association (EIA) in
1960. In 1963 it was modified and called RS232A. RS232B and RS232C were issued in 1965
and 1969, respectively. Today, RS232 is the most widely used serial I/O interfacing standard.
So
This standard is used in PCs and numerous types of equipment. However, since the standard was
set long before the advent of the TTL logic family, its input and output voltage levels are not
TTL compatible. In RS232, a 1 is represented by -3 to -25 V, while a 0 bit is +3 to +25 V,
making -3 to +3 undefined. For this reason, to connect any RS232 to a micro controller system
we must use voltage converters such as MAX232 to convert the TTL logic levels to the RS232
voltage levels, and vice versa. MAX232 IC chips are commonly referred to as line drivers.
U

RS232 pins
Figure shows DB 25 connector. But IBM introduced the DB-9 version of the serial I/O standard,
which uses 9 pins only,
VT

Fig: DB 25 connector

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]

n
tio
Fig: DB 9 connector

lu
So
U
VT

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]

n
tio
lu
So
U
VT

fig: Pin description of DB-25

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]

n
tio
fig: Pin description of DB-9
Data Communication

lu
Current terminology classifies data communication equipment as DTE (data terminal equipment)
or DCE (data communication equipment). DTE refers to terminals and computers that send and
So
receivedata, while DCE refers to communication equipment, such as modems, that are
responsible for transferring the data.
The simplest connection between a PC and microcontroller requires a minimum of three pins,
TxD, RxD, and ground, Notice in that figure that the RxD and TxD pins are interchanged.
Examining RS232 handshaking signals
U
VT

Fig:Null modem connection


The simplest connection between a PC and microcontroller requires a minimum of three pins,
TxD,RxD, and ground, Notice in that figure that the RxD and TxD pins are interchanged.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
Examining RS232 handshaking signals
To ensure fast and reliable data transmission between two devices, the data transfer must be
coordinated. Just as in the case of the printer, because the receiving device in serial data
communication may have no room for the data, there must be a way to inform the sender to stop

n
sending data. Many of the pins of the RS-232 connector are used for handshaking signals.
[Link](data terminal ready). When a terminal (or a PC COM port) is turned on, after going
through a self-test, it sends out signal DTR to indicate that it is ready for communication.

tio
If there is something wrong with the COM port, this signal will not be activated. This is an
active-low signal and can be used to inform the modem that the computer is alive and
kicking. This is an output pin from DTE (PC COM port) and an input to the [Link]
(data set ready).

lu
2. When DCE (modem) is turned on and has gone through the self-test, it asserts DSR to
indicate that it is ready to communicate. Thus, it is an output from the modem (DCE) and
input to the PC (DTE). This is an active- low signal. If for any reason the modem cannot
So
make a connection to the telephone, this signal remains inactive, indicating to the PC (or
terminal) that it cannot accept or send data.
3. RTS (request to send). When the DTE device (such as a PC) has a byte to transmit, it asserts
RTS to
signal the modem that it has a byte of data to transmit. RTS is an active-low output from the
DTE and an input to the modem.
U

[Link] (clear to send). In response to RTS, when the modem has room for storing the data it is to
receive, it sends out signal CTS to the DTE (PC) to indicate that it can receive the data now. This
input signal to the DTE is used by the DTE to start transmission.
VT

5. DCD (carrier detect, or DCD, data carrier detect). The modem asserts signal DCD to inform
the DTE (PC) that a valid carrier has been detected and that contact between it and the other
modem is established. Therefore, DCD is an output from the modern and an input to the PC
(DTE).
[Link] (ring indicator). An output from the modem (DCE) and an input to a PC (DTE) indicates
that the telephone is ringing. It goes on and off in synchronization with the ringing sound. Of the
six handshake signals, this is the least often used, due to the fact that modems take care of

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
answering the phone.
However, if the PC is in charge of answering the phone, this signal can be used.
While signals DTE and DSR are used by the PC and modem, respectively, to indicate that they
are alive and well, it is RTS and CTS that actually control the flow of data. When the PC wants

n
to send data it asserts RTS, and in response, if the modem is ready (has room) to accept the data,
it sends back CTS. If, for lack of room, the modem does not activate CTS, the PC will deassert
DTR and try again. RTS and CTS are also referred to as hardware control flow signals.

tio
Serial Interface
The serial port of 8051 is full duplex, i.e., it can transmit and receive simultaneously. The
register SBUF is used to hold the data. The special function register SBUF is physically two

lu
registers. One is, write-only and is used to hold data to be transmitted out of the 8051 via TXD.
The other is, read-only and holds the received data from external sources via RXD. Both
mutually exclusive registers have the same address 099H.
So
Serial Port Control Register (SCON)
SCON Register

Serial control register: SCON


SM0, SM1 : Serial port mode specifier
Register SCON controls serial data communication. Address: 098H (Bit addressable)
U

Mode select bits

SM0 SM1 MODE


VT

0 0 Mode0

0 1 Mode1

1 0 Mode2

1 1 M ode3

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
SM2:used for multiprocessor communication.
REN: set or cleared by software to enable/disable reception.
TB8: Transmitted bit 8,not widely used.
RB8:Received bit 8.

n
TI:Transmit interrupt flag –set by the hardware at the beginning of the stop bit in
mode 1, must be cleared by software.
RI: Receive interrupt flag –set by the hardware halfway through the stop bit time in

tio
mode1, must be cleared by software.
Programming the 8051 to transfer data serially
In programming the 8051 to transfer character bytes serially, the following steps must be taken.
1. The TMOD register is loaded with the value 20H, indicating the use of Timer
1 in mode 2 (8-bit auto-reload) to set the baud rate.

lu
2. The TH1 is loaded with one of the values in Table 10-4 to set the baud rate for
serial data transfer (assuming XTAL = 11.0592 MHz).
So
3. The SCON register is loaded with the value 50H, indicating serial mode 1,
where an 8-bit data is framed with start and stop bits.
4. TR1 is set to 1 to start Timer 1.
5. TI is cleared by the “CLR TI” instruction.
6. The character byte to be transferred serially is written into the SBUF register.
7. The TI flag bit is monitored with the use of the instruction ” JNB TI, xx” to
U

see if the character has been transferred completely.


8. To transfer the next character, go to Step 5.
 Importance of the Tl flag
VT

To understand the importance of the role of TI, look at the following sequence of steps that the
8051 goes through in transmitting a character via TxD.
1. The byte character to be transmitted is written into the SBUF register.
2. The start bit is transferred.
3. The 8-bit character is transferred one bit at a time.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
4. The stop bit is transferred. It is during the transfer of the stop bit that the 8051
raises the TI flag (TI =1), indicating that the last character was transmitted
and it is ready to transfer the next character.
5. By monitoring the TI flag, we make sure that we are not overloading the SBUF

n
register. If we write another byte into the SBUF register before TI is raised, the
untransmitted portion of the previous byte will be lost.
In other words, when the 8051 finishes transferring a byte, it raises the TI flag to indicate it is

tio
ready for the next character. 6. After SBUF is loaded with a new byte, the TI flag bit must be
forced to 0 by the “CLR TI” instruction in order for this new byte to be transferred.
From the above discussion we conclude that by checking the TI flag bit, we know whether or not
the 8051 is ready to transfer another byte. More importantly, it must be noted that the TI flag bit

lu
is raised by the 8051 itself when it finishes the transfer of data, whereas it must be cleared by the
programmer with an instruction such as “CLR TI”. It also must be noted that if we write a byte
into SBUF before the TI flag bit is raised, we risk the loss of a portion of the byte being
So
transferred. The TI flag bit can be checked by the instruction “JNB TI, . . .” .

Programming the 8051 to receive data serially


In the programming of the 8051 to receive character bytes serially, the following steps must be
taken.
1. The TMOD register is loaded with the value 20H, indicating the use of Timer
U

1 in mode 2 (8-bit auto-reload) to set the baud rate.


2. TH1 is loaded with one of the values in Table 10-4 to set the baud rate (assum
ing XTAL = 11.0592MHz).
VT

3. The SCON register is loaded with the value 50H, indicating serial mode 1,
where 8-bit data is framed with start and stop bits and receive enable is turned
on.
4. TR1 is set to 1 to start Timer [Link] is cleared with the “CLR RI” instruction.
5. The RI flag bit is monitored with the use of the instruction “JNB RI, xx” to
see if an entire character has been received yet. When RI is raised, SBUF has the byte. Its
contents are moved into a safe place.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
6. To receive the next character, go to Step 5.
Importance of the Rl flag bit
In receiving bits via its RxD pin, the 8051 goes through the following steps.
1. It receives the start bit indicating that the next bit is the first bit of the charac

n
ter byte it is about to receive.
2. The 8-bit character is received one bit at time. When the last bit is received, a
byte is formed and placed in SBUF.

tio
3. The stop bit is received. When receiving the stop bit the 8051 makes RI = 1,
indicating that an entire character byte has been received and must be picked
up before it gets overwritten by an incoming character.
4. By checking the RI flag bit when it is raised, we know that a character has been

lu
received and is sitting in the SBUF register. We copy the SBUF contents to a
safe place in some other register or memory before it is lost.
5. After the SBUF contents are copied into a safe place, the RI flag bit must be
So
forced to 0 by the “CLR RI” instruction in order to allow the next received
character byte to be placed in SBUF. Failure to do this causes loss of the
received character.
U

Data Transmission
Transmission of serial data begins at any time when data is written to SBUF. Pin P3.1 (Alternate
function bit TXD) is used to transmit data to the serial data network. TI is set to 1 when data has been
VT

transmitted. This signifies that SBUF is empty so that another byte can be sent.
Data Reception
Reception of serial data begins if the receive enable bit is set to 1 for all modes. Pin P3.0 (Alternate
function bit RXD) is used to receive data from the serial data network. Receive interrupt flag, RI, is set
after the data has been received in all modes. The data gets stored in SBUF register from where it can
be read.
Serial Data Transmission Modes:

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
Mode-0: In this mode, the serial port works like a shift register and the data transmission works synchronously w
to the external circuitry for synchronization. The shift frequency or baud rate is always 1/12 of the oscillator freq

n
tio
Fig : Data transmission/reception in Mode-0
In mode-1, the serial port functions as a standard Universal Asynchronous Receiver Transmitter (UART) mode
received, the stop bit goes into RB8 in the special function register SCON. The baud rate is variable.
The following figure shows the way the bits are transmitted/ received.

lu
So
Bit time= 1/fbaud
U

In receiving mode, data bits are shifted into the receiver at the programmed baud rate.
The data word (8-bits) will be loaded to SBUF if the following conditions are true.
 RI must be zero. (i.e., the previously received byte has been cleared from SBUF)
VT

 Mode bit SM2 = 0 or stop bit = 1.


After the data is received and the data byte has been loaded into SBUF, RI becomes one.
Mode-1 baud rate generation:
Timer-1 is used to generate baud rate for mode-1 serial communication by using overflow flag
of the timer to determine the baud frequency. Timer-1 is used in timer mode-2 as an auto-reload
8-bit timer. The data rate is generated by timer-1 using the following formula.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]

Where,

n
SMOD is the
fosc is the crystal oscillator frequency of the microcontroller
It can be noted that fosc/ (12 X [256- (TH1)]) is the timer overflow frequency in timer mode-2,

tio
which is the auto-reload mode.
If timer-1 is not run in mode-2, then the baud rate is,

pin T1 (P3.5) (Counter mode).


Serial Data Mode-2 - Multiprocessor Mode :
lu
Timer-1 can be run using the internal clock, fosc/12 (timer mode) or from any external source via
So
In this mode 11 bits are transmitted through TXD or received through RXD. The various bits are
as follows: a start bit (usually '0'), 8 data bits (LSB first), a programmable 9 th (TB8 or RB8)bit
and a stop bit (usually '1').
While transmitting, the 9 th data bit (TB8 in SCON) can be assigned the value '0' or '1'. For
example, if the information of parity is to be transmitted, the parity bit (P) in PSW could be
moved into TB8. On reception of the data, the 9 th bit goes into RB8 in 'SCON', while the stop bit
U

is ignored. The baud rate is programmable to either 1/32 or 1/64 of the oscillator frequency.

Mode-3 - Multi processor mode with variable baud rate :


VT

In this mode 11 bits are transmitted through TXD or received through RXD. The various bits are:
a start bit (usually '0'), 8 data bits (LSB first), a programmable 9 th bit and a stop bit (usually '1').
Mode-3 is same as mode-2, except the fact that the baud rate in mode-3 is variable (i.e., just as in
mode-1).
f baud = (2 SMOD /32) * ( fosc / 12 (256-TH1)) .
This baudrate holds when Timer-1 is programmed in Mode-2.
Programming the 8051 to transfer data serially

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
Write a program for the 8051 to transfer letter “A” serially at 4800baud, continuously.
MOV TMOD,#20H ;timer 1, mode 2
MOV TH1,#-6 ;4800 baud rate
MOV SCON,#50H ;8-bit,1 stop,REN enabled

n
SETB TR1 ;start timer 1
AGAIN: MOV SBUF,#”A” ;letter “A” to be transferred
HERE: JNB TI,HERE ;wait for the last bit

tio
CLR TI ;clear TI for next char
SJMP AGAIN ;keep sending A

Write a program to transfer the message “YES” serially at 9600 baud, 8-bit data, 1 stop bit.
Do this continuously.
MOV TMOD,#20H ;timer 1, mode 2
MOV TH1,#-3 ;9600 baud lu
So
MOV SCON,#50H
SETB TR1
AGAIN: MOV A,#”Y” ;transfer “Y”
ACALL TRANS
MOV A,#”E” ;transfer “E”
ACALL TRANS
U

MOV A,#”S” ;transfer “S”


ACALL TRANS
SJMP AGAIN ;keep doing it;serial data transfer subroutine
VT

TRANS: MOV
HERE: JNB TI,HERE
CLR TI ;ge
RET

Baud Rates in the 8051


 Timer 1, mode 2 (8-bit, auto-reload)

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
 Define TH1 to set the baud rate.
XTAL = 11.0592 MHz
The system frequency = 11.0592 MHz / 12 = 921.6 kHz
Timer 1 has 921.6 kHz/ 32 = 28,800 Hz as source.

n
TH1=FDH means that UART sends a bit every 3 timer source.
Baud rate = 28,800/3= 9,600 Hz
Example

tio
With XTAL = 11.0592 MHz, find the TH1 value needed to have the
following baud rates. (a) 9600 (b) 2400 (c) 1200
Solution:
With XTAL = 11.0592 MHz, we have:

lu
The frequency of system clock = 11.0592 MHz / 12 = 921.6 kHz
The frequency sent to timer 1 = 921.6 kHz/ 32 = 28,800 Hz
(a) 28,800 / 3 = 9600 where -3 = FD (hex) is loaded into TH1
So
(b) 28,800 / 12 = 2400 where -12 = F4 (hex) is loaded into TH1
(c) 28,800 / 24 = 1200 where -24 = E8 (hex) is loaded into TH1
Registers Used in Serial Trans1fer Circuit
SUBF (Serial data buffer)
SCON (Serial control register)
PCON (Power control register)
U

SBUF Register
Serial data register: SBUF
MOV SBUF,#‟A‟ ;put char „A‟ to transmit
VT

MOV SBUF,A ;send data from A


MOV A, SUBF ;receive and copy to A
An 8-bit register
Set the usage mode for two timers
For a byte of data to be transferred via the TxD line, it must be placed in the SBUF.
SBUF holds the byte of data when it is received by the 8051‟s RxD line.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
Write a C program for 8051 to transfer the letter “A” serially at 4800 baud continuously.
Use 8-bit data and 1 stop bit.
Solution:
#include <reg51.h>

n
void main(void){
TMOD=0x20; //use Timer 1, mode 2
TH1=0xFA; //4800 baud rate

tio
SCON=0x50;
TR1=1;
while (1) {
SBUF=„A‟; //place value in buffer
while (TI==0);
TI=0;
} lu
So
}
Write an 8051 C program to transfer the message “YES” serially at 9600 baud, 8-bit data,
1 stop bit. Do this continuously.
Solution:
#include <reg51.h>
void SerTx(unsigned char);
U

void main(void){
TMOD=0x20; //use Timer 1, mode 2
TH1=0xFD; //9600 baud rate
VT

SCON=0x50;
TR1=1; //start timer
while (1) {
SerTx(„Y‟);
SerTx(„E‟);
SerTx(„S‟);
}

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
}
void SerTx(unsigned char x){
SBUF=x; //place value in buffer
while (TI==0); //wait until transmitted

n
TI=0;
}
Program the 8051 in C to receive bytes of data serially and put them in P1. Set the baud

tio
rate at 4800, 8-bit data, and 1 stop bit.
Solution:
#include <reg51.h>
void main(void){
unsigned char mybyte;
TMOD=0x20; //use Timer 1, mode 2
TH1=0xFA; //4800 baud rate lu
So
SCON=0x50;
TR1=1; //start timer
while (1) { //repeat forever
while (RI==0); //wait to receive
mybyte=SBUF; //save value
P1=mybyte; //write value to port
U

RI=0;
}
}
VT

Write an 8051 C Program to send the two messages “Normal Speed” and “High Speed” to
the serial port. Assuming that SW is connected to pin P2.0, monitor its status and set the
baud rate as follows:
SW = 0, 28,800 baud rate, SW = 1, 56K baud rate. Assume that XTAL = 11.0592 MHz for both
cases.
Solution:

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
#include <reg51.h>
sbit MYSW=P2^0; //input switch
void main(void){
unsigned char z;

n
unsigned char Mess1[]=“Normal Speed”;
unsigned char Mess2[]=“High Speed”;
TMOD=0x20; //use Timer 1, mode 2

tio
TH1=0xFF; //28800 for normal
SCON=0x50;
TR1=1; //start timer
if(MYSW==0) {
for (z=0;z<12;z++) {
SBUF=Mess1[z]; //place value in buffer
while(TI==0); //wait for transmit lu
So
TI=0;
}
}
else {
PCON=PCON|0x80; //for high speed of 56K
for (z=0;z<10;z++) {
U

SBUF=Mess2[z]; //place value in buffer


while(TI==0); //wait for transmit
TI=0;
VT

}
}
}
8051 Interrupt
A computer has only two ways to determine the conditions that exist in internal and external
circuits. One method uses software instructions that jump to subroutines on the status of flags
and port pins. The second method responds to hardware signals, called interrupts that force the

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
program to call a subroutine. Most applications of microcontroller involve responding to events
quickly enough to control the environment that generates the events termed real-time
programming.
An interrupt is an external or internal event that interrupts the microcontroller to inform it that a

n
device needs its service. A single microcontroller can serve several devices by two ways.
1) Interrupts
Whenever any device needs its service, the device notifies the microcontroller by sending it

tio
an interrupt signal. Upon receiving an interrupt signal, the microcontroller interrupts whatever it
is doing and serves the device. The program which is associated with the interrupt is called the
interrupt service routine(ISR) or interrupt handle
2) Polling

lu
The microcontroller continuously monitors the status of a given device. When the conditions
met, it performs the service. After that, it moves on to monitor the next device until everyone is
serviced. Polling can monitor the status of several devices and serve each of them as certain
So
conditions are met. The polling method is not efficient, since it wastes much of the
microcontroller‟s time by polling devices that do not need service. ex. JNB TF,target.
The advantage of interrupts is that the microcontroller can serve many devices (not all at
the same time). Each devices can get the attention of the microcontroller based on the assigned
Priority. For the polling method, it is not possible to assign priority since it checks all devices in
a round-robin fashion. The microcontroller can also ignore (mask) a device request for service.
U

This is not possible for the polling method. For every interrupt, there must be an interrupt service
routine (ISR), or interrupt handler. When an interrupt is invoked, the microcontroller runs the
interrupt service routine. For every interrupt, there is a fixed location in memory that holds the
VT

address of its ISR. The group of memory locations set aside to hold the addresses of ISRs is
called interrupt vector table.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]

Upon activation of an interrupt, the microcontroller goes through the following steps

n
tio
lu
So
1. It finishes the instruction it is executing and saves the address of the next instruction (PC) on
the stack .
2. It also saves the current status of all the interrupts internally (i.e: not on the stack)
3. It jumps to a fixed location in memory, called the interrupt vector table, that holds the address
of the ISR
4. The microcontroller gets the address of the ISR from the interrupt vector table and jumps to it.
U

It starts to execute the interrupt service subroutine until it reaches the last instruction of the
subroutine which is RETI (return from interrupt).
5. Upon executing the RETI instruction, the microcontroller returns to the place where it was
VT

interrupted. First, it gets the program counter (PC) address from the stack by popping the top
two bytes of the stack into the PC. Then it starts to execute from that address.

Basically there are Six interrupts allocated as follows


1) Reset – power-up reset

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
2) Two interrupts are set aside for the timers: one for timer 0 and one for timer 1
3) Two interrupts are set aside for hardware. external interrupts � P3.2 and P3.3 are for the
external hardware interrupts INT0 (or EX1), and INT1 (or EX2).
4) Serial communication has a single interrupt that belongs to both receive and transfer.

n
tio
lu
Upon reset, all interrupts are disabled (masked), meaning that none will be responded by the
microcontroller if they are activated. The interrupts must be enabled by software in order for the
So
microcontroller to respond to them.
What is difference between RET and RETI Instructions.
The instruction RET is a return from a function or a subroutine while RETI is return from an
interrupt. The RETI instruction is executed at the end of interrupt subroutine. After the execution
of the RETI instruction the PC address will be restored from the stack.
Comparison between Call instruction and the Interrupt action can be as:
U

Call Instruction Interrupt Action

Completely under the control of Occurs at any time in the program


VT

programmer

Placed in the program by the Enabled by the programmer


programmer

Execution is determined by where it is Calls the subroutine at any time and any
placed in the program place the program is executed

Table 1: Comparison of Call Instruction and Interrupt Action

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]

Interrupt Enable (IE) SFR:


This is a bit addressable SFR with byte address A8H. The bits and addresses are shown in table

n
2. The bits are explained below.

IE.7 IE.6 IE.5 IE.4 IE.3 IE.2 IE.1 IE.0

tio
EA - ET2 ES ET1 EX1 ET0 EX0

AFH AEH ADH ACH ABH AAH A9H A8H

Table 2: Interrupt Enable SFR

lu
EA: This bit is a global interrupt enable/disable bit. When set to 1, it permits individual
interrupts to be enable by their respective enable bits. When 0, it disables all interrupts.
IE.6: Not implemented
So
ET2: Reserved for future use.
ES: Enable serial port interrupt. Set to 1 by program to enable serial port interrupt. Cleared to 0
to disable serial port interrupt.
ET1: Enable (=1)/disable (=0) timer 1 interrupt
EX1: Enable (=1)/disable (=0) external interrupt 1
ET0: Enable (=1)/disable (=0) timer 0 interrupt
U

ET1: Enable (=1)/disable (=0) external interrupt 0


VT

Interrupt Priority (IP):


This a bit addressable register, with byte address B8H. The addresses are shown in table 3. The
priority of the interrupts is determined by the bits of IP SFR. The bits which are set to 1, have a
high priority and bits with 0 have low priority. Interrupts with high priority can interrupt another
interrupt with low priority. The lower priority interrupt is serviced after higher priority interrupt
is finished.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
IP.7 IP.6 IP.5 IP.4 IP.3 IP.2 IP.1 IP.0

- - PT2 PS PT1 PX1 PT0 PX0

- - - BC BB BA B9 B8

n
Table 3: Interrupt Priority (IP)
IP.7 & IP.6: Not implemented

tio
IP.5: Reserved for future use
PS: Serial port priority interrupt
PT1: Priority of timer 1 interrupt
PX1: Priority of external interrupt 1

lu
PT0: Priority of timer 0 interrupt
PX0: Priority of external interrupt 0
When two or more interrupts have the same priority the microcontroller has its own ranking of
So
providing service which is as below:
 External Interrupt 0 (P3.2)
 Timer 0 Overflow
 External Interrupt 0 (P3.3)
 Timer 1 Overflow
 Serial port
U

To enable an interrupt, we take the following steps:


1. Bit D7 of the IE register (EA) must be set to high to allow the rest of register to take effect
2. The value of EA. If EA = 1, interrupts are enabled and will be responded to if their
VT

corresponding bits in IE are high. If EA = 0, no interrupt will be responded to, even if the
associated bit in the IE register is high.

Example

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
Show the instructions to (a) enable the serial interrupt, timer 0 interrupt, and external hardware
interrupt 1 (EX1),and (b) disable (mask) the timer 0 interrupt, then (c) show how to disable all
the interrupts with a single instruction.
Solution:

n
(a) MOV IE,#10010110B ;enable serial,;timer 0, EX1 Another way to perform the same
manipulation is SETB IE.7 ;EA=1, global enable
SETB IE.4 ;enable serial interrupt

tio
SETB IE.1 ;enable Timer 0 interrupt
SETB IE.2 ;enable EX1
(b) CLR IE.1 ;mask (disable) timer 0
;interrupt only
(c) CLR IE.7 ;disable all interrupts

lu
The timer flag (TF) is raised when the timer rolls over .In polling TF, we have to wait
until the TF is raised. The problem with this method is that the microcontroller is tied down
So
while waiting for TF to be raised, and cannot do anything else.
Using interrupts solves this problem and, avoids tying down the controller. If the timer interrupt
in the IE register is enabled, whenever the timer rolls over, TF is raised, and the microcontroller
is interrupted in whatever it is doing, and jumps to the interrupt vector table to service the ISR. In
this way, the microcontroller can do other until it is notified that the timer has rolled over.
U

Example
Write a program that continuously get 8-bit data from P0 and sends it to P1 while
simultaneously creating a square wave of 200 μs period on pin P2.1. Use timer 0 to create
VT

the square wave. Assume that XTAL = 11.0592 MHz.


Solution:
We will use timer 0 in mode 2 (auto reload). TH0 = 100/1.085 us = 92;--upon wake-up go to
main, avoid using ;memory allocated to Interrupt Vector Table
ORG 0000H
LJMP MAIN ;by-pass interrupt vector table;--ISR for timer 0 to generate square wave
ORG 000BH ;Timer 0 interrupt vector table

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
CPL P2.1 ;toggle P2.1 pin
RETI ;
The main program for initialization
ORG 0030H ;after vector table space

n
MAIN: MOV TMOD,#02H ;Timer 0, mode 2
MOV P0,#0FFH ;make P0 an input port
MOV TH0,#-92 ;TH0=A4H for -92

tio
MOV IE,#82H ;IE=10000010 (bin) enable;Timer 0
SETB TR0 ;Start Timer 0
BACK: MOV A,P0 ;get data from P0
MOV P1,A ;issue it to P1
SJMP BACK ;keep doing it loop;unless interrupted by TF0
END
Example lu
So
Rewrite above Example to create a square wave that has a high portion of 1085 us and a
low portion of 15 us. Assume XTAL=11.0592MHz. Use timer 1.
Solution:
Since 1085 us is 1000 × 1.085 we need to use mode 1 of timer 1.
;--upon wake-up go to main, avoid using
;memory allocated to Interrupt Vector Table
U

ORG 0000H
LJMP MAIN ;by-pass int. vector table
;--ISR for timer 1 to generate square wave
VT

ORG 001BH ;Timer 1 int. vector table


LJMP ISR_T1 ;jump to ISR
The main program for initialization
ORG 0030H ;after vector table space
MAIN: MOV TMOD,#10H ;Timer 1, mode 1
MOV P0,#0FFH ;make P0 an input port
MOV TL1,#018H ; TL1=18 low byte of -1000

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
MOV TH1,#0FCH ;TH1=FC high byte of -1000
MOV IE,#88H ;10001000 enable Timer 1 int
SETB TR1 ;Start Timer 1
BACK: MOV A,P0 ;get data from P0

n
MOV P1,A ;issue it to P1
SJMP BACK ;keep doing it
;Timer 1 ISR. Must be reloaded, not auto-reload

tio
ISR_T1: CLR TR1 ;stop Timer 1
MOV R2,#4 ; 2MC
CLR P2.1 ;P2.1=0, start of low portion
HERE: DJNZ R2,HERE ;4x2 machine cycle 8MC
MOV TL1,#18H
MOV TH1,#0FCH
SETB TR1 lu
;load T1 low byte value 2MC
;load T1 high byte value 2MC
;starts timer1 1MC
So
SETB P2.1 ;P2.1=1,back to high 1MC
RETI ;return to main
END

Example
Write a program to generate a square wave if 50Hz frequency on pin P1.2. This is similar
U

to Example 9-12 except that it uses an interrupt for timer 0. Assume that XTAL=11.0592
MHz
Solution:
VT

ORG 0
LJMP MAIN
ORG 000BH ;ISR for Timer 0
CPL P1.2
MOV TL0,#00
MOV TH0,#0DCH
RETI

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
ORG 30H
;--------main program for initialization
MAIN:MOV TM0D,#00000001B ;Timer 0, Mode 1
MOV TL0,#00

n
MOV TH0,#0DCH
MOV IE,#82H ;enable Timer 0 interrupt
SETB TR0

tio
HERE:SJMP HERE
END

The 8051 has two external hardware interrupts. Pin 12 (P3.2) and pin 13 (P3.3) of the 8051,

lu
designated as INT0 and INT1, are used as external hardware interrupts. The interrupt vector table
locations 0003H and 0013H are set aside for INT0 and INT1. There are two activation levels for
the external hardware interrupts.
So
1) Level trigged
2) Edge trigged
U
VT

In the level-triggered mode, INT0 and INT1 pins are normally [Link] a low-level signal is

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]
applied to them, it triggers the interrupt. Then the microcontroller stops whatever it is doing and
jumps to the interrupt vector table to service that interrupt. The low-level signal at the INT pin
must be removed before the execution of the last instruction of the ISR, RETI; otherwise,
another interrupt will be generated. This is called a level-triggered or level activated interrupt

n
and is the default mode upon reset of the 8051.

tio
lu
So
U
VT

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator: [Link] [Link]

n
tio
lu
So
U
VT

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
Module No: 05
Interfacing 8051 to LCD
LCD is finding widespread use replacing LEDs for the following reasons:
 The declining prices of LCD
 The ability to display numbers, characters, and graphics

n
 Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of the task
of refreshing the LCD
 Ease of programming for characters and graphics

tio
Interfacing LCD with 8051
The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on data
lines depends on the mode of operation. If operated in 8-bit mode then 8 data lines + 3 control
lines i.e. total 11 lines are required. And if operated in 4-bit mode then 4 data lines + 3 control
lines i.e. 7 lines are required.

lu
So
U
VT

Figure: Interfacing 8051 with LCD

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]

Pin Description:

n
tio
lu
So
LCD timing diagram for reading and writing is as shown in figure
U
VT

Figure : LCD timing for read

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]

n
tio
Figure : LCD timing for write
Sending Data/ Commands to LCDs with Time Delay:

lu
To send any of the commands to the LCD, make pin RS=0. For data, make RS=1. Then send a
high-to-low pulse to the E pin to enable the internal latch of the LCD. This is shown in the code
below. The interfacing diagram of LCD to 8051 is as shown in the figure .
So
Example 11: Write an ALP to initialize the LCD and display message “YES”. Say the command
to be given is :38H (2 lines ,5x7 matrix), 0EH (LCD on, cursor on), 01H (clear LCD), 06H (shift
cursor right), 86H (cursor: line 1, pos. 6)
Program: Calls a time delay before sending next data/command ;P1.0-P1.7 are connected to LCD
data pins D0-D7 ;P2.0 is connected to RS pin of LCD ;P2.1 is connected to R/W pin of LCD
;P2.2 is connected to E pin of LCD
ORG 0H
MOV A,#38H ;INIT. LCD 2 LINES, 5X7 MATRIX
U

ACALL COMNWRT ;call command subroutine


ACALL DELAY ;give LCD some time
MOV A,#0EH ;display on, cursor on
ACALL COMNWRT ;call command subroutine
ACALL DELAY ;give LCD some time
VT

MOV A,#01 ;clear LCD


ACALL COMNWRT ;call command subroutine
ACALL DELAY ;give LCD some time
MOV A,#06H ;shift cursor right
ACALL COMNWRT ;call command subroutine
ACALL DELAY ;give LCD some time
MOV A,#86H ;cursor at line 1, pos. 6
ACALL COMNWRT ;call command subroutine
ACALL DELAY ;give LCD some time
MOV A,#‟Y‟ ;display letter Y

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
ACALL DATAWRT ;call display subroutine
ACALL DELAY ;give LCD some time
MOV A,#‟E‟ ;display letter E
ACALL DATAWRT ;call display subroutine
ACALL DELAY ;give LCD some time
MOV A,#‟S‟ ;display letter S

n
ACALL DATAWRT ;call display subroutine
AGAIN: SJMP AGAIN ;stay here
COMNWRT: ;send command to LCD
MOV P1,A ;copy reg A to port 1

tio
CLR P2.0 ;RS=0 for command
CLR P2.1 ;R/W=0 for write
SETB P2.2 ;E=1 for high pulse
ACALL DELAY ;give LCD some time
CLR P2.2 ;E=0 for H-to-L pulse
RET
DATAWRT:
MOV P1,A
SETB P2.0
CLR P2.1
SETB P2.2 lu
;write data to LCD
;copy reg A to port 1
;RS=1 for data
;R/W=0 for write
;E=1 for high pulse
So
ACALL DELAY ;give LCD some time
CLR P2.2 ;E=0 for H-to-L pulse
RET

DELAY:
MOV R3,#50 ;50 or higher for fast CPUs
HERE2: MOV R4,#255 ;R4 = 255
HERE: DJNZ R4,HERE ;stay until R4 becomes 0
DJNZ R3,HERE2
U

RET
END
Example 12: Modify example 11, to check for the busy flag (D7=>P1.7), then send the command
and hence display message “NO”.
VT

;Check busy flag before sending data, command to LCD;p1=data pin ;P2.0 connected to RS pin
;P2.1 connected to R/W pin ;P2.2 connected to E pin
ORG 0H
MOV A,#38H ;init. LCD 2 lines ,5x7 matrix
ACALL COMMAND ;issue command
MOV A,#0EH ;LCD on, cursor on
ACALL COMMAND ;issue command
MOV A,#01H ;clear LCD command
ACALL COMMAND ;issue command
MOV A,#06H ;shift cursor right

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
ACALL COMMAND issue command
MOV A,#86H ;cursor: line 1, pos. 6
ACALL COMMAND ;command subroutine
MOV A,#‟N‟ ;display letter N
ACALL DATA_DISPLAY
MOV A,#‟O‟ ;display letter O

n
ACALL DATA_DISPLAY
HERE:SJMP HERE ;STAY HERE
COMMAND:
ACALL READY ;is LCD ready?

tio
MOV P1,A ;issue command code
CLR P2.0 ;RS=0 for command
CLR P2.1 ;R/W=0 to write to LCD
SETB P2.2 ;E=1 for H-to-L pulse
CLR P2.2 ;E=0,latch in
RET
DATA_DISPLAY:
ACALL READY
MOV P1,A
SETB P2.0
CLR P2.1
;is LCD ready?
;issue data
;RS=1 for data
;R/W =0 to write to LCD lu
So
SETB P2.2 ;E=1 for H-to-L pulse
CLR P2.2 ;E=0,latch in
RET
READY:
SETB P1.7 ;make P1.7 input port
CLR P2.0 ;RS=0 access command reg
SETB P2.1 ;R/W=1 read command reg ;
BACK:SETB P2.2 ;E=1 for H-to-L pulse
CLR P2.2 ;E=0 H-to-L pulse
U

JB P1.7,BACK ;stay until busy flag=0


RET
END
Sending Data/ Commands to LCDs checking the Busy Flag
VT

Example 13: Write an 8051 C program to send letters „P‟, „I‟, and „C‟ to the LCD using the busy
flag method.
Solution:
#include <reg51.h>
sfr ldata = 0x90; //P1=LCD data pins
sbit rs = P2^0;
sbit rw = P2^1;
sbit en = P2^2;
sbit busy = P1^7;

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
void main()
{
lcdcmd(0x38);
lcdcmd(0x0E);
lcdcmd(0x01);
lcdcmd(0x06);

n
lcdcmd(0x86); //line 1, position 6
lcddata(„P‟);
lcddata(„I‟);
lcddata(„C‟);

tio
}
void lcdcmd(unsigned char value){
lcdready(); //check the LCD busy flag
ldata = value; //put the value on the pins
rs = 0;
rw = 0;

}
en = 1;
MSDelay(1);
en = 0;
return;
lu
//strobe the enable pin
So
void lcddata(unsigned char value){
lcdready(); //check the LCD busy flag
ldata = value; //put the value on the pins
rs = 1;
rw = 0;
en = 1; //strobe the enable pin
MSDelay(1);
en = 0;
return;
U

}
void lcdready(){
busy = 1; //make the busy pin at input
rs = 0;
VT

rw = 1;
while(busy==1){ //wait here for busy flag
en = 0; //strobe the enable pin
MSDelay(1);
en = 1;
}}
void Msdelay(unsigned int itime){
unsigned int i, j;
for(i=0;i<itime;i++)
for(j=0;j<1275;j++);}

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
Keyboard Interfacing:
Keyboards are organized in a matrix of rows and columns. The CPU accesses both rows and
columns through ports. Therefore, with two 8-bit ports, an 8 x 8 matrix of keys can be connected
to a microprocessor. When a key is pressed, a row and a column make a contact. Otherwise,
there is no connection between rows and columns. A 4x4 matrix connected to two ports. The
rows are connected to an output port and the columns are connected to an input port.

n
Scanning and Identifying the Key:

tio
lu
So
Figure : A 4X4 matrix keyboard
It is the function of the microcontroller to scan the keyboard continuously to detect and identify
the key pressed
 To detect a pressed key, the microcontroller grounds all rows by providing 0 to the output
latch, then it reads the columns
 If the data read from columns is D3 – D0 =1111, no key has been pressed and the process
continues till key press is detected
U

 If one of the column bits has a zero, this means that a key press has occurred For example, if
D3 – D0 = 1101, this means that a key in the D1 column has been pressed After detecting a key
press, microcontroller will go through the process of identifying the key
 Starting with the top row, the microcontroller grounds it by providing a low to row D0 only.
VT

It reads the columns, if the data read is all 1s, no key in that row is activated and the process is
moved to the next row
 It grounds the next row, reads the columns, and checks for any zero. This process continues
until the row is identified.
 After identification of the row in which the key has been pressed. Find out which column the
pressed key belongs to.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
Algorithm for detection and identification of key activation goes through the following
stages:
1. To make sure that the preceding key has been released, 0s are output to all rows at once, and
the columns are read and checked repeatedly until all the columns are high
 When all columns are found to be high, the program waits for a short amount of time before
it goes to the next stage of waiting for a key to be pressed

n
2. To see if any key is pressed, the columns are scanned over and over in an infinite loop until
one of them has a 0 on it
 Remember that the output latches connected to rows still have their initial zeros (provided in

tio
stage 1), making them grounded
 After the key press detection, it waits 20 ms for the bounce and then scans the columns again
(a) It ensures that the first key press detection was not an erroneous one due a spike noise
(b) The key press. If after the 20-ms delay the key is still pressed, it goes back into the
loop to detect a real key press
3. To detect which row key press belongs to, it grounds one row at a time, reading the columns
each time

lu
 If it finds that all columns are high, this means that the key press cannot belong to that row.
Therefore, it grounds the next row and continues until it finds the row the key press belongs to
 Upon finding the row that the key press belongs to, it sets up the starting address for the
look-up table holding the scan codes (or ASCII) for that row
4. To identify the key press, it rotates the column bits, one bit at a time, into the carry flag and
So
checks to see if it is low
 Upon finding the zero, it pulls out the ASCII code for that key from the look-up table
 otherwise, it increments the pointer to point to the next element of the look-up table
The flowchart for the above algorithm is as shown below:
U
VT

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]

n
tio
lu
So
U
VT

Note: The assembly as well as the C program can be written in accordance to the algorithm of
the flowchart shown.
Interfacing 8051 to parallel and Serial ADC
Analog-to-digital converter (ADC) interfacing

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
ADCs (analog-to-digital converters) are among the most widely used devices for data
acquisition. A physical quantity, like temperature, pressure, humidity, and velocity, etc., is
converted to electrical (voltage, current) signals using a device called a transducer, or sensor
We need an analog-to-digital converter to translate the analog signals to digital numbers, so
microcontroller can read them.
ADC804 chip:

n
ADC804 IC is an analog-to-digital converter. It works with +5 volts and has a resolution of 8
bits. Conversion time is another major factor in judging an ADC. Conversion time is defined as
the time it takes the ADC to convert the analog input to a digital (binary) number. In ADC804
conversion time varies depending on the clocking signals applied to CLK R and CLK IN pins,

tio
but it cannot be faster than 110μs.

lu
So
U
VT

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
Pin Description of ADC804:

n
tio
Figure: Pin out of ADC0804

lu
CLK IN and CLK R: CLK IN is an input pin connected to an external clock source. To use
the internal clock generator (also called self-clocking), CLK IN and CLK R pins are
connected to a capacitor and a resistor and the clock frequency is determined by:
So
Typical values are R = 10K ohms and C =150pF. We get f = 606 kHz and the conversion
time is 110μs.

 Vref/2 : It is used for the reference voltage. If this pin is open (not connected), the
analog input voltage is in the range of 0 to 5 volts (the same as the Vcc pin). If the analog
U

input range needs to be 0 to 4 volts, Vref/2 is connected to 2 volts. Step size is the
smallest change can be discerned by an ADC Vref/2 Relation to Vin Range
VT

D0-D7: The digital data output pins. These are tri-state buffered. The converted data is accessed
only when CS =0 and RD is forced low. To calculate the output voltage, use the following
formula

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]

Dout = digital data output (in decimal),


Vin = analog voltage, and
step size (resolution) is the smallest change

n
Analog ground and digital ground: Analog ground is connected to the ground of the analog
Vin and digital ground is connected to the ground of the Vcc pin. To isolate the analog Vin
signal from transient voltages caused by digital switching of the output D0 – D7. This

tio
contributes to the accuracy of the digital data output.
Vin(+) & Vin(-): Differential analog inputs where Vin = Vin (+) – Vin (-). Vin (-) is connected
to ground and Vin (+) is used as the analog input to be converted.
RD: Is “output enable” a high-to-low RD pulse is used to get the 8-bit converted data out of
ADC804.
INTR: It is “end of conversion” When the conversion is finished, it goes low to signal the CPU
that the converted data is ready to be picked up.

lu
WR: It is “start conversion” When WR makes a low-to-high transition, ADC804 starts
converting the analog input value of Vin to an 8- bit digital number.
CS: It is an active low input used to activate ADC804.
The following steps must be followed for data conversion by the ADC804 chip:
So
 Make CS= 0 and send a L-to-H pulse to pin WR to start conversion.
 Monitor the INTR pin, if high keep polling but if low, conversion is complete, go to next
step.
 Make CS= 0 and send a H-to-L pulse to pin RD to get the data out
Figure shows the read and write timing for ADC804. Figure 9 and 10 shows the self clocking
with the RC component for frequency and the external frequency connected to XTAL2 of 8051.
U
VT

Figure : Read and Write timing for ADC0804

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]

n
tio
Figure : 8051 Connection to ADC0804 with Self-clocking

lu
So
Figure : 8051 Connection to ADC0804 with Clock from XTAL2 of 8051
Now let us see how we write assembly as well as C program for the interfacing diagram shown
in figure .
U

Programming ADC0804 in assembly


MYDATA EQU P1
MOV P1, #0FFH
SETB P2.7
VT

BACK: CLR P2.6


SETB P2.6
HERE: JB P2.7, HERE
CLR P2.5
MOV A, MYDATA
SETB P2.5
SJMP BACK

Programming ADC0804 in C
#include<reg51.h>

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
Sbit RD=P2^5;
Sbit WR=P2^6;
Sbit INTR=P2^7;
Sfr Mydata=P1;
Void main ( )
{

n
Unsigned char value;
Mydata =0xFF;
INTR=1;
RD=1;

tio
WR=1;
While (1)
{
WR=0;
WR=1;
While (INTR == 1);

}
}
RD=0;
Value =Mydata;
RD=1;
lu
So
ADC0808/0809 chip:
ADC808 has 8 analog inputs. It allows us to monitor up to 8 different transducers using only
single chip. The chip has 8-bit data output just like the ADC804. The 8 analog input channels are
multiplexed and selected according to the values given to the three address pins, A, B, and C.
that is; if CBA=000, CH0 is selected; CBA=011, CH3 is selected and so on. The pin details of
ADC0808 are as shown in the figure below. (Explanation can be done as is with ADC0804).
U
VT

Figure : Pin out of ADC0808


Steps to Program ADC0808/0809
1. Select an analog channel by providing bits to A, B, and C addresses.
2. Activate the ALE pin. It needs an L-to-H pulse to latch in the address.
3. Activate SC (start conversion) by an H-to-L pulse to initiate conversion.
4. Monitor EOC (end of conversion) to see whether conversion is finished.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
5. Activate OE (output enable) to read data out of the ADC chip. An H-to-L pulse to the OE pin
will bring digital data out of the chip.
Let us write an assembly and C program for the interfacing of 8051 to ADC0808
Programming ADC0808/0809 in assembly
MYDATA EQU P1

n
ORG 0000H
MOV MYDATA, #0FFH
SETB P2.7
CLR P2.4

tio
CLR P2.6
CLR P2.5
BACK: CLR P2.0
CLR P2.1
SETB P2.2
ACALL DELAY
SETB P2.4
ACALL DELAY
SETB P2.6
ACALL DELAY
CLR P2.4 lu
So
CLR P2.6
HERE: JB P2.7, HERE
HERE1: JNB P2.7, HERE1
SETB P2.5
ACALL DELAY
MOV A, MYDATA
CLR P2.5
SJMP BACK
Interfacing 8051 to DAC
U

Digital-to-Analog (DAC) converter:


The DAC is a device widely used to convert digital pulses to analog signals. In this section we
will discuss the basics of interfacing a DAC to 8051.
VT

The two method of creating a DAC is binary weighted and R/2R ladder.
The Binary Weighted DAC, which contains one resistor or current source for each bit of the
DAC connected to a summing point. These precise voltages or currents sum to the correct output
value. This is one of the fastest conversion methods but suffers from poor accuracy because of
the high precision required for each individual voltage or current. Such high-precision resistors
and current-sources are expensive, so this type of converter is usually limited to 8-bit resolution
or less.
The R-2R ladder DAC, which is a binary weighted DAC that uses a repeating cascaded structure
of resistor values R and 2R. This improves the precision due to the relative ease of producing

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
equal valued matched resistors (or current sources). However, wide converters perform slowly
due to increasingly large RC-constants for each added R-2R link.
The first criterion for judging a DAC is its resolution, which is a function of the number of
binary inputs. The common ones are 8, 10, and 12 bits. The number of data bit inputs decides the
resolution of the DAC since the number of analog output levels is equal to 2n, where n is the
number of data bit inputs.

n
DAC0808:
The digital inputs are converter to current Iout, and by connecting a resistor to the Iout pin, we can

tio
convert the result to voltage. The total current Iout is a function of the binary numbers at the D0-
D7 inputs of the DAC0808 and the reference current Iref , and is as follows:

Usually reference current is 2mA. Ideally we connect the output pin to a resistor, convert this

lu
current to voltage, and monitor the output on the scope. But this can cause inaccuracy; hence an
opamp is used to convert the output current to voltage. The 8051 connection to DAC0808 is as
shown in the figure below.
So
Figure : 8051 connection to DAC0808
U

Example 9: Write an ALP to generate a triangular waveform.


Program:
MOV A, #00H
INCR: MOV P1, A
INC A
VT

CJNE A, #255, INCR


DECR: MOV P1, A
DEC A
CJNE A, #00, DECR
SJMP INCR
END
Example 10: Write an ALP to generate a sine waveform.
Vout = 5V(1+sinθ)

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
Solution: Calculate the decimal values for every 10 degree of the sine wave. These values can be
maintained in a table and simply the values can be sent to port P1. The sinewave can be observed
on the CRO.
Program:
ORG 0000H
AGAIN:MOV DPTR, #SINETABLE

n
MOV R3, #COUNT
UP:CLR A
MOVC A, @A+DPTR
MOV P1, A

tio
INC DPTR
DJNZ R3, UP
SJMP AGAIN
ORG 0300H
SINETABLE DB 128, 192, 238, 255, 238, 192, 128, 64, 17, 0, 17, 64, 128
END

Sensor interfacing and signal conditioning


lu
Note: to get a better wave regenerate the values of the table per 2 degree.

The sensors of the LM34/LM35 series are precision integrated-circuit temperature sensors whose
output voltage is linearly proportional to the Fahrenheit/Celsius temperature. The LM34/LM35
So
requires no external calibration since it is inherently calibrated. It outputs 10 mV for each degree
of Fahrenheit/Celsius temperature.
Temperature sensors
Transducers convert physical data such as temperature, light intensity, flow, and speed to
electrical signals. Depending on the transducer, the output produced is in the form of voltage,
current, resistance, or capacitance. For example, temperature is converted to electrical signals
using a transducer called a thermistor. A thermistor responds to temperature change by changing
resistance, but its response is not linear.
LM34 and LM35 temperature sensors
U

The sensors of the LM34 series are precision integrated-circuit temperature sensors whose output
voltage is linearly proportional to the Fahrenheit temperature. See Table 13-9. The LM34
requires no external calibration since it is internally calibrated. It outputs 10 mV for each degree
of Fahrenheit temperature. Table 13-9 is a selection guide for the LM34.
VT

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
The LM35 series sensors are precision integrated-circuit temperature sensors whose output
voltage is linearly proportional to the Celsius (centigrade) temperature. The LM35 requires no
external calibration since it is internally calibrated. It outputs 10 mV for each degree of
centigrade temperature.
Signal Conditioning
Signal conditioning is widely used in the world of data acquisition. The most common

n
transducers produce an output in the form of voltage, current, charge, capacitance, and
resistance. However, we need to convert these signals to voltage in order to send input to an A-
to-D converter. This conversion (modification) is commonly called signal conditioning. Signal
conditioning can be a current-to-voltage conversion or a signal amplification. For example, the

tio
thermistor changes resistance with temperature. The change of resistance must be translated into
voltages in order to be of any use to an ADC. Look at the case of connecting an LM35 to an
ADC0848. Since the ADC0848 has 8-bit resolution with a maximum of 256 (28) steps and the
LM35 (or LM34) produces 10 mV for every degree of temperature change, we can condition Vin
of the ADC0848 to produce a Vout of 2560 mV (2.56 V) for full-scale output. Therefore, in order
to produce the full-scale Vout of 2.56 V for the ADC0848, we need to set Vref = 2.56. This makes

lu
Vout of the ADC0848 correspond directly to the temperature as monitored by the LM35.
Figure 13-21 shows the connection of a temperature sensor to the ADC0848.
So
U
VT

Figure. 8051 Connection to ADC0848 and Temperature Sensor

Stepper Motor Interfacing


Stepper motor is a widely used device that translates electrical pulses into mechanical movement.
Stepper motor is used in applications such as; disk drives, dot matrix printer, robotics etc,. The
construction of the motor is as shown in figure 1 below.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]

n
tio
lu
Figure: Structure of stepper motor
It has a permanent magnet rotor called the shaft which is surrounded by a stator. Commonly used
stepper motors have four stator windings that are paired with a center – tapped common. Such
motors are called as four-phase or unipolar stepper motor.
So
The stator is a magnet over which the electric coil is wound. One end of the coil are connected
commonly either to ground or +5V. The other end is provided with a fixed sequence such that
the motor rotates in a particular direction. Stepper motor shaft moves in a fixed repeatable
increment, which allows one to move it to a precise position. Direction of the rotation is dictated
by the stator poles. Stator poles are determined by the current sent through the wire coils.
Step angle:
Step angle is defined as the minimum degree of rotation with a single step.
No of steps per revolution = 360° / step angle
U

Steps per second = (rpm x steps per revolution) / 60


Example: step angle = 2°
No of steps per revolution = 180
VT

Switching Sequence of Motor:


As discussed earlier the coils need to be energized for the rotation. This can be done by sending a
bits sequence to one end of the coil while the other end is commonly connected. The bit
sequence sent can make either one phase ON or two phase ON for a full step sequence or it can
be a combination of one and two phase ON for half step sequence. Both are tabulated below.
Full Step:
Two Phase ON

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]

n
One Phase ON

tio
Half Step (8 – sequence):
lu
So
The sequence is tabulated as below:
U

8051 Connection to Stepper Motor: (explanation of the diagram can be done)


VT

Figure : 8051 interface to stepper motor

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
Example 1: Write an ALP to rotate the stepper motor clockwise / anticlockwise continuously
with full step sequence.
Program:
MOV A,#66H
BACK: MOV P1,A
RR A

n
ACALL DELAY
SJMP BACK
DELAY: MOV R1,#100
UP1: MOV R2,#50

tio
UP: DJNZ R2,UP
DJNZ R1,UP1
RET
Note: motor to rotate in anticlockwise use instruction RL A instead of RR A
Example 2: A switch is connected to pin P2.7. Write an ALP to monitor the status of the SW. If
SW = 0, motor moves clockwise and if SW = 1, motor moves anticlockwise.
Program:
ORG 0000H
SETB P2.7
MOV A, #66H
MOV P1,A lu
So
TURN: JNB P2.7, CW
RL A
ACALL DELAY
MOV P1,A
SJMP TURN
CW: RR A
ACALL DELAY
MOV P1,A
SJMP TURN
U

DELAY: as previous example


Example 4: Rotate the stepper motor continuously clockwise using half-step 8-step sequence.
Say the sequence is in ROM locations.
Program:
VT

ORG 0000H
START: MOV R0, #08
MOV DPTR, #HALFSTEP
RPT: CLR A
MOVC A, @A+DPTR
MOV P1, A
ACALL DELAY
INC DPTR
DJNZ R0, RPT
SJMP START

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
ORG 0200H
HALFSTEP DB 09, 08, 0CH, 04, 06, 02, 03, 01
END
Programming Stepper Motor with 8051 C
The following examples 5 and 6 will show the programming of stepper motor using 8051 C.

n
Example 5: Problem definition is same as example 1.
Program:
#include <reg51.h>

tio
void main ()
{
while (1)
{
P1=0x66;
MSDELAY (200);
P1=0x33;
MSDELAY (200);
P1=0x99;
MSDELAY (200);
P1=0xCC;
MSDELAY (200);
lu
So
}
}
void MSDELAY (unsigned char value)
{
unsigned int x,y;
for(x=0;x<1275;x++)
for(y=0;y<value;y++);
}
U

Example 6: Problem definition is same as example 2.


Program:
#include <reg51.h>
sbit SW=P2^7;
VT

void main ()
{
SW=1;
while (1)
{
if(SW==0){
P1=0x66;
MSDELAY (100);
P1=0x33;
MSDELAY (100);

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
P1=0x99;
MSDELAY (100);
P1=0xCC;
MSDELAY (100);
}
else {

n
P1=0x66;
MSDELAY (100);
P1=0xCC;
MSDELAY (100);

tio
P1=0x99;
MSDELAY (100);
P1=0x33;
MSDELAY (100);
}
void MSDELAY (unsigned char value)
{

}
unsigned int x,y;
for(x=0;x<1275;x++)
for(y=0;y<value;y++);
lu
So
DC Motor Interfacing with 8051:
The DC motor is another widely used device that translates electrical pulses into mechanical
movement. Motor has 2 leads +ve and – ve , connecting them to a DC voltage supply moves the
motor in one direction. On reversing the polarity rotates the motor in the reverse direction. Basic
difference between Stepper and DC motor is stepper motor moves in steps while DC motor
moves continuously. Another difference is with stepper motor the number of steps can be
counted while it is not possible in DC motor. Maximum speed of a DC motor is indicated in rpm.
The rpm is either with no load it is few thousands to tens of thousands or with load rpm
U

decreases with increase in load.


Voltage and current rating : Nominal voltage is the voltage for a motor under normal condition.
It ranges from 1V to 150V. As voltage increases, rpm goes up. Current rating is the current
consumption when the nominal voltage is applied with no load that is 25mA to a few amperes.
As load increases, rpm increases, unless voltage or current increases implies torque increases.
VT

With fixed voltage, as load increases, power consumption of a DC motor is increased.


Unidirectional Control:
Figure 3 shows the rotation of the DC motor in clockwise and anticlockwise direction.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]

n
Figure 3: DC motor rotation
Bidirectional Control:

tio
 Motor not running lu
(b) Clockwise direction
So
U

(c) Counter clockwise direction (d) Invalid state (short circuit)


Figure : H-Bridge Motor Configuration
Figure shows the H-Bridge motor configuration. It consists of four switches and based on the
VT

closing and opening of these switches the motor either rotates in clockwise or anti-clockwise
direction.
As seen in figure 4a, all the switches are open hence the motor is not running. In b, turning of the
motor is in one direction when the switches 1 and 4 are closed that is clockwise direction.
Similarly, in c the switches 2 and 3 are closed so the motor rotates in anticlockwise direction,
while in figure 4d all the switches are closed which indicates a invalid state or a short circuit.
The interfacing diagram of 8051 to bidirectional motor control can be referred to fig 17-18 from
text prescribed.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
Example 6: A switch is connected to pin P2.7. Write an ALP to monitor the status of the SW. If
SW = 0, DC motor moves clockwise and if SW = 1, DC motor moves anticlockwise.
Program:
ORG 0000H
CLR P1.0
CLR P1.1

n
CLR P1.2
CLR P1.3
SETB P2.7
MONITOR: JNB P2.7, CLOCK

tio
SETB P1.0
CLR P1.1
CLR P1.2
SETB P1.3
SJMP MONITOR
CLOCK: CLR P1.0
SETB P1.1
SETB P1.2
CLR P1.3
SJMP MONITOR
END lu
So
U
VT

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
Pulse Width Modulation (PWM)
The speed of the motor depends on 3 parameters: load, voltage and current. For a given load, we
can maintain a steady speed by using PWM. By changing the width of the pulse applied to DC
motor, power provided can either be increased or decreased. Though voltage has fixed
amplitude, has a variable duty cycle. The wider the pulse, higher the speed obtained. One of the
reasons as to why dc motor are referred over ac is, the ability to control the speed of the DC

n
motor using PWM. The speed of the ac motor is dictated by the ac frequency of voltage applied
to the motor and is generally fixed. Hence, speed of the AC motors cannot be controlled when
load is increased.

tio
Figure below shows the pulse width modulation comparison.

Figure : PWM comparison


lu
Example 7 and 8 are the 8051 C version of the programs written earlier.
So
Example 7: A switch is connected to pin P2.7. Write a C to monitor the status of the SW. If SW
= 0, DC motor moves clockwise and if SW = 1, DC motor moves anticlockwise.
Program:
# include <reg51.h>
sbit SW =P2^7;
sbit Enable = P1^0;
sbit MTR_1 = P1^1;
sbit MTR_2 = P1^2;
U

void main ( )
{
SW=1;
Enable = 0;
MTR_1=0;
VT

MTR_2=0;
while( )
{
Enable =1;
if( SW==1)
{ MTR_1=1;
MTR_2=0;
}
else
{ MTR_1=0;

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
MTR_2=1;
}
}
}

n
Example 8: A switch is connected to pin P2.7. Write an C to monitor the status of the SW. If
SW = 0, DC motor moves 50% duty cycle pulse and if SW = 1, DC motor moves with 25% duty
cycle pulse.
Program:

tio
# include <reg51.h>
sbit SW =P2^7;
sbit MTR = P1^0;
void main ( )
{
SW=1;

while( )
{
MTR=0;

if( SW==1)
{ MTR=1;
Msdelay(25); lu
So
MTR=0;
Msdelay(75);
}
else
{ MTR=1;
Msdelay(50);
MTR=0;
Msdelay(50);
}
U

}
}
8051 interfacing with the 8255
The Intel 8255 Programmable Peripheral Interface (PPI) chip, developed and manufactured by
Intel in the first half of the 1970s for the Intel 8080 microprocessor. The 8255 provides 24
VT

parallel input/output lines with a variety of programmable operating modes. The 8255 gives a
CPU or digital system access to programmable parallel I/O. The 8255 has 24 input/output pins.
These are divided into three 8-bit ports (A, B, C). Port A and port B can be used as 8-bit
input/output ports. Port C can be used as an 8-bit input/output port or as two 4-bit input/output
ports or to produce handshake signals for ports A and B.
The three ports are further grouped as follows:
1. Group A consisting of port A and upper part of port C.
2. Group B consisting of port B and lower part of port C.
Eight data lines (D0–D7) are available (with an 8-bit data buffer) to read/write data into the ports
or control register under the status of the RD (pin 5) and WR (pin 36), which are active-low

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
signals for read and write operations respectively. Address lines A1 and A0 allow to access a data
register for each port or a control register.

n
tio
lu
So
Figure: Pin diagram of 8255
U
VT

Figure: Block diagram of 8255

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]
PA0 - PA7 (8-bit port A): Can be programmed as all input or output, or all bits as bidirectional
input/output.
PB0 - PB7 (8-bit port B): Can be programmed as all input or output, but cannot be used as a
bidirectional port.
PC0 – PC7 (8-bit port C): Can be all input or output, can also be split into two parts.
CU (upper bits PC4 - PC7), CL (lower bits PC0 – PC3) each can be used for input or output

n
Any of bits PC0 to PC7 can be programmed individually.
RD and WR: These two active-low control signals are inputs to the 8255. The RD and WR
signals from the 8031/51 are connected to these inputs.
D0 – D7: are connected to the data pins of the microcontroller allowing it to send data back and

tio
forth between the controller and the 8255 chip.
RESET: An active-high signal input. Used to clear the control register. When RESET is
activated, all ports are initialized as input ports.
A0, A1, and CS (chip select): CS is active-low. While CS selects the entire chip, it is A0 and A1
that select specific ports. These 3 pins are used to access port A, B, C or the control register.

lu
So
8While ports A, B and C are used to input or output data, the control register must be
programmed to select operation mode of three ports. The ports of the 8255 can be programmed
U

in any of the following modes:


1. Mode 0, simple I/O: Any of the ports A, B, CL, and CU can be programmed as input out
output. All bits are out or all are in. There is no signal-bit control as in P0-P3 of 8051
2. Mode 1: Port A and B can be used as input or output ports with handshaking capabilities.
VT

Handshaking signals are provided by the bits of port C.


3. Mode 2: Port A can be used as a bidirectional I/O port with handshaking capabilities provided
by port C. Port B can be used either in mode 0 or mode 1.
4. BSR (bit set/reset) mode
Only the individual bits of port C can be Programmed.

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]

n
tio
5
The more commonly used term is I/O. lu
So
Mode 0: Intel calls it the basic input/output mode. In this mode, any ports of A, B, or C can be
programmed as input or output . A given port cannot be both input and output at the same time
The 8255 chip is programmed in any of the 4 modes mentioned earlier by sending a byte (Intel
calls it a control word) to the control register of 8255. We must first find the port address
assigned to each of ports A, B ,C and the control register called mapping the I/O port.
U
VT

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]

n
tio
lu
So
5Example
Find the control word of the 8255 for the following configurations:
(a) All the ports of A, B and C are output ports (mode 0)
(b) PA = in, PB = out, PCL = out, and PCH = out
U

Solution:
From Figure 15-3 we have:
(a) 1000 0000 = 80H (b)1001 0000 = 90H.
Example
For Figure shown below
VT

(a) Find the I/O port addresses assigned to ports A, B, C, and the control register.
(b) Program the 8255 for ports A, B, and C to be output ports.
(c) Write a program to send 55H and AAH to all ports continuously.
Solution
(a) The base address for the 8255 is as follows:

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website
Downloaded from [Link] NOTES | INTERNSHIP | VIDEO LECTURE Like us on FB for regular updates
S J P N Trust's Dept. of E & E
Hirasugar Institute of Technology,Nidasoshi. Notes
Inculcating Values, Promoting Prosperity Microcontroller
Approved by AICTE and Affiliated to VTU Belagavi 2018-19
Course Coordinator:[Link] [Link]

n
(b) The control byte (word) for all ports as output is 80H.

tio
(c)
MOV A,#80H ;control word;(ports output)
MOV DPTR,#4003H ;load control reg; port address
MOVX @DPTR, A ;issue control word
MOV A,#55H ;A = 55H
AGAIN: MOV DPTR,#4000H ;PA address
MOVX @DPTR,A ;toggle PA bits
INC DPTR ;PB address
MOVX @DPTR,A ;toggle PB bits
INC DPTR ;PC address
MOVX @DPTR,A ;toggle PC bits lu
So
CPL A ;toggle bit in reg A
ACALL DELAY ;wait
SJMP AGAIN ;continue.
U
VT

Nidasoshi-591 236, Taq: Hukkeri, Dist: Belagavi, Karnataka, India.


Phone: +91-8333-278887, Fax: 278886, Web: [Link], E-mail: principal@[Link]
Online Chat Support Projects | Technical Seminar Guidance & Support Download our app or visit website

You might also like