Automatic Temprature Report

Published on March 2017 | Categories: Documents | Downloads: 29 | Comments: 0 | Views: 143
of 73
Download PDF   Embed   Report

Comments

Content


PROJECT REPORT
ON
AUTOMATIC TEMPRATURE CONTROLLER
BY
CETPA INFOTECH PRIVATE LIMITED
CONTENTS
1. 8051 Microcontroller Architecture
2. Variant in Atmel 8051 Microcontrollers
3. Features o AT8!c51" AT8!c52 an# AT8!s51
$. Features o %C& 'se#
5. &S1(21 an# its Features
(. )C* %a+out
,. Source Co#e in Assem-l+
8. Com.onent %ist.
!. A..en#i/
10. *i-lio0ra.h+
8051 Microcontrollr
AT8!C511
T! AT8"C51 i# $ lo%&'o%r( !i)!&'r*or+$nc CMO, 8&-it +icroco+'.tr %it! /0
-1t# o* Fl$#! 'ro)r$++$-l $n2 r$#$-l r$2 onl1 ++or1 3PEROM45 T! 26ic
i# +$n.*$ct.r2 .#in) At+l7# !i)!&2n#it1 non6ol$til ++or1 tc!nolo)1 $n2 i#
co+'$ti-l %it! t! in2.#tr1&#t$n2$r2 MC,&51 in#tr.ction #t $n2 'ino.t5 T! on&c!i'
Fl$#! $llo%# t! 'ro)r$+ ++or1 to - r'ro)r$++2 in&#1#t+ or -1 $ con6ntion$l
non6ol$til ++or1 'ro)r$++r5 B1 co+-inin) $ 6r#$til 8&-it CPU %it! Fl$#!
on $ +onolit!ic c!i'( t! At+l AT8"C51 i# $ 'o%r*.l +icroco+'.tr %!ic! 'ro6i2#
$ !i)!l1&*l8i-l $n2 co#t&**cti6 #ol.tion to +$n1 +-222 control $''lic$tion#5
)in Coni0urtion
T! AT8"C51 'ro6i2# t! *ollo%in) #t$n2$r2 *$t.r#9 /0 -1t# o* Fl$#!( 1:8 -1t# o*
RAM( ;: I<O lin#( t%o 1=&-it ti+r<co.ntr#( $ *i6 6ctor t%o&l6l intrr.'t
$rc!itct.r( $ *.ll 2.'l8 #ri$l 'ort( on&c!i' o#cill$tor $n2 cloc> circ.itr15 In $22ition(
t! AT8"C51 i# 2#i)n2 %it! #t$tic lo)ic *or o'r$tion 2o%n to ?ro *[email protected] $n2
#.''ort# t%o #o*t%$r #lct$-l 'o%r #$6in) +o2#5 T! I2l Mo2 #to'# t! CPU
%!il $llo%in) t! RAM( ti+r<co.ntr#( #ri$l 'ort $n2 intrr.'t #1#t+ to contin.
*.nctionin)5 T! Po%r&2o%n Mo2 #$6# t! RAM contnt# -.t *r?# t! o#cill$tor
2i#$-lin) $ll ot!r c!i' *.nction# .ntil t! n8t !$r2%$r r#t5
Pin Description
VCC
,.''l1 6olt$)5
GND
Aro.n25
Port 0
Port 0 i# $n 8&-it o'n&2r$in -i&2irction$l I<O 'ort5 A# $n o.t'.t 'ort( $c! 'in c$n #in>
i)!t TTL in'.t#5 B!n 1# $r %rittn to 'ort 0 'in#( t! 'in# c$n - .#2 $# !i)!
i+'2$nc in'.t#5 Port 0 +$1 $l#o - con*i).r2 to - t! +.lti'l82 lo% or2r
A22r## <2$t$ -.# 2.rin) $cc### to 8trn$l 'ro)r$+ $n2 2$t$ ++or15 In t!i# +o2 P0
!$# intrn$l '.ll .'#5 Port 0 $l#o rci6# t! co2 -1t# 2.rin) Fl$#! 'ro)r$++in)(
$n2 o.t'.t# t! co2 -1t# 2.rin) 'ro)r$+ 6ri*ic$tion5 E8trn$l '.ll .'# $r [email protected]
2.rin) 'ro)r$+ 6ri*ic$tion5
Port 1
Port 1 i# $n 8&-it -i&2irction$l I<O 'ort %it! intrn$l '.ll.'#5 T! Port 1 o.t'.t -.**r#
c$n #in><#o.rc *o.r TTL in'.t#5 B!n 1# $r %rittn to Port 1 'in# t!1 $r '.ll2 !i)!
-1 t! intrn$l '.ll.'# $n2 c$n - .#2 $# in'.t#5 A# in'.t#( Port 1 'in# t!$t $r 8trn$ll1
-in) '.ll2 lo% %ill #o.rc c.rrnt 3IIL4 -c$.# o* t! intrn$l '.ll.'#5 Port 1 $l#o
rci6# t! lo%&or2r $22r## -1t# 2.rin) Fl$#! 'ro)r$++in) $n2 6ri*ic$tion5
Port 2
Port : i# $n 8&-it -i&2irction$l I<O 'ort %it! intrn$l '.ll.'#5 T! Port : o.t'.t -.**r#
c$n #in><#o.rc *o.r TTL in'.t#5 B!n 1# $r %rittn to Port : 'in# t!1 $r '.ll2 !i)!
-1 t! intrn$l '.ll.'# $n2 c$n - .#2 $# in'.t#5 A# in'.t#( Port : 'in# t!$t $r 8trn$ll1
-in) '.ll2 lo% %ill #o.rc c.rrnt 3IIL4 -c$.# o* t! intrn$l '.ll.'#5 Port : +it# t!
!i)!&or2r $22r## -1t 2.rin) *tc!# *ro+ 8trn$l 'ro)r$+ ++or1 $n2 2.rin)
$cc### to 8trn$l 2$t$ ++or1 t!$t .# 1=&-it $22r### 3MOVC D DPTR45 In t!i#
$''lic$tion( it .## #tron) intrn$l '.ll&.'# %!n +ittin) 1#5 D.rin) $cc### to 8trn$l
2$t$ ++or1 t!$t .# 8&-it $22r### 3MOVC D RI4( Port : +it# t! contnt# o* t! P:
,'ci$l F.nction R)i#tr5 Port : $l#o rci6# t! !i)!&or2r $22r## -it# $n2 #o+
control #i)n$l# 2.rin) Fl$#! 'ro)r$++in) $n2 6ri*ic$tion5
Port 3
Port ; i# $n 8&-it -i&2irction$l I<O 'ort %it! intrn$l '.ll.'#5 T! Port ; o.t'.t -.**r#
c$n #in><#o.rc *o.r TTL in'.t#5 B!n 1# $r %rittn to Port ; 'in# t!1 $r '.ll2 !i)!
-1 t! intrn$l '.ll.'# $n2 c$n - .#2 $# in'.t#5 A# in'.t#( Port ; 'in# t!$t $r 8trn$ll1
-in) '.ll2 lo% %ill #o.rc c.rrnt 3IIL4 -c$.# o* t! '.ll.'#5 Port ; $l#o #r6# t!
*.nction# o* 6$rio.# #'ci$l *$t.r# o* t! AT8"C51 $# li#t2 -lo%9 Port ; $l#o rci6#
#o+ control #i)n$l# *or Fl$#! 'ro)r$++in) $n2 6ri*ic$tion5
RST
R#t in'.t5 A !i)! on t!i# 'in *or t%o +$c!in c1cl# %!il t! o#cill$tor i# r.nnin)
r#t# t! 26ic.
ALE/PROG
A22r## L$tc! En$-l o.t'.t '.l# *or l$tc!in) t! lo% -1t o* t! $22r## 2.rin)
$cc### to 8trn$l ++or15 T!i# 'in i# $l#o t! 'ro)r$+ '.l# in'.t 3PROA4 2.rin)
Fl$#! 'ro)r$++in)5 In nor+$l o'r$tion ALE i# +itt2 $t $ con#t$nt r$t o* 1<= t!
o#cill$tor *[email protected]( $n2 +$1 - .#2 *or 8trn$l ti+in) or cloc>in) '.r'o##5 Not(
!o%6r( t!$t on ALE
'.l# i# #>i''2 2.rin) $c! $cc## to 8trn$l D$t$ M+or15 I* 2#ir2( ALE o'r$tion
c$n - 2i#$-l2 -1 #ttin) -it 0 o* ,FR loc$tion 8EH5 Bit! t! -it #t( ALE i# $cti6 onl1
2.rin) $ MOVC or MOVC in#tr.ction5 Ot!r%i#( t! 'in i# %$>l1 '.ll2 !i)!5 ,ttin)
t! ALE&2i#$-l -it !$# no**ct i* t! +icrocontrollr i# in 8trn$l 8c.tion +o2.
PSEN
Pro)r$+ ,tor En$-l i# t! r$2 #tro- to 8trn$l 'ro)r$+ ++or15 B!n t! AT8"C51
i# 8c.tin) co2 *ro+ 8trn$l 'ro)r$+ ++or1( P,EN i# $cti6$t2 t%ic $c! +$c!in
c1cl( 8c't t!$t t%o P,EN $cti6$tion# $r #>i''2 2.rin) $c! $cc## to 8trn$l 2$t$
++or15
EA/VPP
E8trn$l Acc## En$-l5 EA +.#t - #tr$''2 to AND in or2r to n$-l t! 26ic to
*tc! co2 *ro+ 8trn$l 'ro)r$+ ++or1 loc$tion# #t$rtin) $t 0000H .' to FFFFH5
Not( !o%6r( t!$t i* loc> -it 1 i# 'ro)r$++2( EA %ill - intrn$ll1 l$tc!2 on r#t5
EA #!o.l2 - #tr$''2 to VCC *or intrn$l 'ro)r$+ 8c.tion#5 T!i# 'in $l#o rci6# t!
1:&6olt 'ro)r$++in) n$-l 6olt$) 3VPP4 2.rin) Fl$#! 'ro)r$++in)( *or '$rt# t!$t
[email protected] 1:&6olt VPP5
XTAL1
In'.t to t! in6rtin) o#cill$tor $+'li*ir $n2 in'.t to t! intrn$l cloc> o'r$tin) circ.it5
XTAL2
O.t'.t *ro+ t! in6rtin) o#cill$tor $+'li*ir5
Oscillator Caracters!
CTAL1 $n2 CTAL: $r t! in'.t $n2 o.t'.t( r#'cti6l1( o* $n in6rtin) $+'li*ir
%!ic! c$n - con*i).r2 *or .# $# $n on&c!i' o#cill$tor( $# #!o%n in Fi).r 15 Eit!r $
@.$rt? cr1#t$l or cr$+ic r#on$tor +$1 - .#25 To 2ri6 t! 26ic *ro+ $n 8trn$l
cloc> #o.rc( CTAL: #!o.l2 - l*t .nconnct2 %!il CTAL1 i# 2ri6n $# #!o%n in
Fi).r :5 T!r $r no [email protected]+nt# on t! 2.t1 c1cl o* t! 8trn$l cloc> #i)n$l( #inc
t! in'.t to t! intrn$l cloc>in) circ.itr1 i# t!ro.)! $ 2i6i2&-1&t%o *li'&*lo'( -.t
+ini+.+ $n2 +$8i+.+ 6olt$) !i)! $n2 lo% ti+ #'ci*ic$tion# +.#t - o-#r625
"#le $o#e
In i2l +o2( t! CPU '.t# it#l* to #l' %!il $ll t! onc!i' 'ri'!r$l# r+$in $cti65
T! +o2 i# in6o>2 -1 #o*t%$r5 T! contnt o* t! on&c!i' RAM $n2 $ll t! #'ci$l
*.nction# r)i#tr# r+$in .nc!$n)2 2.rin) t!i# +o25 T! i2l +o2 c$n - tr+in$t2
-1 $n1 n$-l2intrr.'t or -1 $ !$r2%$r r#t5 It #!o.l2 - not2 t!$t %!n i2l i#
tr+in$t2 -1 $ !$r2 %$r r#t( t! 26ic nor+$ll1 r#.+# 'ro)r$+ 8c.tion( *ro+
%!r it l*t o**( .' to t%o +$c!in c1cl# -*or t! intrn$l r#t $l)orit!+ t$>#
control5 On&c!i' !$r2%$r in!i-it# $cc## to intrn$l RAM in t!i# 6nt( -.t $cc## to t!
'ort 'in# i# not in!i-it25 To li+in$t t! 'o##i-ilit1 o* $n .n8'ct2 %rit to $ 'ort 'in
%!n I2l i# tr+in$t2 -1 r#t( t! in#tr.ction *ollo%in) t! on t!$t in6o># I2l
#!o.l2 not - on t!$t %rit# to $ 'ort 'in or to 8trn$l ++or15
Pro%ra&&in% te 'las
T! AT8"C51 i# nor+$ll1 #!i''2 %it! t! on&c!i' Fl$#! ++or1 $rr$1 in t! r$#2
#t$t 3t!$t i#( contnt# E FFH4 $n2 r$21 to - 'ro)r$++25 T! 'ro)r$++in) intr*$c
$cc't# it!r $ !i)!&6olt$) 31:&6olt4 or $ lo%&6olt$) 3VCC4 'ro)r$+ n$-l #i)n$l5
T! lo%&6olt$) 'ro)r$++in) +o2 'ro6i2# $ con6nint %$1 to 'ro)r$+ t!
AT8"C51 in#i2 t! .#r7# #1#t+( %!il t! !i)!&6olt$) 'ro)r$++in) +o2 i#
co+'$ti-l %it! con6ntion$l t!ir2 '$rt1 Fl$#! or EPROM 'ro)r$++r#5 T! AT8"C51
i# #!i''2 %it! it!r t! !i)!&6olt$) or lo%&6olt$) 'ro)r$++in) +o2 n$-l25
T! AT8"C51 co2 ++or1 $rr$1 i# 'ro)r$++2 -1t&-1-1t in it!r 'ro)r$++in)
+o25 To 'ro)r$+ $n1 non-l$n> -1t in t! on&c!i' Fl$#! M+or1( t! ntir ++or1
+.#t - r$#2 .#in) t! C!i' Er$# Mo25
Pro%ra&&in% Al%orit&!
B*or 'ro)r$++in) t! AT8"C51( t! $22r##( 2$t$ $n2 control #i)n$l# #!o.l2 - #t .'
$ccor2in) to t! Fl$#! 'ro)r$++in) +o2 t$-l5 To 'ro)r$+ t! AT8"C51( t$> t!
*ollo%in) #t'#5
15 In'.t t! 2#ir2 ++or1 loc$tion on t! $22r## lin#5
:5 In'.t t! $''ro'ri$t 2$t$ -1t on t! 2$t$ lin#5
;5 Acti6$t t! corrct co+-in$tion o* control #i)n$l#5
/5 R$i# EA<VPP to 1:V *or t! !i)!&6olt$) 'ro)r$++in) +o25
55 P.l# ALE<PROA onc to 'ro)r$+ $ -1t in t! Fl$#! $rr$1 or t! loc> -it#5 T! -1t&
%rit c1cl i# #l*&ti+2 $n2 t1'ic$ll1 t$># no +or t!$n 155 +#5
R'$t #t'# 1 t!ro.)! 5( c!$n)in) t! $22r## $n2 2$t$ *or t! ntir $rr$1 or .ntil t!
n2 o* t! o-Fct *il i# r$c!25
Data Pollin%! T! AT8"C51 *$t.r# D$t$ Pollin) to in2ic$t t! n2 o* $ %rit c1cl5
D.rin) $ %rit c1cl( $n $tt+'t2 r$2 o* t! l$#t -1t %rittn %ill r#.lt in t!
co+'l+nt o* t! %rittn 2$t.+ on PO5G5 Onc t! %rit c1cl !$# -n co+'lt2( tr.
2$t$ $r 6$li2 on $ll o.t'.t#( $n2 t! n8t c1cl +$1 -)in5 D$t$ Pollin) +$1 -)in $n1
ti+ $*tr $ %rit c1cl !$# -n initi$t25
Rea#(/)*s(! T! 'ro)r## o* -1t 'ro)r$++in) c$n $l#o - +onitor2 -1 t! RDY<B,Y
o.t'.t #i)n$l5 P;5/ i# '.ll2 lo% $*tr ALE )o# !i)! 2.rin) 'ro)r$++in) to in2ic$t
BU,Y5 P;5/ i# '.ll2 !i)! $)$in %!n 'ro)r$++in) i# 2on to in2ic$t READY5
Pro%ra& Veri+(9 I* loc> -it# LB1 $n2 LB: !$6 not -n 'ro)r$++2( t! 'ro)r$++2
co2 2$t$ c$n - r$2 -$c> 6i$ t! $22r## $n2 2$t$ lin# *or 6ri*ic$tion5 T! loc> -it#
c$nnot - 6ri*i2 2irctl15 Vri*ic$tion o* t! loc> -it# i# $c!i62 -1 o-#r6in) t!$t t!ir
*$t.r# $r n$-l25
Cip Erase9 T! ntir Fl$#! $rr$1 i# r$#2 lctric$ll1 -1 .#in) t! 'ro'r co+-in$tion
o* control #i)n$l# $n2 -1 !ol2in) ALE<PROA lo% *or 10 +#5 T! co2 $rr$1 i# %rittn
%it! $ll H1I#5 T! c!i' r$# o'r$tion +.#t - 8c.t2 -*or t! co2 ++or1 c$n -
r&'ro)r$++25
Rea#in% te Si%nat*re )(tes! T! #i)n$t.r -1t# $r r$2 -1 t! #$+ 'roc2.r $# $
nor+$l 6ri*ic$tion o* loc$tion# 0;0H( 0;1H( $n2 0;:H( 8c't t!$t P;5= $n2 P;5G +.#t
- '.ll2 to $ lo)ic lo%5 T! 6$l.# rt.rn2 $r $# *ollo%#5
30;0H4 E 1EH in2ic$t# +$n.*$ct.r2 -1 At+l
30;1H4 E 51H in2ic$t# 8"C51
30;:H4 E FFH in2ic$t# 1:V 'ro)r$++in)
30;:H4 E 05H in2ic$t# 5V 'ro)r$++in)
)ro0rammin0 the AT8!C51
AT8"C5:9
Features
2 Com.ati-le 3ith MCS4515 )ro#ucts
2 86 *+tes o 7n4S+stem 8e.ro0ramma-le Flash Memor+
2 En#urance1 1"000 9rite:Erase C+cles
2 Full+ Static O.eration1 0 ;< to 2$ M;<
2 Three4le=el )ro0ram Memor+ %oc>
2 25( / 84-it 7nternal 8AM
2 32 )ro0ramma-le 7:O %ines
2 Three 1(4-it Timer:Counters
2 Ei0ht 7nterru.t Sources
2 )ro0ramma-le Serial Channel
2 %o34.o3er 7#le an# )o3er4#o3n Mo#es
Description
T! AT8"C5: i# $ lo%&'o%r( !i)!&'r*or+$nc CMO, 8&-it +icroco+'.tr %it! 80
-1t# o* Fl$#! 'ro)r$++$-l $n2 r$#$-l r$2 onl1 ++or1 3PEROM45 T! 26ic i#
+$n.*$ct.r2 .#in) At+l7# !i)!&2n#it1 non6ol$til ++or1 tc!nolo)1 $n2 i#
co+'$ti-l %it! t! in2.#tr1&#t$n2$r2 80C51 $n2 80C5: in#tr.ction #t $n2 'in o.t5 T!
on&c!i' Fl$#! $llo%# t! 'ro)r$+ ++or1 to - r'ro)r$++2 in&#1#t+ or -1 $
con6ntion$l non6ol$til ++or1 'ro)r$++r5 B1 co+-inin) $ 6r#$til 8&-it CPU %it!
Fl$#! on $ +onolit!ic c!i'( t! At+l AT8"C5: i# $ 'o%r*.l +icroco+'.tr %!ic!
'ro6i2# $ !i)!l1&*l8i-l $n2 co#t&**cti6 #ol.tion to +$n1 +-222 control
$''lic$tion#5
Pin Dia%ra&!
Te AT,-C.2 pro/i#es te +ollo0in% stan#ar# +eat*res!
80 -1t# o* Fl$#!( :5= -1t# o* RAM( ;: I<O lin#( t!r 1=&-it ti+r<co.ntr#( $ #i8&
6ctor t%o&l6l intrr.'t $rc!itct.r( $ *.ll&2.'l8 #ri$l 'ort( on&c!i' o#cill$tor( $n2
cloc> circ.itr15 In $22ition( t! AT8"C5: i# 2#i)n2 %it! #t$tic lo)ic *or o'r$tion 2o%n
to ?ro *[email protected] $n2 #.''ort# t%o #o*t%$r #lct$-l 'o%r #$6in) +o2#5 T! I2l
Mo2 #to'# t! CPU %!il $llo%in) t! RAM( ti+r<co.ntr#( #ri$l 'ort( $n2 intrr.'t
#1#t+ to contin. *.nctionin)5 T! Po%r&2o%n +o2 #$6# t! RAM contnt# -.t
*r?# t! o#cill$tor( 2i#$-lin) $ll ot!r c!i' *.nction# .ntil t! n8t !$r2%$r r#t5
Special '*nction Re%isters
A +$' o* t! on&c!i' ++or1 $r$ c$ll2 t! ,'ci$l F.nction R)i#tr 3,FR4 #'$c5
Not t!$t not $ll o* t! $22r### $r occ.'i2( $n2 .nocc.'i2 $22r### +$1 not -
i+'l+nt2 on t! c!i'5 R$2 $cc### to t!# $22r### %ill in )nr$l rt.rn r$n2o+
2$t$( $n2 %rit $cc### %ill !$6 $n in2tr+in$t **ct5 U#r #o*t%$r #!o.l2 not %rit
1# to t!# .nli#t2 loc$tion#( #inc t!1 +$1 - .#2 in *.t.r 'ro2.ct# to in6o>5
Data $e&or(
T! AT8"C5: i+'l+nt# :5= -1t# o* on&c!i' RAM5 T! .''r 1:8 -1t# occ.'1 $
'$r$lll $22r## #'$c to t! ,'ci$l F.nction R)i#tr#5 T!$t +$n# t! .''r 1:8 -1t#
!$6 t! #$+ $22r### $# t! ,FR #'$c -.t $r '!1#ic$ll1 #'$r$t *ro+ ,FR #'$c5
B!n $n in#tr.ction $cc### $n intrn$l loc$tion $-o6 $22r## GFH( t! $22r## +o2
.#2 in t! in#tr.ction #'ci*i# %!t!r t! CPU $cc### t! .''r 1:8 -1t# o* RAM
or t! ,FR #'$c5 In#tr.ction# t!$t .# 2irct $22r##in) $cc## ,FR #'$c5 n% *$t.r#5
In t!$t c$#( t! r#t or in$cti6 6$l.# o* t! n% -it# %ill $l%$1# - 05
Ti&er 2 Re%isters
Control $n2 #t$t.# -it# $r cont$in2 in r)i#tr# T:CON $n2 *or Ti+r :5 T! r)i#tr
'$ir 3RCAP:H( RCAP:L4 $r t! C$'t.r<Rlo$2 r)i#tr# *or Ti+r : in 1=&-it c$'t.r
+o2 or 1=&-it $.to&rlo$2 +o25
"nterr*pt Re%isters
T! in2i6i2.$l intrr.'t n$-l -it# $r in t! IE r)i#tr5 T%o 'rioriti# c$n - #t *or
$c! o* t! #i8 intrr.'t #o.rc# in t! IP r)i#tr5r5 #'ci*i# %!t!r t! CPU $cc###
t! .''r 1:8 -1t# o* RAM or t! ,FR #'$c5 In#tr.ction# t!$t .# 2irct $22r##in)
$cc## ,FR #'$c5 For 8$+'l( t! *ollo%in) 2irct $22r##in) in#tr.ction $cc### t!
,FR $t loc$tion 0A0H 3%!ic! i# P:45 In#tr.ction# t!$t .# in2irct $22r##in) $cc## t!
.''r 1:8 -1t# o* RAM5 For 8$+'l( t! *ollo%in) in2irct $22r##in) in#tr.ction(
%!r R0 cont$in# 0A0H( $cc### t! 2$t$ -1t $t $22r## 0A0H( r$t!r t!$n P: 3%!o#
$22r## i# 0A0H45
MOV DR0( J2$t$
Not t!$t #t$c> o'r$tion# $r 8$+'l# o* in2irct $22r##in)( #o t! .''r 1:8 -1t# o*
2$t$ RAM $r $6$il$-l $# #t$c> #'$c5
Ti&er 0 an# 1
Ti+r 0 $n2 Ti+r 1 in t! AT8"C5: o'r$t t! #$+ %$1 $# Ti+r 0 $n2 Ti+r 1 in t!
AT8"C515
Ti&er 2
Ti+r : i# $ 1=&-it Ti+r<Co.ntr t!$t c$n o'r$t $# it!r $ ti+r or $n 6nt co.ntr5
T! t1' o* o'r$tion i# #lct2 -1 -it C<T: in t! ,FR T:CON5 Ti+r : !$# t!r
o'r$tin) +o2#9 c$'t.r( $.to&rlo$2 3.' or 2o%n co.ntin)4( $n2 -$.2 r$t )nr$tor5
T! +o2# $r #lct2 -1 -it# in T:CON5 Ti+r : con#i#t# o* t%o 8&-it r)i#tr#( TH:
$n2 TL:5 In t! Ti+r *.nction( t! TL: r)i#tr i# incr+nt2 6r1 +$c!in c1cl5
,inc $ +$c!in c1cl con#i#t# o* 1: o#cill$tor 'rio2#( t! co.nt r$t i# 1<1: o* t!
o#cill$tor *[email protected] In t! Co.ntr *.nction( t! r)i#tr i# incr+nt2 in r#'on# to $
1&to&0 tr$n#ition $t it# corr#'on2in) 8trn$l in'.t 'in( T:5 In t!i# *.nction( t! 8trn$l
in'.t i# #$+'l2 2.rin) ,5P: o* 6r1 +$c!in c1cl5 B!n t! #$+'l# #!o% $ !i)! in
on c1cl $n2 $ lo% in t! n8t c1cl( t! co.nt i# incr+nt25 T! n% co.nt 6$l.
$''$r# in t! r)i#tr 2.rin) ,;P1 o* t! c1cl *ollo%in) t! on in %!ic! t! tr$n#ition
%$# 2tct25 ,inc t%o +$c!in c1cl# 3:/ o#cill$tor 'rio2#4 $r [email protected] to rco)ni? $
1&to&0 tr$n#ition( t! +$8i+.+ co.nt r$t i# 1<:/ o* t! o#cill$tor *[email protected] To n#.r
t!$t $ )i6n l6l i# #$+'l2 $t l$#t onc -*or it c!$n)#( t! l6l #!o.l2 - !l2 *or
$t l$#t on *.ll +$c!in c1cl5
Capt*re $o#e
In t! c$'t.r +o2( t%o o'tion# $r #lct2 -1 -it ECEN: in T:CON5 I* ECEN: E 0(
Ti+r : i# $ 1=&-it ti+r or co.ntr %!ic! .'on o6r*lo% #t# -it TF: in T:CON5 T!i# -it
c$n t!n - .#2 to )nr$t $n intrr.'t5 I* ECEN: E 1( Ti+r : 'r*or+# t! #$+
o'r$tion( -.t $ 1& to&0 tr$n#ition $t 8trn$l in'.t T:EC $l#o c$.## t! c.rrnt 6$l. in
TH: $n2 TL: to - c$'t.r2 into CAP:H $n2 RCAP:L( r#'cti6l15 In $22ition( t!
tr$n#ition $t T:EC c$.## -it ECF: in T:CON to - #t5 T! ECF: -it( li> TF:( c$n
)nr$t $n intrr.'t5
A*to1reloa# 23p or Do0n Co*nter4
Ti+r : c$n - 'ro)r$++2 to co.nt .' or 2o%n %!n con*i).r2 in it# 1=&-it $.to&
rlo$2 +o25 T!i# *$t.r i# in6o>2 -1 t! DCEN 3Do%n Co.ntr En$-l4 -it loc$t2 in
t! ,FR T:MOD5 U'on r#t( t! DCEN -it i# #t to 0 #o t!$t ti+r : %ill 2*$.lt to
co.nt .'5 B!n DCEN i# #t( Ti+r : c$n co.nt .' or 2o%n( 2'n2in) on t! 6$l. o*
t! T:EC 'in5
"nterr*pts
T! AT8"C5: !$# $ tot$l o* #i8 intrr.'t 6ctor#9 t%o 8trn$l intrr.'t# 3INT0 $n2
INT14( t!r ti+r intrr.'t# 3Ti+r# 0( 1( $n2 :4( $n2 t! #ri$l 'ort intrr.'t5 E$c! o*
t!# intrr.'t #o.rc# c$n - in2i6i2.$ll1 n$-l2 or 2i#$-l2 -1 #ttin) or cl$rin) $ -it
in ,'ci$l F.nction R)i#tr IE5 IE $l#o cont$in# $ )lo-$l 2i#$-l -it( EA( %!ic! 2i#$-l#
$ll intrr.'t# $t onc5 Not t!$t -it 'o#ition IE5= i# .ni+'l+nt25 In t! AT8"C51( -it
'o#ition IE55 i# $l#o .ni+'l+nt25 U#r #o*t%$r #!o.l2 not %rit 1# to t!# -it
'o#ition#( #inc t!1 +$1 - .#2 in *.t.r AT8" 'ro2.ct#5 Ti+r : intrr.'t i# )nr$t2
-1 t! lo)ic$l OR o* -it# TF: $n2 ECF: in r)i#tr T:CON5 Nit!r o* t!# *l$)# i#
cl$r2 -1 !$r2%$r %!n t! #r6ic ro.tin i# 6ctor2 to5 In *$ct( t! #r6ic ro.tin
+$1 !$6 to 2tr+in %!t!r it %$# TF: or ECF: t!$t )nr$t2 t! intrr.'t( $n2 t!$t
-it %ill !$6 to - cl$r2 in #o*t%$r5 T! Ti+r 0 $n2 Ti+r 1 *l$)#( TF0 $n2 TF1( $r
#t $t ,5P: o* t! c1cl in %!ic! t! ti+r# o6r*lo%5 T! 6$l.# $r t!n 'oll2 -1 t!
circ.itr1 in t! n8t c1cl5 Ho%6r( t! Ti+r : *l$)( TF:( i# #t $t ,:P: $n2 i# 'oll2 in
t! #$+ c1cl in %!ic! t! ti+r o6r*lo%#5
AT,-S.1!
T! AT8"L,51 i# $ lo%&6olt$)( !i)!&'r*or+$nc CMO, 8&-it +icrocontrollr %it! /0
-1t# o* in&#1#t+ 'ro)r$++$-l Fl$#! ++or15 T! 26ic i# +$n.*$ct.r2 .#in)
At+l7# !i)!&2n#it1 non6ol$til ++or1 tc!nolo)1 $n2 i# co+'$ti-l %it! t!
in2.#tr1&#t$n2$r2 80C51 in#tr.ction #t $n2 'in o.t5 T! on&c!i' Fl$#! $llo%# t!
'ro)r$+ ++or1 to - r'ro)r$++2 in&#1#t+ or -1 $ con6ntion$l non6ol$til
++or1 'ro)r$++r5 B1 co+-inin) $ 6r#$til 8&-it CPU %it! in&#1#t+ 'ro)r$++$-l
Fl$#! on $ +onolit!ic c!i'( t! At+l AT8"L,51 i# $ 'o%r*.l +icrocontrollr %!ic!
'ro6i2# $ !i)!l1&*l8i-l $n2 co#t&**cti6 #ol.tion to +$n1 +-222 control
$''lic$tion#5 T! AT8"L,51 'ro6i2# t! *ollo%in) #t$n2$r2 *$t.r#9 /0 -1t# o* Fl$#!(
1:8 -1t# o* RAM( ;: I<O lin#( B$tc!2o) ti+r( t%o 2$t$ 'ointr#( t%o 1=&-it
ti+r<co.ntr#( $ *i6&6ctor t%o&l6l intrr.'t $rc!itct.r( $ *.ll 2.'l8 #ri$l 'ort( on&
c!i' o#cill$tor( $n2 cloc> circ.itr15 In $22ition( t! AT8"L,51 i# 2#i)n2 %it! #t$tic
lo)ic *or o'r$tion 2o%n to ?ro *[email protected] $n2 #.''ort# t%o #o*t%$r #lct$-l 'o%r
#$6in) +o2#5 T! I2l Mo2 #to'# t! CPU %!il $llo%in) t! RAM( ti+r<co.ntr#(
#ri$l 'ort( $n2 intrr.'t #1#t+ to contin. *.nctionin)5 T! Po%r&2o%n +o2 #$6#
t! RAM contnt# -.t *r?# t! o#cill$tor( 2i#$-lin) $ll ot!r c!i' *.nction# .ntil t!
n8t 8trn$l intrr.'t or !$r2%$r r#t5 R#t $ll *.nction o* t!i# At+l ,ri#
Microcontrollr i# #$+ $# it# ot!r ++-r#5
Architecture Features:
• ,1)it CP3 Opti&i5e# +or Control Applications
• E6tensi/e )oolean Processin% Capa7ilities 2Sin%le1)it Lo%ic4
• On1Cip 'las Pro%ra& $e&or(
• On1Cip Data RA$
• )i#irectional an# "n#i/i#*all( A##ressa7le "/O Lines
• $*ltiple 181)it Ti&er/Co*nters
• '*ll D*ple6 3ART
• $*ltiple So*rce/Vector/Priorit( "nterr*pt Str*ct*re
• On1Cip Cloc9 Oscillator
• On1cip EEPRO$ 2AT,-S series4
• SP" Serial )*s "nter+ace 2AT,-S Series4
• :atc#o% Ti&er 2AT,-S Series4
$e&or( Or%ani5ation
Lo%ical Separation o+ Pro%ra& Data $e&or(
All At+l Fl$#! +icrocontrollr# !$6 #'$r$t $22r## #'$c# *or 'ro)r$+ $n2 2$t$
++or15 T! lo)ic$l #'$r$tion o* 'ro)r$+ $n2 2$t$ ++or1 $llo%# t! 2$t$ ++or1 to
- $cc##2 -1 8&-it $22r###( %!ic! c$n - +or @.ic>l1 #tor2 $n2 +$ni'.l$t2 -1 $n
8& -it CPU5 N6rt!l##( 1=&-it 2$t$ ++or1 $22r### c$n $l#o - )nr$t2 t!ro.)!
t! DPTR r)i#tr5 Pro)r$+ ++or1 c$n onl1 - r$25 T!r c$n - .' to =/0 -1t# o*
2irctl1 $22r##$-l 'ro)r$+ ++or15 T! r$2 #tro- *or 8trn$l 'ro)r$+ ++or1 i#
t! Pro)r$+ ,tor En$-l #i)n$l 3P,EN45 D$t$ ++or1 occ.'i# $ #'$r$t $22r## #'$c
*ro+ 'ro)r$+ ++or15 U' to =/0 -1t# o* 8trn$l ++or1 c$n - 2irctl1 $22r##2 in
t! 8trn$l 2$t$ ++or1 #'$c5 T! CPU )nr$t# r$2 $n2 %rit #i)n$l#( RD $n2 BR(
2.rin) 8trn$l 2$t$ ++or1 $cc###5 E8trn$l 'ro)r$+ ++or1 $n2 8trn$l 2$t$
++or1 c$n - co+-in2 -1 $''l1in) t! RD $n2 P,EN #i)n$l# to t! in'.t o* $n AND
)$t $n2 .#in) t! o.t'.t o* t! )$t $# t! r$2 #tro- to t! 8trn$l 'ro)r$+<2$t$
++or15
Pro%ra& $e&or(
A*tr r#t( t! CPU -)in# 8c.tion *ro+ loc$tion 0000H5 $c! intrr.'t i# $##i)n2 $
*i82loc$tion in 'ro)r$+ ++or15 T! intrr.'t c$.## t! CPU to F.+' to t!$t loc$tion(
%!r it 8c.t# t! #r6ic ro.tin5 E8trn$l Intrr.'t 0( *or 8$+'l( i# $##i)n2 to
loc$tion 000;H5 I* E8trn$l Intrr.'t 0 i# .#2( it# #r6ic ro.tin +.#t -)in $t loc$tion
000;H5 I* t! intrr.'t i# not .#2( it# #r6ic loc$tion i# $6$il$-l $# )nr$l '.r'o#
'ro)r$+ ++or15 T! intrr.'t #r6ic loc$tion# $r #'$c2 $t 8&-1t intr6$l#9
000;H *or E8trn$l Intrr.'t 0( 000BH *or Ti+r 0(
001;H *or E8trn$l Intrr.'t 1( 001BH *or Ti+r 1( $n2 #o on5 I* $n intrr.'t #r6ic
ro.tin i# #!ort no.)! 3$# i# o*tn t! c$# in control $''lic$tion#4( it c$n r#i2 ntirl1
%it!in t!$t 8&-1t intr6$l5 Lon)r #r6ic ro.tin# c$n .# $ F.+' in#tr.ction to #>i'
o6r #.-#@.nt intrr.'t loc$tion#( i* ot!r intrr.'t# $r in .#5 T! lo%#t $22r### o*
'ro)r$+ ++or1 c$n - it!r in t! on&c!i' Fl$#! or in $n 8trn$l ++or15 To +$>
t!i# #lction( #tr$' t! E8trn$l Acc## 3EA4 'in to it!r VCC or AND5 For 8$+'l( in
t! AT8"C51 %it! /0 -1t# o* on&c!i' Fl$#!( i* t! EA 'in i# #tr$''2 to VCC( 'ro)r$+
*tc!# to $22r### 0000H t!ro.)! 0FFFH $r 2irct2 to t! intrn$l Fl$#!5 Pro)r$+
*tc!# to $22r### 1000H t!ro.)! FFFFH $r 2irct2 to 8trn$l ++or15 In t!
AT8"C5: 380 -1t# Fl$#!4( EA E VCC #lct# $22r### 0000H t!ro.)! 1FFFH to -
intrn$l $n2 $22r### :000H t!ro.)! FFFFH to - 8trn$l5 I* t! EA 'in i# #tr$''2 to
AND( $ll 'ro)r$+ *tc!# $r 2irct2 to 8trn$l ++or15 T! r$2 #tro- to 8trn$l
++or1( P,EN( i# .#2 *or $ll 8trn$l 'ro)r$+ *tc!#5 Intrn$l 'ro)r$+ *tc!# 2o not
$cti6$t P,EN5 T! !$r2%$r con*i).r$tion *or 8trn$l 'ro)r$+ 8c.tion5 Not t!$t 1=
I<O lin# 3Port# 0 $n2 :4 $r 22ic$t2 to -.# *.nction# 2.rin) 8trn$l 'ro)r$+ ++or1
*tc!#5 Port 0 #r6# $# $ +.lti'l82 $22r##<2$t$ -.#5 It +it# t! lo% -1t o* t!
Pro)r$+ Co.ntr 3PCL4 $# $n $22r## $n2 t!n )o# into $ *lo$t #t$t %!il %$itin) *or
t! $rri6$l o* t! co2 -1t *ro+ t! 'ro)r$+ ++or15 D.rin) t! ti+ t!$t t! lo% -1t
o* t! Pro)r$+ Co.ntr i# 6$li2 on P0( t! #i)n$l ALE 3A22r## L$tc! En$-l4 cloc># t!i#
-1t into $n $22r## l$tc!5 M$n%!il( Port : +it# t! !i)! -1t o* t! Pro)r$+ Co.ntr
3PCH45 T!n P,EN #tro-# t! 8trn$l ++or1( $n2 t! +icrocontrollr r$2# t! co2
-1t5
Pro%ra& $e&or(
Pro)r$+ ++or1 $22r### $r $l%$1# 1= -it# %i2( 6n t!o.)! t! $ct.$l $+o.nt o*
'ro)r$+ ++or1 .#2 +$1 - l## t!$n =/0 -1t#5 E8trn$l 'ro)r$+ 8c.tion #$cri*ic#
t%o o* t! 8&-it 'ort#( P0 $n2 P:( to t! *.nction o* $22r##in) t! 'ro)r$+ ++or15
Data $e&or(
T! ri)!t !$l* o* t! intrn$l $n2 8trn$l 2$t$ ++or1 #'$c# $6$il$-l on At+l7# Fl$#!
+icrocontrollr#5 H$r2%$r con*i).r$tion *or $cc##in) .' to :0 -1t# o* 8trn$l RAM5
In t!i# c$#( t! CPU 8c.t# *ro+ intrn$l Fl$#!5 Port 0 #r6# $# $ +.lti'l82
$22r##<2$t$ -.# to t! RAM( $n2 ; lin# o* Port : $r .#2 to '$) t! RAM5 T! CPU
)nr$t# RD $n2 BR #i)n$l# $# n22 2.rin) 8trn$l RAM $cc###5 Yo. c$n $##i)n
.' to =/0 -1t# o* 8trn$l 2$t$ ++or15 E8trn$l 2$t$ ++or1 $22r### c$n - it!r 1
or : -1t# %i25 On&-1t $22r### $r o*tn .#2 in conF.nction %it! on or +or ot!r
I<O lin# to '$) t! RAM5 T%o&-1t $22r### c$n $l#o - .#2( in %!ic! c$# t! !i)!
$22r## -1t i# +itt2 $t Port :5
Intrn$l 2$t$ ++or1 $22r### $r $l%$1# 1 -1t %i2( %!ic! i+'li# $n $22r## #'$c
o* onl1 :5= -1t#5 Ho%6r( t! $22r##in) +o2# *or intrn$l RAM c$n in *$ct
$cco++o2$t ;8/ -1t#5 Dirct $22r### !i)!r t!$n GFH $cc## on ++or1 #'$c $n2
in2irct $22r### !i)!r t!$n GFH $cc## $ 2i**rnt ++or1 #'$c5 T!.#( t! U''r 1:8
$n2 ,FR #'$c occ.'1in) t! #$+ -loc> o* $22r###( 80H t!ro.)! FFH( $lt!o.)! t!1
$r '!1#ic$ll1 #'$r$t ntiti#5 T! lo%#t ;: -1t# $r )ro.'2 into / -$n># o* 8
r)i#tr#5 Pro)r$+ in#tr.ction# c$ll o.t t!# r)i#tr# $# R0 t!ro.)! RG5 T%o -it# in t!
Pro)r$+ ,t$t.# Bor2 3P,B4 #lct %!ic! r)i#tr -$n> i# in .#5 T!i# $rc!itct.r $llo%#
+or **icint .# o* co2 #'$c( #inc r)i#tr in#tr.ction# $r #!ortr t!$n in#tr.ction#
t!$t .# 2irct $22r##in)5
Pro%ra&&in% Stat*s :or#!
Te "nstr*ction Set
All ++-r# o* t! At+l +icrocontrollr *$+il1 8c.t t! #$+ in#tr.ction #t5 T!i#
in#tr.ction #t i# o'ti+i?2 *or 8& -it control $''lic$tion# $n2 it 'ro6i2# $ 6$rit1 o* *$#t
$22r##in) +o2# *or $cc##in) t! intrn$l RAM to *$cilit$t -1t o'r$tion# on #+$ll
2$t$ #tr.ct.r#5 T! in#tr.ction #t 'ro6i2# 8tn#i6 #.''ort *or 1&-it 6$ri$-l# $# $
#'$r$t 2$t$ t1'( $llo%in) 2irct -it +$ni'.l$tion in control $n2 lo)ic #1#t+# t!$t
[email protected] Bool$n 'roc##in)5 T! *ollo%in) o6r6i% o* t! in#tr.ction #t )i6# $ -ri*
2#cri'tion o* !o% crt$in in#tr.ction# c$n - .#25
Pro%ra& Stat*s :or#
T! Pro)r$+ ,t$t.# Bor2 3P,B4 cont$in# #t$t.# -it# t!$t r*lct t! c.rrnt #t$t o* t!
CPU5 T! P,B( #!o%n in Fi).r 11( r#i2# in ,FR #'$c5 T! P,B cont$in# t! C$rr1
-it( t! A.8ili$r1 C$rr1 3*or BCD o'r$tion#4( t! t%or)i#tr -$n> #lct -it#( t!
O6r*lo% *l$)( $ P$rit1 -it( $n2 t%o .#r&2*in$-l #t$t.# *l$)#5 T! C$rr1 -it( in $22ition
to #r6in) $# $ C$rr1 -it in $rit!+tic o'r$tion#( $l#o #r6# $# t! HAcc.+.l$torI *or $
n.+-r o* Bool$n o'r$tion#5
T! -it# R,0 $n2 R,1 #lct on o* t! *o.r r)i#tr -$n># #!o%n in Fi).r 85 A n.+-r
o* in#tr.ction# r*r to t!# RAM loc$tion# $# R0 t!ro.)! RG5 T! #t$t.# o* t! R,0 $n2
R,1 -it# $t 8c.tion ti+ 2tr+in# %!ic! o* t! *o.r -$n># i# #lct25 T! P$rit1 -it
r*lct# t! n.+-r o* 1# in t! Acc.+.l$tor9 PE1 i* t! Acc.+.l$tor cont$in# $n o22
n.+-r o* 1#( $n2 PE0 i* t! Acc.+.l$tor cont$in# $n 6n n.+-r o* 1#5 T!.#( t!
n.+-r o* 1# in t! Acc.+.l$tor 'l.# P i# $l%$1# 6n5 T%o -it# in t! P,B $r
.nco++itt2 $n2 c$n - .#2 $# )nr$l '.r'o# #t$t.# *l$)#5
A##ressin% $o#es
T! $22r##in) +o2# in t! Fl$#! +icrocontrollr in#tr.ction #t $r $# *ollo%#5
Direct A##ressin%
In 2irct $22r##in)( t! o'r$n2 i# #'ci*i2 -1 $n 8&-it $22r## *il2 in t! in#tr.ction5
Onl1 intrn$l 2$t$ RAM $n2 ,FR# c$n - 2irctl1 $22r##25
"n#irect A##ressin%
In in2irct $22r##in)( t! in#tr.ction #'ci*i# $ r)i#tr t!$t cont$in# t! $22r## o* t!
o'r$n25 Bot! intrn$l $n2 8trn$l RAM c$n - in2irctl1 $22r##25 T! $22r##
r)i#tr *or 8&-it $22r### c$n - it!r t! ,t$c> Pointr or R0 or R1 o* t! #lct2
r)i#tr -$n>5 T! $22r## r)i#tr *or 1=&-it $22r### c$n - onl1 t! 1=&-it 2$t$ 'ointr
r)i#tr( DPTR5
Re%ister "nstr*ctions
T! r)i#tr -$n>#( %!ic! cont$in r)i#tr# R0 t!ro.)! RG( c$n - $cc##2 -1
in#tr.ction# %!o# o'co2# c$rr1 $ ;& -it r)i#tr #'ci*ic$tion5 In#tr.ction# t!$t $cc##
t! r)i#tr# t!i# %$1 +$> **icint .# o* co2( #inc t!i# +o2 li+in$t# $n $22r##
-1t5 B!n t! in#tr.ction i# 8c.t2( on o* t! i)!t r)i#tr# in t! #lct2 -$n> i#
$cc##25 On o* *o.r -$n># i# #lct2 $t 8c.tion ti+ -1 t! t%o -$n> #lct -it# in
t! P,B5
Re%ister1Speci+ic "nstr*ctions
,o+ in#tr.ction# $r #'ci*ic to $ crt$in r)i#tr5 For 8$+'l( #o+ in#tr.ction# $l%$1#
o'r$t on t! Acc.+.l$tor( #o no $22r## -1t i# n22 to 'oint to it5 In t!# c$##( t!
o'co2 it#l* 'oint# to t! corrct r)i#tr5 In#tr.ction# t!$t r*r to t! Acc.+.l$tor $# A
$##+-l $# Acc.+.l$tor&#'ci*ic o'co2#5
"n#e6e# A##ressin%
Pro)r$+ ++or1 c$n onl1 - $cc##2 6i$ in282 $22r##in)5 T!i# $22r##in) +o2 i#
intn22 *or r$2in) loo>&.' t$-l# in 'ro)r$+ ++or15 A 1=&-it -$# r)i#tr 3it!r
DPTR or t! Pro)r$+ Co.ntr4 'oint# to t! -$# o* t! t$-l( $n2 t! Acc.+.l$tor i# #t
.' %it! t! t$-l ntr1 n.+-r5 T! $22r## o* t! t$-l ntr1 in 'ro)r$+ ++or1 i#
*or+2 -1 $22in) t! Acc.+.l$tor 2$t$ to t! -$# 'ointr5 Anot!r t1' o* in282
$22r##in) i# .#2 in t! Hc$# F.+'I in#tr.ction5 In t!i# c$# t! 2#tin$tion $22r## o* $
F.+' in#tr.ction i# co+'.t2 $# t! #.+ o* t! -$# 'ointr $n2 t! Acc.+.l$tor 2$t$5
LCD 2L";3"D CR<STAL D"SPLA<4
Liquid Crystal Display Fundamentals
[email protected] Cr1#t$l Di#'l$1# 3LCD#4 $r c$t)ori?2 $# non +i##i6 2i#'l$1 26ic#( in t!$t
r#'ct( t!1 2o not 'ro2.c $n1 *or+ o* li)!t li> $ C$t!o2 R$1 T.- 3CRT45 LCD#
it!r '$## or -loc> li)!t t!$t i# r*lct2 *ro+ $n 8trn$l li)!t #o.rc or 'ro6i22 -1 $
-$c><#i2 li)!tin) #1#t+5 T!r $r t%o +o2# o* o'r$tion *or LCD# 2.rin) t! $-#nc
o* $n lctric *il2 3$''li2 Po%r4K $ +o2 2#cri-# t! tr$n#+itt$nc #t$t o* t! [email protected]
cr1#t$l l+nt#5 Nor+$l B!it +o29 t! 2i#'l$1 i# %!it or cl$r $n2 $llo%# li)!t to
'$## t!ro.)! $n2 Nor+$l Bl$c> Mo29 t! 2i#'l$1 i# 2$r> $n2 $ll li)!t i# 2i**.#25
Virt.$ll1 $ll 2i#'l$1# in 'ro2.ction *or PC<Bor>#t$tion .# $r nor+$l %!it +o2 to
o'ti+i? contr$#t $n2 #'25
A #i+'li*i2 2#cri'tion o* !o% $ 2ot +$tri8 LCD 2i#'l$1 %or># i# $# *ollo%#9 A t%i#t2
n+$tic 3TN4 LC 2i#'l$1 con#i#t# o* t%o 'ol$ri?r( t%o 'ic# o* )l$##( #o+ *or+ o*
#%itc!in) l+nt or lctro2 to 2*in 'i8l#( $n2 2ri6r Int)r$t2 Circ.it# 3IC#4 to
$22r## t! ro%# $n2 col.+n# o* 'i8l#5 To 2*in $ 'i8l 3or #.- 'i8l l+nt *or $
color 2i#'l$14( $ rct$n)l i# con#tr.ct2 o.t o* In2i.+ Tin O8i2 && $ #+i&tr$n#'$rnt
+t$l o8i2 3ITO4 $n2 c!$r) i# $''li2 to t!i# $r$ in or2r to c!$n) t! orint$tion o*
t! LC +$tri$l 3 c!$n) *ro+ $ %!it 'i8l to $ 2$r> 'i8l45 T! +t!o2 .tili?2 to *or+
$ 'i8l in '$##i6 $n2 $cti6 +$tri8 2i#'l$1# 2i**r# $n2 %ill - 2#cri-2 in l$tr
#ction#5 Fi).r 1 ill.#tr$t# $ cro## #ction$l 6i% o* $ #i+'l TN LC 2i#'l$15 Fi).r :
2'ict# $ 2ot +$tri8 2i#'l$1 $# 6i%2 %it!o.t it# +t$l +o2.l<c$# 8'o#in) t! IC
2ri6r#5
Loo>in) 2irctl1 $t t! 2i#'l$1 t! )$t or ro% 2ri6r# $r loc$t2 it!r on t! l*t or t!
ri)!t #i2 o* t! 2i#'l$1 %!il t! 2$t$ or col.+n 2ri6r# $r loc$t2 on t! to' 3$n2 or
-otto+4 o* t! 2i#'l$15 N% t!in 2i#'l$1 +o2.l tc!nolo)1 +o.nt# t! IC# on
con2.cti6 t$' t!$t $llo%# t!+ to - *ol22 -!in2 t! 2i#'l$1 *.rt!r r2.cin) t! #i?
o* t! *ini#!2 +o2.l5 An IC %ill $22r## $ n.+-r o* ro%# or col.+n#5
Fi).r 19 Cro## ,ction o* $ ,i+'l LC Di#'l$1
viewer
///////////////////////////////////// Polarizer
_____________________________________ glass
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Liquid Crystal
_____________________________________ glass
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Polarizer
Backlight
Fi).r :9 LCD '$nl $n2 IC 2ri6r loc$tion#
________________________________________
| |
| IC IC | Source/Colu! ICs
| | |
| | |
|IC"""""""""""""""""""""Pi#el |
| |
|IC $"""" %ate Li!e/&ow IC |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L An IC 2ri6r %ill $22r## $ n.+-r o* ro%<col.+n lin# $n2 not F.#t t! #in)l 'i8l in
t! 2i$)r$+ $-o6
Pol$ri?r# $r $n int)r$l '$rt o* $ LCD 2i#'l$1( 'o####in) t! .ni@. 'ro'rt1 o* onl1
'$##in) li)!t i* it i# orint2 in $ #'ci*ic 3orint24 2irction5 To .tili? t!i# '!no+non
in TN LC 2i#'l$1#( t! -otto+ 'ol$ri?r orint# inco+in) li)!t in on 2irction5 T!
orint2 li)!t '$### t!ro.)! t! LC +$tri$l $n2 i# it!r .n$ltr2 or M-ntM "0 2)r#5
D'n2in) on t! orint$tion o* t! to' 'ol$ri?r( t!i# li)!t %ill it!r '$## t!ro.)! or -
2i**.#25 I* t! li)!t i# 2i**.#2( it %ill $''$r $# $ 2$r> $r$5 Fi).r ; i# $ #i+'l
ill.#tr$tion o* t! #@.nc o* 6nt# t!$t occ.r %!n li)!t '$### t!ro.)! $ #i+'l
t%i#t2 n+$tic LC 2i#'l$15
%i?ui# Cr+stal Material1
T! [email protected] cr1#t$l# .#2 *or 2i#'l$1 tc!nolo)1 $r t!r+otro'ic [email protected] cr1#t$l#K t!1
8!i-it 2#ir2 c!$r$ctri#tic# o6r $ #'ci*ic t+'r$t.r r$n)5 T!i# i# t! 'ri+$r1
r$#on %!1 LCD# 2o not o'r$t 'ro'rl1 %!n t!1 $r too col2 or too %$r+5 I* [email protected]
cr1#t$l# $r too col2( t!1 %ill not t%i#t $n2 t! 2i#'l$1 %ill not *or+ $n i+$)5 I* t!
2i#'l$1 i# too %$r+( t! r#i#t$nc o* t! [email protected] cr1#t$l +$tri$l c!$n)# $n2 t!i# $ltr#
t! 'ro'rti# o* t! 2i#'l$1 $n2 'r*or+$nc #.**r#5 [email protected] cr1#t$l +$tri$l *or 2i#'l$1
.# i# nor+$ll1 r*rr2 to $# TN 3,TN( D,TN( M,TN( $n2 tc54 or T%i#t2 N+$tic&&
#o+ti+# >no%n $# TNFE or T%i#t2 N+$tic Fil2 E**ct5 It i# c$ll2 TBI,TED #inc
t! cr1#t$l# $r t%i#t2 "0 2)r# 3or +or *or ,TN4 *ro+ t! to' 'ic o* )l$## to t!
-otto+ 'ic o* )l$##5 3TN .#.$ll1 r*r# onl1 to $ "0 2)r t%i#t54 Fil2 E**ct 3$ 2irct
corrl$tion i# t! #+icon2.ctor MO,FET4( r*r# to t! LC +$tri$lN# $-ilit1 to $li)n
'$r$lll or 'r'n2ic.l$r to $n $''li2 lctric *il25 A# $ r#.lt( .#in) t%i#t2 or
.nt%i#t2 [email protected] cr1#t$l $n2 t%o 'ol$ri?r#K $n $''li2 lctric *il2 c$n *orc t! LC
+$tri$l into $ '$rtic.l$r $li)n+nt **cti6l1 2i**.#in) or '$##in) li)!t t!ro.)! t! to'
'ol$ri?r5
A# $ not o* intr#t( 'ol$ri?r# $r $l#o on o* t! +$For r$#on# t!$t LC 2i#'l$1# [email protected]
-ri)!t -$c> li)!tin)5 T! 'ol$ri?r# $n2 [email protected] cr1#t$l +$tri$l# $-#or- +or t!$n 50O o*
t! inci2nt li)!t5 A# $ r#.lt( 6n t!o.)! t! $ct.$l 2i#'l$1 i# $ 6r1 lo% 'o%r 26ic(
t! 'o%r !.n)r1 -$c> li)!tin) +$># $ LCD +o2.l on o* t! 'ri+$r1 c$.## o* #!ort
-$ttr1 li* in not-oo> co+'.tr#5 D. to t! *$ct t!$t t! LC +$tri$l !$# o'tic$l
'ro'rti# $n2 **cti6l1 -n2# li)!t( t! 'ro-l+ o* 6i%in) $n)l **ct# occ.r5 B!n
t! .#r i# not 2irctl1 in *ront o* t! 2i#'l$1 t! i+$) c$n 2i#$''$r or #+ to in6rt
32$r> i+$)# -co+ li)!t $n2 li)!t i+$)# -co+ 2$r>45 Ho%6r( LC +$tri$l $n2
'ol$ri?r tc!nolo)1 i# r$'i2l1 i+'ro6in) $n2 t!$t i+'ro6+nt i# #!o%in) .' in -ri)!tr
2i#'l$1# %it! )r$tr 6i%in) $n)l#5
%i?ui# Cr+stal Ali0nment
[email protected] cr1#t$l# +.#t - $li)n2 to t! to' $n2 -otto+ 'ic# o* )l$## in or2r to o-t$in
t! 2#ir2 t%i#t5 In ot!r %or2#( t! "0 2)r t%i#t i# *or+2 -1 $nc!orin) t! [email protected]
cr1#t$l on on )l$## 'l$t $n2 *orcin) it to t%i#t $cro## t! cll )$' 3t! 2i#t$nc -t%n
t! t%o )l$## 'l$t#4 %!n cont$ctin) t! #con2 'l$t5 F.rt!r+or( T! $ct.$l i+$)
@.$lit1 o* t! 2i#'l$1 %ill - 2'n2nt on t! #.r*$c $li)n+nt o* t! LC +$tri$l5 T!
+t!o2 c.rrntl1 .#2 *or $li)nin) [email protected] cr1#t$l# %$# 26lo'2 -1 t! D$i&Ni''on
,crnin) 3En)li#!E Bi) J$'$n ,crnin)4 Co+'$n15 T! 'roc## con#i#t# o* co$tin) t!
to' $n2 -otto+ #!t# o* )l$## %it! $ Pol1i+i2 -$#2 *il+5 T! to' 'ic o* )l$## i#
co$t2 $n2 r.--2 in $ '$rtic.l$r orint$tionK t! -otto+ '$nl<'ol1i+i2 i# r.--2
'r'n2ic.l$r 3"0 2)r# *or TN 2i#'l$1#4 %it! r#'ct to t! to' '$nl5 It %$#
2i#co6r2 t!$t -1 r.--in) t! 'ol1i+i2 %it! $ clot!( n$no+tr 31 C 10 & " +tr#4 #i?
)roo6# $r *or+2 $n2 t! [email protected] cr1#t$l# $li)n %it! t! 2irction o* t! )roo6#5 It i#
co++on t!$t %!n $##+-lin) $ TN LC cll( it %ill - nc##$r1 to li+in$t '$tc!# o*
non .ni*or+ $r$#5 T! t%o '$r$+tr# [email protected] to li+in$t t! non .ni*or+iti# $n2
co+'lt t! TN LC 2i#'l$1 $r 'rtilt $n)l $n2 c!ol#tric i+'.riti#5 TN LC cll#
co++onl1 !$6 t%o 'ro-l+# t!$t $**ct .ni*or+it1 *ollo%in) $##+-l19 r6r# tilt $n2
r6r# t%i#t5 R6r# tilt i# $ *.nction o* t! $''li2 lctric$l *il2 $n2 r6r# t%i#t i#
co++on %!n no lctric$l *il2 i# $''li25 R6r# t%i#t i# li+in$t2 -1 t!
intro2.ction o* c!ol#tric $22iti6# $n2 r6r# tilt i# li+in$t2 -1 intro2.cin) $ 'r&tilt
$n)l to t! LC +$tri$l5 T! 'r&tilt $n)l $l#o 2tr+in# %!$t 2irction t! LC
+olc.l# %ill rot$t %!n $n lctric$l *il2 i# $''li25 Pr&tilt $n)l c$n - 6i#.$li?2
-1 con#i2rin) t! nor+$l 'o#ition o* t! LC +olc.l to - *l$t $)$in#t t! )l$## 'l$t(
-1 $nc!orin) on 2) $n2 *orcin) t! ot!r .'%$r2 -1 $ #'ci*ic n.+-r o* 2)r#( $
'rtilt $n)l i# #t$-li#!25
DS1621 (Digital herm!meter and herm!stat"
'EAT3RES
P T+'r$t.r +$#.r+nt# [email protected] no 8trn$l co+'onnt#
P M$#.r# t+'r$t.r# *ro+ Q55RC to S1:5RC in 055RC incr+nt#5 F$!rn!it
@.i6$lnt i# Q=GRF to :5GRF in 05"RF incr+nt#
P T+'r$t.r i# r$2 $# $ "Q-it 6$l. 3t%o -1t tr$n#*r4
P Bi2 'o%r #.''l1 r$n) 3:5GV to 555V4
P Con6rt# t+'r$t.r to 2i)it$l %or2 in 1 #con2
P T!r+o#t$tic #ttin)# $r .#r 2*in$-l $n2 non6ol$til
P D$t$ i# r$2 *ro+<%rittn 6i$ $ :Q%ir #ri$l intr*$c 3o'n 2r$in I<O lin#4
P A''lic$tion# incl.2 t!r+o#t$tic control#( in2.#tri$l #1#t+#( con#.+r 'ro2.ct#(
t!r+o+tr#( or $n1 t!r+$l #n#iti6 #1#t+5
P 8Q'in DIP or ,OIC '$c>$) 3150 MIL $n2 :08 MIL4
P"N D"SCR"PT"ON!
,DA Q :QBir ,ri$l D$t$ In'.t<O.t'.t
,CL Q :QBir ,ri$l Cloc>
AND Q Aro.n2
TOUT Q T!r+o#t$t O.t'.t ,i)n$l
A0 Q C!i' A22r## In'.t
A1 Q C!i' A22r## In'.t
A: Q C!i' A22r## In'.t
VDD Q Po%r ,.''l1 Volt$)
9or> Function1
T! D,1=:1 2i)it$l t!r+o+tr $n2 t!r+o#t$t 'ro6i2# "Q-it t+'r$t.r r$2in)#
%!ic! in2ic$t t! t+'r$t.r o* t! 26ic5 T! t!r+$l $l$r+ o.t'.t( TOUT( i# $cti6
%!n t! t+'r$t.r o* t! 26ic 8c2# $ .#rQ2*in2 t+'r$t.r TH5 T! o.t'.t
r+$in# $cti6 .ntil t! t+'r$t.r 2ro'# -lo% .#r 2*in2 t+'r$t.r TL( $llo%in)
*or $n1 !1#tr#i# nc##$r15 U#r 2*in2 t+'r$t.r #ttin)# $r #tor2 in nonQ 6ol$til
++or1( #o '$rt# +$1 - 'ro)r$++2 'rior to in#rtion in $ #1#t+5 T+'r$t.r
#ttin)#( $n2 t+'r$t.r r$2in)# $r $ll co++.nic$t2 to<*ro+ t! D,1=:1 o6r $
#i+'l :Q%ir #ri$l intr*$c5
Operation o+ De/ice DS1821!
A -loc> 2i$)r$+ o* t! D,1=:1 i# #!o%n in Fi).r $-o65T! D,1=:1 +$#.r#
t+'r$t.r# t!ro.)! t! .# o* $n onQ-o$r2 'ro'rit$r1 t+'r$t.r +$#.r+nt
[email protected] T! D,1=:1 +$#.r# t+'r$t.r -1 co.ntin) t! n.+-r o* cloc> c1cl#
t!$t $n o#cill$tor %it! $ lo% t+'r$t.r co**icint )o# t!ro.)! 2.rin) $ )$t 'rio2
2tr+in2 -1 $ !i)! t+'r$t.r co**icint o#cill$tor5 T! co.ntr i# 'r#t %it! $ -$#
co.nt t!$t corr#'on2# to Q55RC5 I* t! co.ntr r$c!# ?ro -*or t! )$t 'rio2 i#
o6r( t! t+'r$t.r r)i#tr( %!ic! i# $l#o 'r#t to t! Q55RC 6$l.( i# incr+nt2(
in2ic$tin) t!$t t! t+'r$t.r i# !i)!r t!$n Q55RC5 At t! #$+ ti+( t! co.ntr i# t!n
'r#t %it! $ 6$l. 2tr+in2 -1 t! #lo' $cc.+.l$tor circ.itr15 T!i# circ.itr1 i#
n22 to co+'n#$t *or t! '$r$-olic -!$6ior o* t! o#cill$tor# o6r t+'r$t.r5 T!
co.ntr i# t!n cloc>2 $)$in .ntil it r$c!# ?ro5 I* t! )$t 'rio2 i# #till not *ini#!2(
t!n t!i# 'roc## r'$t#5 T! #lo' $cc.+.l$tor i# .#2 to co+'n#$t *or t! nonlin$r
-!$6ior o* t! o#cill$tor# o6r t+'r$t.r( 1il2in) $ !i)! r#ol.tion t+'r$t.r
+$#.r+nt5 T!i# i# 2on -1 c!$n)in) t! n.+-r o* co.nt# nc##$r1 *or t! co.ntr to
)o t!ro.)! *or $c! incr+nt$l 2)r in t+'r$t.r5 To o-t$in t! 2#ir2 r#ol.tion(
t!r*or( -ot! t! 6$l. o* t! co.ntr $n2 t! n.+-r o* co.nt# 'r RC 3t! 6$l. o* t!
#lo' $cc.+.l$tor4 $t $ )i6n t+'r$t.r +.#t - >no%n5 T!i# c$lc.l$tion i# 2on in#i2
t! D,1=:1 to 'ro6i2 055RC r#ol.tion5 T! t+'r$t.r r$2in) i# 'ro6i22 in $ "Q-it(
t%o7# co+'l+nt r$2in) -1 i##.in) t! READ TEMPERATURE co++$n25 T! 2$t$ i#
tr$n#+itt2 t!ro.)! t! :Q%ir #ri$l intr*$c( M,B *ir#t5 T! D,1=:1 c$n +$#.r
t+'r$t.r o6r t! r$n) o* Q55RC to S1:5RC in 055RC incr+nt#5 For F$!rn!it
.#$)( $ loo>.' t$-l or con6r#ion *$ctor +.#t - .#25
,inc 2$t$ i# tr$n#+itt2 o6r t! :Q%ir -.# M,B *ir#t( t+'r$t.r 2$t$ +$1 - %rittn
to<r$2 *ro+ t! D,1=:1 $# it!r $ #in)l -1t 3%it! t+'r$t.r r#ol.tion o* 1RC4( or
$# t%o -1t#( t! #con2 -1t cont$inin) t! 6$l. o* t! l$#t #i)ni*ic$nt 3055RC4-it o* t!
t+'r$t.r r$2in)( $# #!o%n in T$-l $-o65 Not t!$t t! r+$inin) G -it# o* t!i# -1t
$r #t to $ll 07#5 Not t!$t t+'r$t.r i# r'r#nt2 in t! D,1=:1 in tr+# o* $ 1<:RC
L,B( 1il2in) t! *ollo%in) "Q-it *or+$t9
Hi)!r r#ol.tion# +$1 - o-t$in2 -1 r$2in) t! t+'r$t.r( $n2 tr.nc$tin) t! 055RC
-it 3t! L,B4 *ro+ t! r$2 6$l.5 T!i# 6$l. i# TEMPTREAD5 T! 6$l. l*t in t!
co.ntr +$1 t!n - r$2 -1 i##.in) $ READ COUNTER co++$n25 T!i# 6$l. i# t!
co.nt r+$inin) 3COUNTTREMAIN4 $*tr t! )$t 'rio2 !$# c$#25 B1 lo$2in) t!
6$l. o* t! #lo' $cc.+.l$tor into t! co.nt r)i#tr 3.#in) t! READ ,LOPE
co++$n24( t!i# 6$l. +$1 t!n - r$2( 1il2in) t! n.+-r o* co.nt# 'r 2)r C
3COUNTTPERTC4 $t t!$t t+'r$t.r5 T! $ct.$l t+'r$t.r +$1 - t!n - c$lc.l$t2
-1 t! .#r .#in) t! *ollo%in)9
Ter&ostat Control!
In it# o'r$tin) +o2( t! D,1=:1 *.nction# $# $ t!r+o#t$t %it! 'ro)r$++$-l
!1#tr#i#5 T! t!r+o#t$t o.t'.t .'2$t# $# #oon $# $ t+'r$t.r con6r#ion i#
co+'lt5 B!n t! D,1=:17# t+'r$t.r +t# or 8c2# t! 6$l. #tor2 in t! !i)!
t+'r$t.r tri' r)i#tr 3TH4( t! o.t'.t -co+# $cti6( $n2 %ill #t$1 $cti6 .ntil t!
t+'r$t.r *$ll# -lo% t! t+'r$t.r #tor2 in t! lo% t+'r$t.r tri))r r)i#tr
3TL45 In t!i# %$1( $n1 $+o.nt o* !1#tr#i# +$1 - o-t$in25 T! $cti6 #t$t *or t!
o.t'.t i# 'ro)r$++$-l -1 t! .#r( #o t!$t $n $cti6 #t$t +$1 it!r - $ lo)ic 1 3VDD4
or $ lo)ic 0 30V45
&ata Transer1
T! D,1=:1 #.''ort# $ -iQ2irction$l t%oQ%ir -.# $n2 2$t$ tr$n#+i##ion 'rotocol5 A
26ic t!$t #n2# 2$t$ onto t! -.# i# 2*in2 $# $ tr$n#+ittr( $n2 $ 26ic rci6in) 2$t$
$# $ rci6r5 T! 26ic t!$t control# t! +##$) i# c$ll2 $ H+$#trI5 T! 26ic# t!$t
$r controll2 -1 t! +$#tr $r H#l$6#I5 T! -.# +.#t - controll2 -1 $ +$#tr 26ic
%!ic! )nr$t# t! #ri$l cloc> 3,CL4( control# t! -.# $cc##( $n2 )nr$t# t! ,TART
$n 2 ,TOP con2ition#5 T! D,1=:1 o'r$t# $# $ #l$6 on t! t%oQ%ir -.#5 Connction#
to t! -.# $r +$2 6i$ t! o'nQ2r$in I<O lin# ,DA $n2 ,CL5 T! *ollo%in) -.#
'rotocol !$# -n 2*in25
P D$t$ tr$n#*r +$1 - initi$t2 onl1 %!n t! -.# i# not -.#15
P D.rin) 2$t$ tr$n#*r( t! 2$t$ lin +.#t r+$in #t$-l %!n6r t! cloc> lin i# HIAH5
C!$n)# in t! 2$t$ lin %!il t! cloc> lin i# !i)! %ill - intr'rt2 $# control #i)n$l#5
Accor2in)l1( t! *ollo%in) -.# con2ition# !$6 -n 2*in29
*us not -us+1 Bot! 2$t$ $n2 cloc> lin# r+$in HIAH5
Start #ata transer1 A c!$n) in t! #t$t o* t! 2$t$ lin( *ro+ HIAH to LOB( %!il t!
cloc> i# HIAH( 2*in# $ ,TART con2ition5
Sto. #ata transer1 A c!$n) in t! #t$t o* t! 2$t$ lin( *ro+ LOB to HIAH( %!il t!
cloc> lin i# HIAH( 2*in# t! ,TOP con2ition5
&ata =ali#1 T! #t$t o* t! 2$t$ lin r'r#nt# 6$li2 2$t$ %!n( $*tr $ ,TART
con2ition( t! 2$t$ lin i# #t$-l *or t! 2.r$tion o* t! HIAH 'rio2 o* t! cloc> #i)n$l5
T! 2$t$ on t! lin +.#t - c!$n)2 2.rin) t! LOB 'rio2 o* t! cloc> #i)n$l5 T!r i#
on cloc> '.l# 'r -it o* 2$t$5 E$c! 2$t$ tr$n#*r i# initi$t2 %it! $ ,TART con2ition
$n2 tr+in$t2 %it! $ ,TOP con2ition T! n.+-r o* 2$t$ -1t# tr$n#*rr2 -t%n
,TART $n2 ,TOP con2ition# i# not li+it2( $n2 i# 2tr+in2 -1 t! +$#tr 26ic5 T!
in*or+$tion i# tr$n#*rr2 -1tQ%i# $n2 $c! rci6r $c>no%l2)# %it! $ nint!Q-it5
Bit!in t! -.# #'ci*ic$tion# $ r).l$r +o2 3100 0H? cloc> r$t4 $n2 $ *$#t +o2 3/00
0H? cloc> r$t4 $r 2*in25 T! D,1=:1 %or># in -ot! +o2#5
Ac>no3le#0e1 E$c! rci6in) 26ic( %!n $22r##2( i# o-li)2 to )nr$t $n
$c>no%l2) $*tr t! rc'tion o* $c! -1t5
&ata Transmission in &S1(21 is sho3n -elo31
Co&&an# Set Ta7le!
NOTES1
15 In contin.o.# con6r#ion +o2( $ ,to' Con6rt T co++$n2 %ill !$lt contin.o.#
con6r#ion5 To r#t$rt( t! ,t$rt Con6rt T co++$n2 +.#t - i##.25 In onQ#!ot +o2( $
,t$rt Con6rt T co++$n2 +.#t - i##.2 *or 6r1 t+'r$t.r r$2in) 2#ir25
:5 Britin) to t! E: t1'ic$ll1 [email protected]# 10+# $t roo+ t+'r$t.r5 A*tr i##.in) $ %rit
co++$n2( no *.rt!r %rit# #!o.l2 - r@.#t2 *or $t l$#t 10 +#5
A)SOL3TE $AX"$3$ RAT"NGS
Volt$) on An1 Pin Rl$ti6 to Aro.n2 Q055V to SG50V
O'r$tin) T+'r$t.r Q55RC to S1:5RC
,tor$) T+'r$t.r Q55RC to S1:5RC
,ol2rin) T+'r$t.r :=0RC *or 10 #con2#
,.''l1 Volt$) in DC Q ,1+-ol VDD Min5 :5G to M$85 555 6olt#5
Volta0e 8e0ulator 7C @Electrical Characteristics o MC,805A1
T! MCG8CC<LMG8CC<MCG8CCA #ri# o* t!r tr+in$l 'o#iti6 r).l$tor# $r
$6$il$-l in t! TO&::0<D&PA0 '$c>$) $n2 %it! #6r$l *i82 o.t'.t 6olt$)#( +$>in)
t!+ .#*.l in $ %i2 r$n) o* $''lic$tion#5 E$c! t1' +'lo1# intrn$l c.rrnt li+itin)(
t!r+$l #!.t 2o%n $n2 #$* o'r$tin) $r$ 'rotction( +$>in) it ##nti$ll1
in2#tr.cti-l5 I* $2@.$t !$t #in>in) i# 'ro6i22( t!1 c$n 2li6r o6r 1A o.t'.t
c.rrnt5 Alt!o.)! 2#i)n2 'ri+$ril1 $# *i82 6olt$) r).l$tor#( t!# 26ic# c$n -
.#2 %it! 8trn$l co+'onnt# to o-t$in $2F.#t$-l 6olt$)# $n2 c.rrnt#5
'eat*res
P O.t'.t C.rrnt .' to 1A
P O.t'.t Volt$)# o* 5( =( 8( "( 10( 1:( 15( 18( :/V
P T!r+$l O6rlo$2 Protction
P ,!ort Circ.it Protction
P O.t'.t Tr$n#i#tor ,$* O'r$tin) Ar$ Protction
Pin Di$)r$+ o* t! Po%r IC
T(pical Applications
Notes1
314 To #'ci*1 $n o.t'.t 6olt$)5 #.-#tit.t 6olt$) 6$l. *or MCC5M A co++on )ro.n2 i#
[email protected] -t%n t! in'.t $n2 t! O.t'.t 6olt$)5 T! in'.t 6olt$) +.#t r+$in
t1'ic$ll1 :50V $-o6 t! o.t'.t 6olt$) 6n 2.rin) t! lo% 'oint on t! in'.t ri''l
6olt$)5
3:4 CI i# [email protected] i* r).l$tor i# loc$t2 $n $''rci$-l 2i#t$nc *ro+ 'o%r ,.''l1 *iltr5
3;4 CO i+'ro6# #t$-ilit1 $n2 tr$n#int r#'on#5
S=CE$AT"C D"AGRA$!
)loc9 Dia%ra& o+ te&perat*re in#icator *sin% "C,-C.2!
CONST8'CT7ON AN& 9O867NB OF T;E C78C'7T
T! *i).r $-o6 #!o%# t! -$#ic -loc> 2i$)r$+ o* t! t+'r$t.r in2ic$tor #1#t+
.#in) +icrocontrollr AT8"C5:5 T! 'o%r #.''l1 *or t! circ.it i# r).l$t2 -1 t!
ICG805 $n2 #.''li2 to 2i**rnt '$rt# o* t! .nit5 D,1=:1 i# t! t+'r$t.r #n#or c!i'5
T! +icrocontrollr .nit 3MCU4 r$2# t! t+'r$t.r *ro+ t! #n#or5 T! t+'r$t.r
2$t$ i# co+'$r2 %it! crt$in .#r&2*in t+'r$t.r 6$l.# $n2 'roc##2 in#i2 t!
MCU $# 'r t! 'ro)r$+ $n2 t!n #nt to t! LCD 2i#'l$15T! *.nction# o* $c! #ction
o* t! circ.it $r 8'l$in2 in t! *ollo%in) #ction#5
)O9E8
S'))%C

,805
8EB'%ATO8
&S1(21
TEM)8AT'8E
SENSO8
MC'
AT8!C52
%C& &7S)%AC
@1(D1A
)o3er Su..l+
T! 'o%r #.''l1 .nit con#i#t# o* $ #t'&2o%n tr$n#*or+r 3:;0V AC 'ri+$r1 to 0&"V(
:50+A #con2$r14( -ri2) rcti*ir $n2 6olt$) r).l$tor5 T! o.t'.t o* t! tr$n#*or+r i#
*2 to -ri2) rcti*ir 2io2# D1 t!ro.)! D/ 3$c! IN/00G45 T! ri''l *ro+ t! o.t'.t
-ri2) rcti*ir i# *iltr2 -1 c$'$citor C1 $n2 *2 to r).l$tor ICG8055 T! r).l$t2
o.t'.t i# )i6n to t! t+'r$t.r #n#or( +icrocontrollr .nit $n2 LCD +o2.l(
r#'cti6l15
B!n t! #%itc! ,1 i# clo#2( LED1 )lo%# to in2ic$t t! 'r#nc o* 'o%r in t!
#1#t+5
Tem.erature Sensor
T+'r$t.r #n#or c!i' D,1=:1 3IC;4 i# $n 8&'in DIP IC5 T! 'in 2t$il# o* D,1=:1 $r
#!o%n in it# 2i$)r$+ $n2 t! intrn$l -loc> 2i$)r$+ in *i).r&;5 T! c!i' c$n +$#.r
t+'r$t.r# *ro+ &55 to 1:5 2)r Cl#i.# in 055 2)r Cl#i.# incr+nt#( %!ic! $r
r$2 $# "&-it 6$l.#5 It c$n o'r$t o** :5GV to 555V5 D$t$ i# r$2 <%rittn 6i$ $ :&%ir
#ri$l intr*$c5 Pin# 1 $n2 : o* t! t+'r$t.r IC $r connct2 to 'in# 11 $n2 10 o* t!
+icrocontrollr( r#'cti6l15 T! t!r+$l $l$r+ o.t'.t 3To.t4 o* IC D,1=:1 $cti6$t#
%!n t! t+'r$t.r 8c2# .#r 2*in2 !i)! t+'r$t.r TH5 T! o.t'.t r+$in#
$cti6 .ntil t! t+'r$t.r 2ro'# -lo% .#r&2*in2 lo% t+'r$t.r Tl5 U#r&2*in2
t+'r$t.r #ttin)# $r #tor2 in t! non&6ol$til ++or15 T+'r$t.r #ttin)# $n2
t+'r$t.r r$2in)# $r $ll co++.nic$t2 to<*ro+ IC D,1=:1 o6r $ :&%ir #ri$l c$-l5
T! +o#t #i)ni*ic$nt -it 3M,B4 o* t! 2$t$ i# tr$n#+itt2 *ir#t $n2 t! l$#t #i)ni*ic$nt -it
3L,B4 i# tr$n#+itt2 l$#t5
A##ressin0
T! c!i' $22r## o* D,1=:1 co+'ri## intrn$l 'r#t co2 ni--l N1001N 3-in$r14
*ollo%2 -1 intrn$ll1 con*i).r$-l $22r## 'in#<-it# A:( A1 $n2 A05 T! i)!t! -it o* t!
$22r## -1t i# 2tr+in2 -1 t! t1' o* o'r$tion 3it!r r$2 or %rit4 t!$t i# to -
'r*or+25 For %ritin) to t! 26ic t! i)!t -it i# N0N $n2 *or r$2in) *ro+ t! 26ic t!
i)!t! -it i# N1N5 In o.r c$#( A:( A1 $n2 A0 'in# $r )ro.n22 $n2 !nc t! 26ic
$22r## *or %ritin) i# N1001000-N or "0 3!84 $n2 *or r$2in) t! 26ic $22r## i#
N10010001-N or "1 3!845
Coni0uration:Status re0ister
T!i# r)i#tr c$n - $cc##2 *or r$2in) or %ritin) -1 i##.in) co++$n2 -1t AC3!84
*ro+ t! +$#tr 38:C5:45 T!i# r)i#tr i# '$rtic.l$rl1 [email protected] i* D,1=:1 i# .#2 *or
t!r+o#t$t control( #inc it cont$in# *l$) -it# THF 3!i)!&t+'r$t.r *l$)4 %!ic! $r #t
to N1N %!n t+'r$t.r cro### t! r#'cti6 li+it# $rlir %rittn into TH $n2 TL
r)i#tr#5 It $l#o cont$in# t! *l$) -it 32on4( %!ic! i# #t to N1N %!n r#.lt# o* con6r#ion
$r $6$il$-l $*tr i##.in) o* #t$rt con6r#ion co++$n2 EE3!845 T! ot!r -it# o*
con*i).r$tion r)i#tr $r 2*in25 NNVBN i# t! non&6ol$til ++or1 -.#1 *l$)( N1N i# to
%rit to $n E: ++or1 cll in 'ro)r##( N0N in2ic$t# t!$t non&6ol$til ++or1 i# not -.#1(
NPOLN i# non&6ol$til o.t'.t 'ol$rit1 -it 3N1NE$cti6 !i)! $n2 N0N E $cti6 lo%4 $n2 N1#!otN i#
on&#!ot +o25 A co'1 to E: +$1 t$> .' to 10+#5 I* 1#!ot i# N1N( D,1=:1 %ill 'r*or+
on t+'r$t.r con6r#ion .'on rc'tion o* t! #t$rt con6rt T 'rotocol5 I* 1#!ot i# N0N(
D,1=:1 %ill contin.o.#l1 'r*or+ t+'r$t.r con6r#ion#5 T!i# -it i# non&6ol$til5
Comman# Set
Co+'lt co++$n2 in#tr.ction #t *or $cc##in) 6$rio.# intrn$l r)i#tr# $# %ll $# *or
#t$rtin) $n2 #to''in) o* con6r#ion 'roc## $r )i6n in T$-l5 For .n2r#t$n2in) t!
8$ct #@.nc in %!ic! #t$rt -it( $22r## -1t( $c>no%l2)+nt -it( co++$n2 -1t $n2
2$t$ -1t# $r to - #nt $lon) t! I:C -.#( 'l$# r*r to t! 2$t$#!t o* D,1=:1(
%!rin t!# $#'ct# !$6 -n 8'l$in2 in 'ro'r 2t$il5 T!i# %ill !l' in
.n2r#t$n2in) t! contnt# o* t! +$in 'ro)r$+5
Microcontroller 'nit
Microcontrollr AT8"C5: 3IC:4 i# $ /0 'in IC *ro+ At+l5 It# 'in 2t$il# $r #!o%n in
t! 'in 2#cri'tion 2i$)r$+5 Li> AT8"C51( it $l#o -lon)# to t! 80;1<8051 *$+il15
Microcontrollr AT8"C5: !$# $ :5=L8 -it intrn$l r$n2o+& $cc## ++or1 3RAM4( i)!t
intrr.'t #o.rc# $n2 80B o* *l$#! ++or1 co+'$r2 to 1:8L8 &-it intrn$l RAM( #i8
intrr.'t #o.rc# $n2 /0B *l$#! ++or1 in AT8"C515 B1 co+-inin) $ 6r#$til 8&-it
CPU %it! *l$#! ++or1 on $ +onolit!ic c!i'( At+l AT8"C5: i# $ 'o%r*.l( !i)!l1 co#t&
**cti6 #ol.tion to +$n1 +-222 control $''lic$tion#5 Port# 0 $n2 : $r 8&-it
-i2irction$l in'.t< o.t'.t 3I<O4 'ort#5 T!# 'ort# !$6nNt -n .#2 in t!i# t+'r$t.r
in2ic$tor5 Port 1 i# $n 8&-it -i2irction$l I<O 'ort %it! intrn$l '.ll&.'#5 Port# 150 t!ro.)!
15G $r connct2 to 'in# G t!ro.)! 1/ o* t! LCD5 Port 1 o.t'.t -.**r# c$n #in>< #o.rc
*o.r TTl in'.t#5 Port ; i# $ 8&-it -i2irction$l I<O 'ort %it! intrn$l '.ll&.'#5 Port# ;50
$n2 ;51 o* IC: $r connct2 to #ri$l cloc> lin 3,CL4 $n2 #ri$l 2$t$ lin 3,DA4 o* IC;(
r#'cti6l15 Port ; o.t'.t -.**r# c$n #in><#o.rc *o.r TTL in'.t#5 A 1:MH? cr1#t$l
o#cill$tor i# connct2 to CTAL1 $n2 CTAL: 'in# *or o'r$tion o* t! +icrocontrollr5 A
!i)! '.l# on R,T 'in 3'in "4 %!il t! o#cill$tor i# r.nnin) r#t# t! +icrocontrollr5 In
t!i# circ.it( t!i# 'in i# connct2 to SVcc t!ro.)! c$'$citor# C5 310.F( 1=V45 T!
8trn$l&$cc## n$-l 'in 3EA4 i# connct2 to SVcc *or intrn$l 'ro)r$+ 8c.tion#5
T!i# 'in $l#o rci6# t! 1:V 'ro)r$++in) n$-l 6olt$) 3V''4 2.rin) *l$#!
'ro)r$++in) %!n 1:V 'ro)r$+ i# #lct2
TEST7NB
Visuali<ation Test9
B!n t! *$-ric$tion 'roc## i# co+'lt2 U $ll t! co+'onnt# !$6 -n +o.nt2
'r*ctl1 t! 6i#.$li?$tion t#tin) i# 'r*or+25 In t!i# t#tin) t! circ.it i# #c$nn2
#i+'l1 -1 t! 1# U not -1 t! !l' o* $n1 in#tr.+nt5 It to n#.r t!$t t! #ol2rin) i#
'r*ct $n2 t!r i# no loo# connction -t%n t! co+'onnt#5
)re4heatin0 Test1
T!i# t#t i# 'r*or+2 to c!c> t! !$t tolr$nc o* t! co+'onnt#5 In t!i# t! circ.it i#
'ro6i22 'o%r #.''l1 $n2 l*t *or #o+ ti+5 A*tr $ intr6$l o* ti+ it i# c!c>2 t!$t i*
t!r i# $n1 co+'onnt )t *$.lt1 co+'onnt #'ci$ll1 *or IC7#5
A..lications1
15 T!i# #1#t+ c$n - 'l$c2 n$r co+'.tr 'roc##or# *or !$t #n#in)5
:5 Pl$c2 n$r !$t #n#iti6 26ic# to in2ic$t t! t+'r$t.r5
;5 T!i# #1#t+ c$n intr*$c2 %it! co+'.tr# $n2 t+'r$t.r c$n - controll25
PCB Layout:
#$%&$A' in Assem(ly:

;program for the automatic temperature Controller
;Cetpa-Roorkee
; matirx keyboard with connections on p2 port
;rows are connected to p2.0 to p2.2
;columns are connected to p2.4 to p2.7
;Lcd connected at p1 with Controls pins
; at rs-p3.5,rw-p3.4,en-p3.3
sda equ p0.1
scl equ p0.0
rs equ p3.5
rw equ p3.4
en equ p3.3
lcd equ p1
lcd_busy equ p1.7
key_brd equ p2
th equ 50h
tl equ 51h
ascii_store equ 40h
delimiter equ 20h
delay_count equ 23h
temperature_store equ 30h
temp_result equ 35h
LCD_str equ 2ah

;Flags
th_fag equ 7fh
tl_fag equ 7eh
temp_fag equ 7dh
org 0000h
mov sp,#60h
lcall ini
clr th_fag
clr tl_fag
mov th,#40
mov tl,#37
mov dptr,#Msg0
acall msg_read
mov delay_count,#40 ;for 2-sec time
acall time ; $$$$$$$$$$$$$$$
value_enter:
mov r7,#01h
acall command
mov dptr,#Msg1 ;show th
acall read
mov a,th
mov r1,#LCD_str
acall bin2ascii
inc r1
acall tim_display

mov r7,#87H
acall command
mov dptr,#Msg2 ;show th
acall read
mov a,tl
mov r1,#LCD_str
acall bin2ascii
inc r1
acall tim_display
;till here default values are shown
;into nezt line show following
mov r7,#0c0h
acall command
mov dptr,#Msg5
acall msg_read
scan0:
mov key_brd,#0f0h ;bcoz upper 4
mov a,key_brd ;are connected to colu
cjne a,#0f0h,mode_check0
sjmp scan0
;**************** detecting rows
mode_check0:
acall delay1
mov a,key_brd
cjne a,#0f0h,mode_check1
sjmp scan0
mode_check1:
acall delay
acall delay1
mov key_brd,#0fh
mov key_brd,#0fbh
mov a,key_brd
cjne a,#0fbh,enter_check
ajmp scan0

enter_check: ;This is enter button
jb acc.6,mod43
ajmp temp_conversion_start
ljmp scan0
mod43: ;This is clear button
jnb acc.7,clear_press
ljmp scan0
clear_press:
mov r7,#01h
acall command
mov dptr,#Msg1 ;show th
acall read
mov r7,#38h
acall command
mov r7,#0eh
acall command
mov r7,#06h
acall command
mov r7,#0c0h
acall command
setb th_fag
; mov r6,#3
ajmp forward
tl_edit:
mov r7,#01h
acall command
mov dptr,#Msg2 ;show tl
acall read
mov r7,#0c0h
acall command
setb tl_fag

forward:
mov lcd,#00h
scan:
mov key_brd,#0f0h ;bcoz upper 4 are
mov a,key_brd ;connected to column
cjne a,#0f0h,row
sjmp scan
;*************** detecting rows
row:
acall delay1
mov a,key_brd
cjne a,#0f0h,row111
sjmp scan
row111:
acall delay
acall delay1
mov key_brd,#0fh
mov key_brd,#11111110b
mov a,key_brd
orl a,#0fh
cjne a,#0fh,row1
mov key_brd,#0fh
mov key_brd,#0fdh
mov a,key_brd
cjne a,#0fdh,row2
mov key_brd,#0fh
mov key_brd,#0fbh
mov a,key_brd
cjne a,#0fbh,row3
ajmp scan

;**********
row1:
jb acc.4,c2
mov r7,#'0'
acall display
sjmp scan
c2:
jb acc.5,c3
mov r7,#'1'
acall display
sjmp scan
c3:
jb acc.6,c4
mov r7,#'2'
acall display
sjmp scan
c4:
mov r7,#'3'
acall display
sjmp scan
;****************
row2:
jb acc.4,c22
mov r7,#'4'
acall display
ljmp scan
c22:
jb acc.5,c32
mov r7,#'5'
acall display
ljmp scan
c32:
jb acc.6,c42
mov r7,#'6'
acall display
ljmp scan
c42:
mov r7,#'7'
acall display
ljmp scan
;****************
row3:
jb acc.4,c23
mov r7,#'8'
acall display
ljmp scan
c23:
jb acc.5,c33
mov r7,#'9'
acall display
ljmp scan
c33:
jb acc.6,c43
ajmp test ;This is enter button
ljmp scan
c43:
;This is clear button
;not used here
ljmp scan

;*******************
test:
mov r7,#04h
acall command
acall ready
acall read_add1
clr c
mov b,#0c0h
subb a,b
mov r0,a
mov r1,#ascii_store
acall ready
acall read_data
repeat:
inc r1
acall ready
acall read_data
mov @r1,a
djnz r0,repeat
mov delimiter,r1
inc delimiter
;********
;conversion routine ;bank 1 used
setb psw.3
mov r5,#00h ;used for msb
mov r6,#00h ;used for storing the lsb result
mov r0,#0ah
mov r2,#1
mov r3,#10
mov r4,#100
mov r1,#(ascii_store+1)
here: clr a
mov a,r1
cjne a,delimiter,convert
ajmp break ; read till there
convert:
mov a,@r1
anl a,#0fh
mov b,@r0
mul ab
mov r7,a
xch a,b
cjne a,#00h,hiii
looo:
mov a,r6 ;result of add
addc a,r7
jc for
con: mov r6,a
inc r1
inc r0
ajmp here
break:
clr psw.3
;**********************
jb tl_fag,tl_save
clr c
mov a,0eh ;0eh is the add of r6 of bank1
cjne a,#7dh,th_check
th_check:
jnc error_msg ;a> or = 125 show error
mov th,0eh ;if c then save
clr th_fag
ajmp tl_edit
error_msg:
mov r7,#01h
acall command
jb tl_fag,tl_error
mov dptr,#Msg3
acall msg_read
acall time
ajmp clear_press ;again enter th
tl_error:
mov dptr,#Msg4
acall msg_read
acall time
ajmp tl_edit ;again enter tl
;***************portion of the conversion routine
hiii:
add a,r5
mov r5,a
ajmp looo
for:
inc r5
ajmp con
;**********************
tl_save:
clr c
mov a,0eh ;0eh is the add of r6 of bank2
cjne a,th,tl_check
tl_check:
jnc error_msg ;a> or = th show error
mov tl,0eh ;0eh is the add of r6 of bank2
clr tl_fag
;now we have to show the saved values on
;LCD & wait for enter to be pressed
ajmp value_enter
;___________________________
temp_conversion_start:
mov r0,#th
acall delay10
acall i2cstart
mov a,#90h
acall i2cwrite
mov a,#0ach
acall i2cwrite
acall delay10
mov a,#02h
acall i2cwrite
acall delay10
acall i2cstart
mov a,#90h
acall i2cwrite
mov a,#0a1h
acall i2cwrite
acall delay10
mov a,th ;#28h
acall i2cwrite
mov a,#00h
acall i2cwrite
acall delay10
acall i2cstart
mov a,#90h
acall i2cwrite
mov a,#0a2h
acall i2cwrite
acall delay10
mov a,tl ;#24h
acall i2cwrite
mov a,#00h
acall i2cwrite
acall delay10
acall i2cstop
clr temp_fag ;temp fag
mov r7,#01h
acall command
mov dptr,#Msg
acall read
mov temperature_store,#00h
here1:
acall temp ;temp read by this routine
jb temp_fag,EEE
setb temp_fag
mov temperature_store,a
ajmp here1
EEE:
cjne a,temperature_store,make_equal
ajmp here1
make_equal:
mov temperature_store,a
acall conversion
mov r7,#8bh
acall command
acall string
sjmp here1
; ************************
temp:
acall i2cstart
mov a,#90h
acall i2cwrite
;*****************************
mov a,#0eeh
acall i2cwrite
; start temp conversion
acall i2cstop
acall i2cstart
mov a,#90h
acall i2cwrite
mov a,#0aah
acall i2cwrite
; read last read temp
acall i2cstart
mov a,#91h
acall i2cwrite
acall i2cread
acall i2cstop
ret
i2cstart:
setb sda
acall delayone
setb scl
acall delayone
clr sda
clr scl
ret
i2cstop:
clr scl
clr sda
setb scl
acall delayone
setb sda
mov c,sda
ret
;=======================
i2cwrite:
mov r0,#08h
i2cwrite_loop:
rlc a
mov sda,c
setb scl
acall delayone
clr scl
djnz r0,i2cwrite_loop
mov c,sda
setb scl
acall delayone
clr scl
ret
;=======================
i2cread:
mov c,sda
mov r0,#8
rlc a
i2cread_loop:
setb scl
mov c,sda
rlc a
acall delayone
clr scl
djnz r0,i2cread_loop
ret
delayone:
mov r1,#100
loopa:
djnz r1,loopa
ret
;**********************

read_data: ;data is stored in the r0 register
mov lcd,#0fh
setb rs ;to select data register
setb rw
clr en
setb en
mov a,lcd
clr en
ret
read_add1:
mov lcd,#0fh
clr rs
setb rw
clr en
setb en
mov a,lcd
clr en
orl a,#80h
ret
read_add:
push acc
mov lcd,#0fh
clr rs
setb rw
clr en
setb en
mov a,lcd
clr en
orl a,#80h
cjne a,#8fh,out
mov r7,#0c0h
acall command
out:
pop acc
ret
;******************
conversion:
push acc
mov a,temperature_store
mov r0,#(temperature_store+1)
conloop:
mov b,#10
div ab
orl 0f0h,#30h
mov @r0,0f0h
inc r0
cjne a,#00h,conloop
dec r0
mov r1,#temp_result;35h
conloop1:
mov a,@r0
mov @r1,a
dec r0
inc r1
cjne r0,#temperature_store,conloop1
mov @r1,#'$'
pop acc
ret
;====================
string:
push acc
mov r0,#temp_result;30h
strloop:
mov a,@r0
mov r7,a
cjne a,#'$',continue
mov r7,#' '
acall display
pop acc
ret
continue:
acall display
inc r0
sjmp strloop
;*******************
bin2ascii:
mov @r1,#'$'
dec r1
rep:
mov b,#10
div ab
orl 0f0h,#30h
mov @r1,0f0h
dec r1
cjne a,#00h,rep
ret
tim_display:
brij: mov 07h,@r1
cjne r7,#'$',shoe
ret
shoe:
acall display
inc r1
ajmp brij

command:
acall ready
mov lcd,r7
clr rs
clr rw
setb en
clr en
ret
display:
acall ready
mov lcd,r7
setb rs
clr rw
setb en
clr en
ret
ready:
clr en
mov lcd,#0fh
clr rs
setb rw
wait:
clr en
setb en
jb lcd_busy,wait
clr en
ret
ini:
mov r7,#38h
acall delay1
acall delay1
acall command
mov r7,#38h
acall delay1
acall command
mov r7,#38h
acall delay1
acall command
mov r7,#0eh
acall command
mov r7,#01h
acall command
mov r7,#06h
acall command
mov r7,#80h
acall command
ret
delay10:
push acc
mov tmod,#01h
mov tl0,#10h
mov th0,#27h ;1050=2710h
mov tcon,#00h
setb tr0
wait12: jnb tf0,wait12
clr tr0
pop acc
ret
delay1:
push 07h
push 06h
mov r6,#100
loop24: mov r7,#100
loop23: djnz r7,loop23
djnz r6,loop24
pop 06h
pop 07h
ret
;**********
delay:
push acc
push 00h
mov r0,#02h
loopr:
mov b,#0a0h
loopb:
mov a,#0fah
loopa12:
dec a
jnz loopa12
djnz 0f0h,loopb
djnz r0,loopr
pop 00h
pop acc
ret
time:
push 00h
mov r0,30h ;30h contain counter
mov tmod,#01h
repeat1: mov tcon,#00h
mov th0,#3ch
mov tl0,#0aah
setb tr0
wait1: jnb tf0,wait1
clr tr0
djnz r0,repeat1
pop 00h
ret
msg_read:
push acc
push 07h
nex: clr a
movc a,@a+dptr
mov r7,a ;r7 is used for passing parameter to display
cjne a,#'0',aga
sjmp down
aga: acall read_add
acall display
inc dptr
sjmp nex
down:
pop 07h
pop acc
ret

read:
nex1:
clr a
movc a,@a+dptr
cjne a,#'0',aga1
sjmp down1
aga1:
mov r7,a
acall display
acall delay1
inc dptr
sjmp nex1
down1:
ret
Msg: db 'Temprature ','0'
Msg0: db 'Welcome To Auto Temp Controller','0'
Msg1: db 'TH ','0'
Msg2: db 'Tl ','0'
Msg3: db 'Error: TH > or = 125','0'
Msg4: db 'Error: Tl > or = TH','0'
Msg5: db 'Enter for cont.','0'
end



; mov r7,#'4'
; acall display
; mov r7,#'0'
; acall display
; mov r7,#87h
; acall command
; mov dptr,#Msg2 ;show tl=
; acall read
; mov r7,#'3'
; acall display
; mov r7,#'7'
; acall display
;================ End Of Program Code =====================
Co&ponent>s List +or Pro?ect
AT8"C51 1
D,&1=:1 1
: Lin LCD 1
B.??r 1
Tr$n#i#tor BC 5/8 1
LED 1
R#i#t$nc# 100 5
R#i#t$nc /G0 o!+ 5
;;'ico*$r$2 Cr$+ic Di#> C$'$citor :
Cr1#t$l O#ci5 31: MH?4 1
Mini ,%itc! 1;
100 Pot 3Pr#t4 1
Dio2 1n/00G /
IC B$# 38Pin( /0Pin4 1 $c!
Rli+$t 35 'in $n2 : 'in4 1 $c!
Rli+$t 31='in4 :
Po%r c!or2 1
C$'$citor 100Micro*$r$2< :56 1
C$'$citor 10 Micro*$r$2 < :56 1
Volt$) R).l$tor IC G805 1
Tr$n#*or+r 3"&0&"4 1

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close