You are on page 1of 66

I2C BASED AUTOMATED PERIODIC BELL 1

CHAPTER - I
Over View of Project
The main purpose of I2C BASED AUTOMATED PERIODIC BELL is to
i!e a rin a""or#in to our re$uire# time% Instea# of operatin &e'' manua''() the tas*
+i'' &e performe# &( automation metho#% In or#er to automate the &e'' here) +e are
usin I2C proto"o'%
The ae of automation starte# in the eihteenth "entur( +hen ma"hines &ean
to ta*e o!er ,o&s that ha# pre!ious'( &een performe# &( human &ein% If +e operate
the &e'' manua''() there o""urs some time #e'a( an# a'so it is #iffi"u't tas* to perform
reu'ar'(% So) in or#er to a!oi# su"h *in# of pro&'ems +e are oin for automation%
I2C is a &us #e!e'ope# in 1-./0s &( Phi'ips Semi"on#u"tors to "onne"t
interate# Cir"uits 1ICs2% The stan#ar# I2C &us ma( operate as a mu'ti master &us3
Mu'tip'e ICs ma( &e "onne"te# to the I2C &us an# ea"h one ma( a"t as a master &(
initiatin a #ata transfer% Seria' .4&it oriente#) &i4#ire"tiona' #ata transfers ma( &e
ma#e at up to 1// 5&it6s in a stan#ar# mo#e or up to 7// 5&it6s in a fast mo#e% The
I2C &us ma( in"'u#e t+o &us 'ines) a seria' #ata 'ine 1SDL2 an# a seria' "'o"* 'ine
1SCL2%
The main "omponents in!o'!e# in the pro,e"t are DS18/9) UL:2//8) re'a()
LCD) LED) Mi"ro "ontro''er 1AT.-C;12% The Mi"ro"ontro''er is use# as Master
#e!i"e an# DS18/9 1rea' time "'o"*2 is use# as s'a!e #e!i"e% B( pro!i#in
"ommuni"ation &et+een these t+o #e!i"es the &e'' is set for rin% The "ommuni"ation
&et+een these t+o #e!i"es is esta&'ishe# &( means of I2C &us%
At first the &us is initiate# &( the master) &( transferrin START &it) +hen the
SCL 'ine is <I=<% Then a##ress is transferre# on SDA 'ine &( ma*in the SCL 'ine as
LO>) an# then fo''o+e# &( STOP &it +hen the SCL 'ine is <I=<% S'a!e #e!i"e after
re"ei!in the #ata "orre"t'() sen#s an a"*no+'e#ement to master #e!i"e informin
that the #ata is re"ei!e#) a""or#in to the "'o"* enerate# &( the master% Then master
#e!i"e retrie!es the #ata from the parti"u'ar 'o"ation an# #isp'a(s it on the LCD%
11 BLOC! DIA"RAM A#D ITS DESCRIPTIO#
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 2
The main "omponents that are in!o'!e# in this &'o"* #iaram are3
2@1A LCD
Mi"ro "ontro''er .-C;1
Rea' Time "'o"* DS18/9
Re'a( #ri!er UL:2//8
Re'a(
E'e"tromaneti" &e''%
%
$i% 11 B&oc' (i)%r)* of I2C +),e( )-to*)te( .erio(ic +e&&
A 28/! A" is "on!erte# to 12! A" &( usin transformer% This 12! A" is
"on!erte# in to 12! D" &( means of &ri#e re"tifier% This 12! D" is not perfe"t D") it
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 8
"ontains some ripp'e "omponents% These ripp'es are then fi'tere# &( usin fi'terin
"ir"uit% The sina' from fi'terin "ir"uit is i!en to the reu'ator% <ere the reu'ator
"ir"uit reu'ates the !o'tae to ;!% This ;! DC is i!en to a'' the "omponents present
in the &'o"* #iaram%
<ere) rea' time "'o"* is interfa"e# +ith the mi"ro"ontro''er 1AT.-C;12)
+hi"h +or*s &ase# on inters interate# "hip 1IIC2 proto"o'% The RTC IC enerates the
time in se"on#s) minutes an# hours format% The "o#e for the mi"ro"ontro''er is
#e!e'ope# to rea# the #ata from the RTC an# the same +i'' &e #isp'a(e# on the 2@1A
LCD in <<3MM3SS format%
The s(stem proram +i'' &e #e!e'ope# to enerate a'arms at spe"ifie# time
inter!a's% The re'a( #ri!er "ir"uit #ri!es the SPST re'a(% An( e'e"tromaneti" a'arm
"an &e use# to enerate &etter soun#s%
12 EMBEDDED S/STEMS0
An Em&e##e# s(stem is the "om&ination of soft+are an# har#+are an# is
spe"ifi"a''( #esine# to perform a spe"ifi" fun"tion %An em&e##e# s(stem nee#s
memor( for t+o purposes that is storin its proram permanent'( an# is to store an#
retrie!e its #ata% Bor permanent storae of proram the ROM is use#) +hi"h must
retain the store# #ata +hen the po+er is turne# off% This "an &e o&taine# +ith the use
of em&e##e# mi"ro"ontro''er +hen a'' the har#+are re$uire# to run the app'i"ation is
pro!i#e# on the "hip it is referre# to as em&e##e# mi"ro"ontro''er%
Em&e##e# mi"ro "ontro''ers are no+ rep'a"in some !er( "ommon #e!i"es
'i*e ;;; timers &e"ause the( are a"tua''( "heaper to use in app'i"ations an# the( are
mu"h more pre"ise an# easier to "ontro'% <ere em&e##e# mi"ro"ontro''er of AT
.-C;1 is use#) that is an .4&it mi"ro"ontro''er +ith 75 &(tes of f'ash an# 12.C.4Bit
RAM%
11 MICROCO#TROLLER
The main "ontro''in unit of the propose# s(stem is the mi"ro"ontro''er% The
main features of mi"ro"ontro''er parti"u'ar'( Atme' .-C;1 is #is"usse# here%
A mi"ro"ontro''er "onsists of a po+erfu' CPU tiht'( "oup'e# +ith memor(
DRAM)ROM or EPROME)!arious I6O features su"h as seria' ports) para''e' ports
)timer6"ounters) interrupt "ontro''er )#ata re$uisition interfa"e) Ana'o to #iita'
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 7
"on!erterDADCE)#iita' to ana'o "on!erter) e!er(thin interate# into a sin'e
si'i"on "hip%
It #oes not mean that an( mi"ro"ontro''er shou'# ha!e a'' the a&o!e sai#
features on a sin'e "hip) #epen#in on the nee# an# area of app'i"ation for +hi"h it is
#esine#) the on "hip features present in it ma( or ma( not in"'u#e a'' the in#i!i#ua'
se"tion sai# a&o!e% An( mi"ro"omputer s(stems re$uires memor( to store a se$uen"e
of instru"tions ma*in up a proram ) para''e' port or seria' port for "ommuni"atin
+ith an eCterna' s(stem timer6"ounter for "ontro' purpose 'i*e eneratin time #e'a(%
A(v)2t)%e, of Microco2tro&&er
If a s(stem is #e!e'ope# +ith a mi"ropro"essor the #esiner has to o for
eCterna' memor( su"h as RAM) ROM or EPROM an# periphera's an# hen"e
the siFe of the PCB +i'' 'are enouh to ho'# a'' the re$uire# periphera'% But)
the mi"ro"ontro''er has ot a'' these periphera' fa"i'ities on a sin'e "hip so
#e!e'ope# of a simi'ar s(stem +ith a mi"ro"ontro''er re#u"e PCB siFe an# "ost
of the #esin%
One of the ma,or #ifferen"e &et+een a mi"ro"ontro''er an# a mi"ropro"essor is
that a "ontro''er% Often #ea's +ith &its) not &(tes as in the rea' +or'#
app'i"ation) for eCamp'e s+it"h "onta"ts "an on'( &e open or "'ose) in#i"ators
shou'# &e 'it or #ar* an# motors "an &e either turne# on or off an# so forth%
The mi"ro"ontro''er has t+o 1A &its timer6"ounters &ui't +ithin it) +hi"h
ma*es it more suita&'e to this app'i"ation% Sin"e) +e nee# to pro#u"e some
a""urate time #e'a(s%
De,cri.tio2
The AT.-C;1 is a 'o+4po+er) hih performan"e CMOS . G &it mi"ro
"omputer +ith 7 5&(tes of f'ash Erasa&'e an# Proramma&'e Rea# On'( Memor(
1EPROM2%The #e!i"e is manufa"ture# usin a Atme'0s hih #ensit( non!o'ati'e
memor( te"hno'o( an# is "ompati&'e +ith the in#ustr( stan#ar# MCS4;1tm
instru"tion a"t an# pin out% The on4"hip f'ash a''o+s the proram memor( to &e
reproramme# in4s(stem or &( a "on!entiona' non!o'ati'e memor( prorammer% B(
"om&inin a !ersati'e .4&it CPU +ith f'ash on a mono'ithi" "hip) the AT.-C;2 is a
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL ;
po+erfu' mi"ro"omputer +hi"h pro!i#es a hih'( f'eCi&'e an# "ost effe"ti!e so'ution
to man( em&e##e# "ontro' app'i"ations%
$e)t-re,
Compati&'e +ith MCS4;1st pro#u"ts%
7 5&(tes of in4s(stem reproram a&'e f'ash memor(%
Bu''( stati" operation3 / <F to 27 M<F
Three4'e!e' proram Memor( Lo"*%
12.@.4Bit Interna' RAM%
82 Proramma&'e I6O Lines%
T+o 1A4Bit Timer6Counters%
SiC Interrupt sour"es%
Proramma&'e Seria' Channe'%
Lo+ Po+er I#'e an# Po+er Do+n Mo#es
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL A
CHAPTER 3 II
OVER VIE4 O$ MICROCO#TROLLER
C5i. (e,cri.tio2
It in"'u#es the "hip #etai's of mi"ro"ontro''er .-C;2) A6D "on!erter Mu'tip'eCer an#
I6O ECpan#er an# Li$ui# Cr(sta' Disp'a(%
PI# CO#$I"URATIO#0

Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 9
PI# DIA"RAM O$ ATS6781
$i% 220 B&oc' (i)%r)* of 76C81 Micro co2tro&&er
VCC4Supp'( !o'tae
"#D4=roun#
Port 9
Port / is an .4&it open #rain &i4#ire"tiona' I6O port% As an output port) ea"h pin
"an sin* eiht TTL inputs% >hen 10s are +ritten to port / pins) the pins "an &e use# as
hih impe#an"es inputs%
Port / ma( &e "onfiure# to &e the mu'tip'eCe# 'o+ or#er a##ress6#ata &us
#urin a""esses to eCterna' proram an# #ata memor(% In this mo#e port / has pu''
ups% Port / a'so re"ei!es the "o#e &(tes #urin B'ash prorammin an# outputs the
"o#e &(tes #urin proram !erifi"ation%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL .
Port 1
Port 1 is an .4&it &i4#ire"tiona' I6O port +ith interna' pu''4ups% The port 1
output &uffers "an sin*6sour"e four TTL inputs%
>hen 10s are +ritten to port 1 pins the( are pu''e# hih &( the interna' pu''4
ups an# "an &e use# as inputs %As inputs) port 1 pins that are eCterna''( &ein pu''e#
'o+ +i'' sour"e "urrent &e"ause of the interna' pu'' ups% Port 1 a'so re"ei!es the 'o+4
or#er a##ress &(tes #urin B'ash prorammin an# !erifi"ation%
Port 2
Port 2 is an .4&it &i4#ire"tiona' I6O port +ith interna' pu'' up0s% The port 2
output &uffers "an sin* 6sour"e four TTL inputs%
>hen 10s are +ritten to port 2 pins the( are pu''e# hih &( the interna' pu'' ups
an# "an &e use# as inputs% As inputs) port 2 pins that are eCterna''( &ein pu''e# 'o+
the sour"e "urrent &e"ause of interna' pu'' ups%
Port 2 emits the hiher or#er a##ress &(te #urin fet"hes from eCterna'
proram memor( an# #urin a""ess to eCterna' #ata memor( that use 1A4&it
a##resses% In this app'i"ation) it uses stron interna' pu'' ups +hen emittin 10s%Durin
a""esses to eCterna' #ata memor( that use .4&it a##resses%
Port 2 a'so re"ei!es the hih or#er a##ress &its an# some "ontro' sina's
#urin B'ash prorammin an# !erifi"ation%
Port 1
Port 8 is an .4&it &i4#ire"tiona' I6O port +ith interna' pu'' ups% The port 8
output &uffers "an sin*6sour"e four TTL inputs% >hen 10s are +ritten to port 8 pins
the( are pu''e# hih &( the interna' pu'' ups an# "an &e use# as inputs% As inputs) port
8 pins that are eCterna''( &ein pu''e# 'o+ +i'' sour"e "urrent &e"ause of pu'' ups%Port
8 a'so ser!es the fun"tions of !arious spe"ia' features of the AT.-C;1 as 'iste# &e'o+%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL -
Port 8 a'so re"ei!es some "ontro' sina's for B'ash prorammin an# proram
!erifi"ation%
T)+&e 21 Port 1 (e,cri.tio2
RST
Reset input3 A hih on this pin for t+o ma"hine "("'es +hi'e the os"i''ator is
runnin resets the #e!i"e%
ALE:PRO"
A##ress Lat"h Ena&'e output pu'se for 'at"hin the 'o+ &(te of the a##ress
#urin a""esses to eCterna' memor(% This pin is a'so the proram pu'se input 1PRO=2
#urin B'ash Prorammin% In norma' operation ALE is emitte# at a "onstant rate of
16A the os"i''ator( fre$uen"() an# ma( &e use# for eCterna' timin or "'o"*in
purposes%
One ALE Pu'se is s*ippe# #urin ea"h a""ess to eCterna' #ata memor(% If
#esire#) ALE operation "an &e #isa&'e# &( settin &it / of SBR 'o"ation .E<%>ith the
&it set) ALE is a"ti!e on'( #urin a MOHI or MOHC instru"tion% Other+ise) the pin
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 1/
is +ea*'( pu''e# hih% Settin the ALE4#isa&'e &it has no effe"t if the mi"ro"ontro''er
is in eCterna' eCe"ution mo#e%
PSE#
Proram Store Ena&'e is the rea# stro&e to eCterna' proram memor(% >hen
the AT .-C;1 is eCe"utin "o#e from eCterna' proram memor() PSE: is a"ti!ate#
t+i"e ea"h ma"hine "("'e) eC"ept that t+o PSE: a"ti!ations are s*ippe# #urin ea"h
a""ess to eCterna' #ata memor(%
EA:VPP
ECterna' A""ess Ena&'e3 EA must &e strappe# to =:D in or#er to ena&'e the
#e!i"e to fet"h "o#e from eCterna' proram memor( 'o"ations startin at ////< to
BBBB<%EA shou'# &e strappe# to HCC for interna' proram eCe"utions% This pin a'so
re"ei!es the 12 !o't prorammin ena&'e !o'tae 1HPP2 #urin B'ash Prorammin)
for ports that re$uire 12 !o't H""%
;TAL1
Input to the in!ertin os"i''ator amp'ifier an# input to the interna' "'o"*
operatin "ir"uit%
;TAL2
Output from the in!ertin os"i''ator amp'ifier%
T)+&e 22 Me*or< -,)%e

Use# Port :um&er ROM RAM I6O
pins
Timer Interrupt HCC Pa"*ain
At
User
Si#e
AT.-C;1 75 12. 82 2 A ;H 7/

Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 11


O,ci&&)tor C5)r)cteri,tic,
ITAL1 an# ITAL2 are the input an# output) respe"ti!e'() of an in!ertin
amp'ifier +hi"h "an &e "onfiure# for use as an on4"hip os"i''ator) as sho+n in Biure
1% Either a $uartF "r(sta' or "erami" resonator ma( &e use#% To #ri!e the #e!i"e from
an eCterna' "'o"* sour"e) ITAL2 shou'# &e 'eft un"onne"te# +hi'e ITAL1 is #ri!en%
There are no re$uirements on the #ut( "("'e of the eCterna' "'o"* sina') sin"e the
input to the interna' "'o"*in "ir"uitr( is throuh a #i!i#e4&(4t+o f'ip4f'op) &ut
minimum an# maCimum !o'tae hih an# 'o+ time spe"ifi"ations must &e o&ser!e#%
$i% 21 O,ci&&)tor Co22ectio2,
#ote0 "1) "2 J 8/ pB

1/ pB for "r(sta's
J7/pB 1/pB for "erami" Resonators
I(&e *o(e0
In i#'e mo#e) the CPU puts itse'f to s'eep +hi'e a'' the on "hip periphera's
remain a"ti!e% The mo#e is in!o*e# &( soft+are% The "ontent of the on4"hip RAM an#
a'' the spe"ifi" fun"tions reisters remain un"hane# #urin this mo#e% The i#'e mo#e
"an &e terminate# &( an( ena&'e# interrupt or &( a har#+are reset% It shou'# &e note#
that +hen i#'e is terminate# &( a har#+are reset) the #e!i"e norma''( resumes
proram eCe"ution) from +here it 'eft off) up to t+o ma"hine "("'es &efore the
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 12
interna' reset a'orithm ta*es "ontro'% On4"hip har#+are inhi&its a""ess to interna'
RAM in this e!ent) &ut a""ess to the port pins is not inhi&ite#% To e'iminate the
possi&i'it( of an uneCpe"te# +rite to a port pin +hen I#'e is terminate# &( reset) the
instru"tion fo''o+in the one that in!o*es I#'e shou'# not &e one that +rites to port
pin or to eCterna' memor(%
Power-(ow2 Mo(e
In the po+er G#o+n mo#e )the os"i''ator is stoppe# )an# the instru"tion
that in!o*es po+er G#o+n is the 'ast instru"tion eCe"ute# %The on4"hip RAM an#
Spe"ia' Bun"tion Reisters retain their !a'ues unti' the po+er G#o+n mo#e is
terminate#% The on'( eCit from po+er G#o+n is a har# +are reset %Rest re#efines the
SBRs &ut #oes not "hane the on4"hip RAM %The reset shou'# not &e a"ti!ate# &efore
HCC is restore# to its norma' operatin 'e!e' an# must &e he'# a"ti!e 'on enouh to
a''o+ the os"i''ator to restart an# sta&i'iFe%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 18
$i%0 2= i2ter2)& )rc5itect-re of 76C81 *icro co2tro&&er
$&)%, )2( t5e Pro%r)* St)t-, 4or( >PS4?
B'as ma( &e "on!enient'( a##resse#) the( are roupe# insi#e the proram
status +or# 1PS>2 an# the po+er "ontro' 1PCO:2 reisters% The .-C;1 has four math
f'as that respon# automati"a''( to the out"omes of math operations an# three enera'4
purpose user f'as that "an &e set to 1 or "'eare# to / &( the prorammer as #esire#%
The math f'as in"'u#e Carr( 1C2) AuCi'iar( Carr( 1AC2) O!erf'o+ 1OH2) an# Parit(
1P2% User f'as are name# B/) B/ an# =B1K the( are enera'4purpose f'as that ma( &e
use# &( the prorammer to re"or# some e!ent in the proram%
T)+&e21 $-2ctio2, of PS4
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 17
I2ter2)& Me*or<
The .-C;1 has interna' RAM an# ROM memor( for the fun"tions% A##itiona'
memor( "an &e a##e# eCterna''( usin suita&'e "ir"uits% This has a <ar#+are
ar"hite"ture) +hi"h uses the same a##ress) in #ifferent memories) for "o#e an# #ata%
I2ter2)& RAM
The 12.4&(te interna' RAM is oraniFe# into three #istin"t areas
Thirt( t+o &(tes from a##ress //< to 1B< that ma*e up 82 +or*in
reisters oraniFe# four &an*s of eiht reisters ea"h% The four reister
&an*s are num&ere# / to 8 an# are ma#e up of eiht reisters name# R/ to
R9% Ea"h reister "an &e a##resse# &( name or &( its RAM a##ress% Thus
R/ of &an* 8 is R/ 1if &an* 8 is "urrent'( se'e"te#2 or a##ress 1.<
1+hether &an* 8 is se'e"te# or not2% Bits RS/ an# RS1 in the PS>
#etermine +hi"h &an* of reisters is "urrent'( in use at an( time +hen the
proram is runnin% Reister &an*s not se'e"te# "an &e use# as a enera'4
purpose RAM% Ban*/ is se'e"te# on reset%
A &it a##ressa&'e area of 1A &(tes o""upies RAM &(te a##resses 2/< to
2B<) formin a tota' of 12. a##ressa&'e &its% An a##ressa&'e &it ma( &e
spe"ifie# &( its &it a##ress of //< to 9B<) or . &its ma( form an( &(te
a##ress form 2/< to 2B<%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 1;
A enera'4purpose RAM area a&o!e the &it area) from 8/< to 9B<)
a##ressa&'e as &(tes%
I#TER#AL RAM OR"A#ISATIO#
$i% 28 I2ter2)& RAM Or%)2i@)tio2
I2ter2)& ROM
The .-C;1 is oraniFe# so that #ata memor( an# proram "o#e memor( "an
&e in t+o entire'( #ifferent ph(si"a' memor( entities% Ea"h has the same a##ress
ranes% Proram a##resses hiher than /BBB<) +hi"h eC"ee#s the interna' ROM
"apa"it() +i'' "ause the .-C;1 to automati"a''( fet"h "o#e &(tes from eCterna'
proram memor(% Co#e &(tes "an a'so &e fet"he# eC"'usi!e'( from an eCterna'
memor( &( "onne"tin the eCterna' a""ess pin to roun#%

Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 1A
S.eci)& $-2ctio2 Re%i,ter >S$R? Me*or<
Spe"ia' Bun"tion Reisters 1SBRs2 are areas of memor( that "ontro' spe"ifi"
fun"tiona'it( of the .-C;1 pro"essor% Bor eCamp'e) four SBRs permit a""ess to the
.-C;10s 82 input6output 'ines% Another SBR a''o+s a proram to rea# or +rite to the
.-C;10s seria' port% Other SBRs a''o+ the user to set the seria' &au# rate) "ontro' an#
a""ess timers) an# "onfiure the .-C;10s interrupt s(stem%
S.eci)& f-2ctio2 re%i,ter,
SBRs are a""esse# as if the( +ere norma' Interna' RAM% The on'( #ifferen"e
is that Interna' RAM is from a##ress //< throuh 9B< +hereas SBR reisters eCist in
the a##ress rane of ./< throuh BB<% Ea"h SBR has an a##ress 1./< throuh BB<2
an# a name%
A'thouh the a##ress rane ./h throuh BB< offers 12. possi&'e a##resses)
there are on'( 21 SBRs in a stan#ar# .-;1% A'' other a##resses in the SBR rane 1./h
throuh BB<2 are "onsi#ere# in!a'i#% >ritin to or rea#in from these reisters ma(
pro#u"e un#efine# !a'ues or &eha!ior% The fo''o+in ta&'e 'ists the s(m&o's) names
an# a##resses of the .-C;1 SBR%
S$R De,cri.tio2
There are four I6O ports of . &its ea"h for a tota' of 82 I6O 'ines% The four ports
are "a''e# P/) P1) P2 an# P8%
SP >,t)c' .oi2ter?
This is the sta"* pointer of the mi"ro "ontro''er% This SBR in#i"ates +here the
neCt !a'ue to &e ta*en from the sta"* +i'' &e rea# from in Interna' RAM% Pushin a
!a'ue onto the sta"*) the !a'ue +i'' &e +ritten to the a##ress of SP L 1% That is to sa()
if SP ho'#s the !a'ue /9h) a PUS< instru"tion +i'' push the !a'ue onto the sta"* at
a##ress /.h% This SBR is mo#ifie# &( a'' instru"tions that mo#if( the sta"*) su"h as
PUS<) POP) an# LCALL) RET) RETI) an# +hene!er interrupts are pro!o*e# &( the
mi"ro "ontro''er% The SP SBR) on start up) is initia'iFe# to /9h% This means the sta"*
+i'' start at /.h an# start eCpan#in up+ar# in interna' RAM% Sin"e a'ternate reister
&ans 1) 2) an# 8 as +e'' as the user &it !aria&'es o""up( interna' RAM from a##resses
/.h throuh 2Bh) it is ne"essar( to initia'iFe SP in proram to some other !a'ue su"h
as 2B) usin the a'ternate reister &an*s an#6or &it memor(%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 19
DPL : DHL >D)t) .oi2ter &ow : 5i%5?
The SBRs DPL an# DP< +or* toether to represent a 1A4&it !a'ue "a''e# the
Data Pointer% The #ata pointer is use# in operations rear#in eCterna' RAM an# some
instru"tions in!o'!in "o#e memor(% Sin"e it is an unsine# t+o4&(te inteer !a'ue) it
"an represent !a'ues from ////< to BBBB< 1/ throuh A;);8; #e"ima'2% DPTR is
rea''( DP< an# DPL ta*en toether as a 1A4&it !a'ue% Bor eCamp'e) to push DPTR
onto the sta"* first push DPL an# then DP<% A##itiona''() there is an instru"tion to
Min"rement DPTR% On eCe"utin this instru"tion) the t+o &(tes are operate# upon as
a 1A4&it !a'ue% <o+e!er) there is no instru"tion to #e"rement DPTR%
PCO# >Power co2tro&?
The Po+er Contro' SBR is use# to "ontro' the .-C;10s po+er "ontro' mo#es%
Certain operation mo#es of the .-C;1 a''o+ the .-C;1 to o into a t(pe of Ms'eep
mo#e that re$uires mu"h 'ess po+er% These mo#es of operation are "ontro''e# throuh
PCO:% A##itiona''() one of the &its in PCO: is use# to #ou&'e the effe"ti!e &au# rate
of the .-C;10s seria' port%
TCO# >Ti*er co2tro&?
The Timer Contro' SBR is use# to "onfiure an# mo#if( the +a( in +hi"h the
.-C;10s t+o timers operate% This SBR "ontro's +hether ea"h of the t+o timers is
runnin or stoppe# an# "ontains a f'a to in#i"ate that ea"h timer has o!erf'o+e#%
A##itiona''() some non4timer re'ate# &its are 'o"ate# in the TCO: SBR% These &its are
use# to "onfiure the +a( in +hi"h the eCterna' interrupts are a"ti!ate#%
TMOD >Ti*er *o(e?
The Timer Mo#e SBR is use# to "onfiure the mo#e of operation of ea"h of
the t+o timers% Usin this SBR the proram ma( "onfiure ea"h timer to &e a 1A4&it
timer) an .4&it auto re'oa# timer) a 184&it timer) or t+o separate timers% A##itiona''()
the proram ma( "onfiure the timers to on'( "ount +hen an eCterna' pin is a"ti!ate#
or to "ount Me!ents that are in#i"ate# on an eCterna' pin%
TL9 : TH9 >Ti*er 9 &ow : 5i%5?
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 1.
These t+o SBRs) ta*en toether) represent timer /% Their eCa"t &eha!ior
#epen#s on ho+ the timer is "onfiure# in the TMOD SBRK ho+e!er) these timers
a'+a(s "ount up% In"rement in !a'ue is "onfiura&'e%
TL1 : TH1 >Ti*er 1 &ow : 5i%5?
These t+o SBRs) ta*en toether) represent timer 1% Their eCa"t &eha!ior
#epen#s on ho+ the timer is "onfiure# in the TMOD SBRK ho+e!er) these timers
a'+a(s "ount up% In"rement in !a'ue is "onfiura&'e%
SCO# >Seri)& co2tro&?
The Seria' Contro' SBR is use# to "onfiure the &eha!ior of the .-C;10s on4&oar#
seria' port% This SBR "ontro's the &au# rate of the seria' port) +hether the seria' port is
a"ti!ate# to re"ei!e #ata) an# a'so "ontains f'as that are set +hen a &(te is
su""essfu''( sent or re"ei!e#% To use the .-C;10s on4&oar# seria' port) it is enera''(
ne"essar( to initia'iFe the fo''o+in SBRs3 SCO:) TCO:) an# TMOD% This is
&e"ause SCO: "ontro's the seria' port% <o+e!er) in most "ases the proram +i'' +ish
to use one of the timers to esta&'ish the seria' port0s &au# rate% In this "ase) it is
ne"essar( to "onfiure timer 1 &( initia'iFin TCO: an# TMOD%
SBU$ >Seri)& co2tro&?
The Seria' Buffer SBR is use# to sen# an# re"ei!e #ata !ia the on4&oar# seria' port%
An( !a'ue +ritten to SBUB +i'' &e sent out the seria' port0s TID pin% Li*e+ise) an(
!a'ue) +hi"h the .-C;1 re"ei!e !ia the seria' port0s RID pin) +i'' &e #e'i!ere# to the
user proram !ia BUB% In other +or#s) +hen +ritten to SBUB ser!es as the output
port an# +hen rea# from as an input port%
IE >I2terr-.t e2)+&e?
The Interrupt Ena&'e SBR is use# to ena&'e an# #isa&'e spe"ifi" interrupts% The
'o+ 9 &its of the SBR are use# to ena&'e6#isa&'e the spe"ifi" interrupts) +here as the
hihest &it is use# to ena&'e or #isa&'e ALL interrupts% Thus) if the hih &it of IE is /
a'' interrupts are #isa&'e# rear#'ess of +hether an in#i!i#ua' interrupt is ena&'e# &(
settin a 'o+er &it%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 1-
T)+&e 2= $-2ctio2, of S.eci)& $-2ctio2 Re%i,ter,
IP >I2terr-.t .riorit<?
The Interrupt Priorit( SBR is use# to spe"if( the re'ati!e priorit( of ea"h
interrupt% On the .-C;1) an interrupt ma( either &e of 'o+ 1/2 priorit( or hih 112
priorit(% An interrupt) ma( on'( interrupt) interrupts of 'o+er priorit(% Bor eCamp'e)
"onfiure the .-C;1 so that a'' interrupts are of 'o+ priorit( eC"ept the seria'
interrupt) the seria' interrupt +i'' a'+a(s &e a&'e to interrupt the s(stem) e!en if
another interrupt is "urrent'( eCe"utin% <o+e!er) if a seria' interrupt is eCe"utin no
other interrupt +i'' &e a&'e to interrupt the seria' interrupt routine sin"e the seria'
interrupt routine has the hihest priorit(%
The .-C;1 operations that #o not use the interna' 12.4&(te RAM a##resses
from //< to 9B< are #one &( a roup of spe"ifi" interna' reisters) ea"h "a''e# a
Spe"ia' Bun"tion reister) +hi"h ma( &e a##resse# mu"h 'i*e interna' RAM) usin
a##resses from ./h to BB<% PC is not part of the SBR an# has no interna' RAM
a##ress%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 2/
CHAPTER 3 III
HARD4ARE DESCRIPTIO#
11 LIAUID CR/STAL DISPLA/ >LCD? OPERATIO#
In re"ent (ears LCD is fin#in +i#e sprea# use rep'a"in LEDs% This is
#ue to the fo''o+in reasons%
1% The #e"'inin pri"es of LCDs%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 21
2% The a&i'it( to #isp'a( num&ers) "hara"ters) an# raphi"s% This is in "ontrast to
LEDs) +hi"h are 'imite# num&ers an# a fe+ "hara"ters%
8% In "orporation of a refreshin "ontro''er into the LCD) there&( re'ie!in the CPU of
the tas* of refreshin the LCD% In "ontrast) the LED must &e refreshe# &( the CPU to
*eep #isp'a(in the #ata%
7% Ease of prorammin for "hara"ters an# raphi"s%
LCD .i2 (e,cri.tio2,0
The LCD #is"usse# in this se"tion has 17 pins%
VCCB VSSCVEE0
>hi'e H"" N Hss pro!i#e L;! N roun#) respe"ti!e'() Hee is use# for
"ontro''in LCD "ontrast%
RSB re%i,ter ,e&ect0
There are t+o !er( important reisters insi#e the LCD% The RS pin is use#
for their se"tion as fo''o+s3
If RSJ/) the instru"tion "omman# "o#e reister is se'e"te#) a''o+in the
user to sen# a "omman# su"h as "'ear #isp'a() "ursor at home et"%
If RSJ1) the #ata reister is se'e"te#) a''o+in the user to sen# #ata to &e
#isp'a(e# on the LCD%
R:4B re)(:write0
R6> input a''o+s the user to +rite the information to the LCD or rea#
information from it% R6>J1) +hen rea#inK R6>J/) +hen +riti
EB E2)+&e0
The ena&'e pin is use# &( the LCD to 'at"h information presente# to ea"h
#ata pins% >hen #ata is supp'ie# to #ata pins) a hih to 'o+ pu'se must &e app'ie# to
this pin in or#er for the LCD to 'at"h in the #ata present at #ata pins% This pu'se must
&e a minimum of 7;/ns +i#e%
D9-DD0
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 22
The .4&it #ata pins) D/4D9) are use# to sen# information to the LCD or to
rea# the "ontents of the LCD0s interna' reister%
To #isp'a( 'etters an# num&ers) +e sen# ASCII "o#es for the 'etters A4O)
a4F) an# num&er /4- to these pins +hi'e ma*in RSJ1% >e a'so use RSJ/ to "he"* the
&us( f'a &it to see if the LCD is rea#( to re"ei!e the information%
The &us( f'a is D9 an# "an &e rea# +hen R6>J1 an# RSJ/) as fo''o+s3
if R6>J1) RSJ/% >hen D9J1) the LCD is &us( ta*in "are of interna' operations an#
+i'' not a""ept an( ne+ information% >hen D9J/) the LCD is rea#( to re"ei!e
information%
It is re"ommen#e# to "he"* the &us( f'a &efore +ritin an( #ata to the
LCD%
LCD COMMA#D CODES0
T)+&e 18 LCD co**)2( co(e,
S1<EI2 Reister
1 C'ear the #isp'a( s"reen
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 28
2 Return home
7 De"rement "ursor
A In"rement "ursor
12 RELA/ DRIVER UL#2991
It is a 'inear mono'ithi" IC) +hi"h is use# to #ri!e the stepper motors) re'a(s)
'amps et"% :orma''( the output "urrent from the mi"ro "ontro''er is of 8/mA% So &(
usin this IC i%e%UL:2//8 +e "an &oost the "urrent sina' up to A//mA% So this IC
enerates re$uire# !o'taes%
De,cri.tio2
The UL:2//8 is hih4!o'tae) hih4"urrent Dar'inton #ri!ers "omprisin of
se!en :P: #ar'in ton pairs%
$e)t-re,
Output "urrent 1sin'e output2 ;//mA MAI
<ih sustainin !o'tae output ;/! MI:
Output "'amp #io#es
Input "ompati&'e +ith !arious t(pes of 'oi"%
A..&ic)tio2,
Re'a(s
<ammer
Lamps
Disp'a( 1LED2 #ri!ers%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 27
Pi2 Co2fi%-r)tio2 of UL#2991
$i% 1E Pi2 co2fi%-r)tio2 of UL#2991
Pi2 De,cri.tio2
The IC is of 1A4pin mono'ithi" 'inear IC% It has 9#ar'inton pairs interna''() of
9 inputs an# 9 outputs i%e%1 to 9 are inputs of Dar'inton pairs an# 1/ to 1A are the
outputs %.4pin is roun# an# -4pin is "ommon free +hee'in #io#e%
D)r&i2%to2 Tr)2,i,tor O.er)tio2
Bor hih input impe#an"e +e ma( use t+o transistors to form a Dar'inton pair%
This pair in CC "onfiuration pro!i#es input impe#an"e as hih as 2Mohms% The input
sina' !aries the &ase "urrent of the first transistor this pro#u"es !ariation in the
"o''e"tor "urrent in the first transistor% The emitter 'oa# of the first stae is the input
resistan"e of the se"on# stae% The emitter "urrent of the first transistor is the &ase
"urrent of the se"on# transistor%
$i%0 1D D)r&i2%to2 )*.&ifier,
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 2;
11 RELA/0
A re'a( is an e'e"tri"a''( operate# s+it"h% Current f'o+in throuh the "oi' of
the re'a( "reates a maneti" fie'# +hi"h attra"ts a 'e!er an# "hanes the s+it"h
"onta"ts the "oi' "urrent "an &e on or off) so re'a(s ha!e t+o s+it"h positions an# the(
are #ou&'e thro+ s+it"hes%
Re'a(s a''o+ one "ir"uit to s+it"h a se"on# "ir"uit +hi"h "an &e "omp'ete'(
separate from the first% Bor eCamp'e a 'o+ !o'tae &atter( "ir"uit "an use a re'a( to
s+it"h a 28/! a" mains "ir"uit% There is no e'e"tri"a''( "onne"tion insi#e the re'a(
&et+een the t+o "ir"uitsK the 'in* is maneti" an# me"hani"a'%
The "oi' of a re'a( passes re'ati!e'( 'are "urrent) t(pi"a''( 8/mA for a 12!
re'a() &ut it "an &e as mu"h as 1//mA for re'a(s #esine# to operate from 'o+er
!o'taes% Most "hips "annot pro!i#e this "urrent an# transistor% Usua''( use# to
amp'if( the sma'' IC "urrent to the 'arer !a'ue re$uire# for the re'a( "oi'% The
maCimum output "urrent for the popu'ar ;;;timer IC is 2//mA) so these #e!i"es "an
supp'( re'a( "oi's #ire"t'( +ithout amp'ifi"ations%
Re'a(s usua''( SPDT or DPDT &ut the( "an ha!e more sets of s+it"h
"onta"ts) for eCamp'e re'a(s +ith four sets of "hane o!er "onta"ts are rea#i'(
a!ai'a&'e%
Most re'a(s are #esine# for PCB mountin &ut (ou "an so'#er +ires
#ire"t'( to the pins pro!i#in (ou ta*e "are to a!oi# me'tin the p'asti" "ase of the
re'a(%
The supp'ier0s "ata'oue shou'# sho+ (ou re'a( "onne"tion% The "oi' +i'' &e
o&!ious an# it ma( &e "onne"te# either +a( roun#% Re'a( "oi's pro#u"e &rief hih
!o'tae spi*es% >hen the( are s+it"he# off an# this "an &e #estro(in transistors an#
IC0s in the "ir"uit% To pre!ent #amae) +e must "onne"t a prote"tion #io#e a"ross a
re'a( "oi'% The fiure sho+s a +or*in re'a( +ith its "oi' an# s+it"h "onta"ts% ?ou "an
see the 'e!er on the &ein attra"te# &( manetism +hen the "oi' is s+it"he# on% This
'e!er mo!es the s+it"hes "onta"ts%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 2A
$i% 17 Di)%r)* of re&)<
The re'a(0s s+it"h "onne"tions are usua''( 'a&e'e# COM) :C) an# :O3
COMF "ommon) a'+a(s "onne"t to thisK it is the mo!in part of the s+it"h%
#CJnorma''( "'ose#) COM is "onne"te# to this +hen re'a( is off%
#OJnorma''( open) COM is "onne"te# to this +hen re'a( is no%
Conne"t to COM an# :O if (ou +ant the s+it"he# "ir"uit to &e on +hen the
re'a( "oi' is on%
Conne"t to COM an# :C if (ou +ant the s+it"he# "ir"uit to &e on +hen the
re'a( "oi' is off%
C5oo,i2% ) Re&)<0
?ou nee# to "onsi#er se!era' features in "hoosin a re'a(%
1 P5<,ic)& ,i@e )2( .i2 )rr)2%e*e2t3
If (ou are "hoosin a re'a( for an eCistin PCB (ou +i'' nee# to ensures
that its #imension an# pin arranement are suita&'e%
2 Coi& vo&t)%e3
The re'a(s "oi' !o'tae ratin an# resistan"e must suite the "ir"uit po+erin
the re'a( "oi'% Man( re'a( "oi'% Man( re'a(s ha!e a "oi' rate# for a 12! supp'( &ut ;!
an# 12! re'a(s are rea#i'( a!ai'a&'e% Some re'a(s operate perfe"t'( +e'' +ith a supp'(
!o'tae +hi"h is 'itt'e 'o+er than rate# !a'ue%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 29
1 Coi& re,i,t)2ce3
The "ir"uit must &e a&'e to supp'( the "urrent re$uire# &( the re'a( "oi'% >e
"an use ohms 'a+ to "a'"u'ate3
Re'a( "oi' "urrent4 Supp'( !o'tae6 Coi' resistan"e
Bor eCamp'e3 A 12! supp'( re'a( +ith a "oi' resistan"e of 7//ohms passes a "urrent
of 8/ma% This is o* for ;;;timer IC 1maCimum output "urrent 2//ma2) &ut it is too
mu"h for most ICs an# the( +i'' re$uire a transistor to amp'if( the "urrent%
= Switc5 r)ti2%, >vo&t)%e )2( c-rre2t?0
The re'a(s s+it"h "onta"ts must &e suita&'e for the "ir"uit the( are to
"ontro'% >e +i'' nee# to "he"* the !o'tae an# "urrent ratins% :ote that the !o'tae
ratin is usua''( hiher for AC) for eCamp'e3 ;A AT 27HDC OR 12;H AC%
8 Switc5 co2t)ct, )rr)2%e*e2t >SPDTB DPDT etc?0
Most re'a(s are SPDT or DPDT +hi"h are often #es"ri&e# as0 sin'e po'e "haneo!er
1SPCO2 or #ou&'e po'e "haneo!er1DPCO2%
A(v)2t)%e, of re&)<,0
Re'a(s "an s+it"h AC an# CD) transistors "an on'( s+it"h CD%
Re'a(s "an s+it"h hih !o'taes) transistors "annot%
Re'a( are a &etter "hoi"e for s+it"hin 'are "urrents 1P;a2%
Re'a( "an s+it"h man( "onta"ts at on"e%
Di,)(v)2t)%e, of re&)<,0
Re'a(s are &u'*ier than transistors for s+it"hin sma'' "urrents%
Re'a(s "annot s+it"h rapi#'( 1eC"ept ree# re'a(s2) transistors "an s+it"h man(
times per se"on#% Re'a(s use more po+er #ue to the "urrent fo''o+in throuh
their "oi'% Re'a(s re$uire more "urrent than man( "hips "an pro!i#e) so a 'o+
po+er transistor ma( &e nee#e# to s+it"h the "urrent for the re'a(s "oi'%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 2.
1= PO4ER SUPPL/ U#IT
A'' e'e"troni" "ir"uits +or*s on'( in 'o+ DC !o'tae) so +e nee# a po+er
supp'( unit to pro!i#e the appropriate !o'tae supp'( for their proper fun"tionin
%This unit "onsists of transformer) re"tifier) fi'ter N reu'ator% AC !o'tae of t(pi"a''(
28/!o'ts rms is "onne"te# to a transformer !o'tae #o+n to the 'e!e' to the #esire#
a" !o'tae% A #io#e re"tifier that pro!i#es the fu'' +a!e re"tifie# !o'tae that is
initia''( fi'tere# &( a simp'e "apa"itor fi'ter to pro#u"e a #" !o'tae% This resu'tin #"
!o'tae usua''( has some ripp'e or a" !o'tae !ariation % A reu'ator "ir"uit "an use
this #" input to pro!i#e #" !o'tae that not on'( has mu"h 'ess ripp'e !o'tae &ut a'so
remains the same #" !a'ue e!en the #" !o'tae !aries some +hat) or the 'oa# "onne"te#
to the output #" !o'taes "hanes%
$i% 16 "e2er)& B&oc' of Power S-..&< U2it
Tr)2,for*er0
A transformer is a stati" pie"e of +hi"h e'e"tri" po+er in one "ir"uit is
transforme# into e'e"tri" po+er of same fre$uen"( in another "ir"uit% It "an raise or 'o+er
the !o'tae in the "ir"uit) &ut +ith a "orrespon#in #e"rease or in"rease in "urrent% It
+or*s +ith the prin"ip'e of mutua' in#u"tion% In our pro,e"t +e are usin a step #o+n
transformer to pro!i#in a ne"essar( supp'( for the e'e"troni" "ir"uits% <ere +e step #o+n
a 28/!o'ts a" into 12!o'ts a"%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 2-
Rectifier0
A #" 'e!e' o&taine# from a sinusoi#a' input "an &e impro!e# 1//Q usin a pro"ess
"a''e# fu'' +a!e re"tifi"ation% <ere in our pro,e"t for fu'' +a!e re"tifi"ation +e use &ri#e
re"tifier% Brom the &asi" &ri#e "onfiuration +e see that t+o #io#es1sa( D2 N D82 are
"on#u"tin +hi'e the other t+o #io#es 1D1 N D72 are in off state #urin the perio# t J /
to T62%A""or#in'( for the neati!e "("'e of the input the "on#u"tin #io#es are D1 N D7
%Thus the po'arit( a"ross the 'oa# is the same%
In the &ri#e re"tifier the #io#es ma( &e of !aria&'e t(pes 'i*e 1:7//1) 1:7//8)
1:7//7) 1:7//;) I:7//9 et"R "an &e use#% But here +e use 1:7//9) &e"ause it "an
+ithstan# up to 1///!%
$i&ter,0
In or#er to o&tain a #" !o'tae of / <F) +e ha!e to use a 'o+ pass fi'ter% So that a
"apa"iti!e fi'ter "ir"uit is use# +here a "apa"itor is "onne"te# at the re"tifier outputN a #"
is o&taine# a"ross it% The fi'tere# +a!eform is essentia''( a #" !o'tae +ith ne'ii&'e
ripp'es N it is u'timate'( fe# to the 'oa#%
Re%-&)tor,0
The output !o'tae from the "apa"itor is more fi'tere# N fina''( reu'ate#% The
!o'tae reu'ator is a #e!i"e) +hi"h maintains the output !o'tae "onstant irrespe"ti!e of
the "hane in supp'( !ariations) 'oa# !ariations N temperature "hanes%
<ere +e use fiCe# !o'tae reu'ator name'( LM9./;%The IC LM9./; is a L;!
reu'ator +hi"h is use# for mi"ro"ontro''er%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 8/
18 I2C PROTOCOL
The I2C &us has &een #e!e'ope# &( Phi'ips% The I2C &us +as #esine# to
intera"t +ithin sma'' no% of #e!i"es on a sin'e "ar#) su"h as to manae the tunin of
"ar ra#io or TH% It a''o+s interate# "ir"uits to "ommuni"ate #ire"t'( +ith ea"h other
!ia simp'e &i#ire"tiona' 24+ire &us%
I2C $e)t-re,3
On'( t+o &us 'ines are re$uire#3 seria' #ata 'ine 1SDA2 an# a seria'
"'o"* 'ine 1SCL2 %
Ea"h #e!i"e "onne"te# to the &us is soft+are a##ressa&'e &( a uni$ue
a##ress an# simp'e master6s'a!e re'ationships eCist at a'' times3 masters
"an operate as master4transmitters or as master re"ei!ers%
I2C is a true Mu'tiMate &us in"'u#in "o''ision #ete"tion an#
ar&itration to pre!ent #ata "orruption if t+o or more masters
simu'taneous'( initiate #ata transfer%
Seria' .4&it oriente#) &i#ire"tiona' #ata transfers "an &e ma#e at up to
1//*&it6s in the stan#ar# mo#e) up to 7//*&it6s in the Bast4mo#e) or up
to 8%7M&it6s in the <ih Gspee# mo#e%
On "hip fi'terin re,e"ts spi*es on the &us #ata 'ine to preser!e #ata
interit(%
The num&er of ICs that "an &e "onne"te# to the same &us sement is
'imite# on'( &( a maCimum &us "apa"iti!e 'oa#in of 7//pB%
S.ecific)tio2,0
. &it oriente# proto"o'
Mu'ti Master Bus%
E!er( #e!i"e has its o+n a##ress%
Master6S'a!e Operation%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 81
961/ &it A##ressin Mo#es%
APPLICATIO#S0

There are some spe"ifi" app'i"ations for "ertain t(pes of I2C #e!i"e su"h
as TH or ra#io tuners% A enera' purposes I2C #e!i"e "an &e use# in man( #ifferent
app'i"ations &e"ause of its simp'e "onstru"tion su"h as a host CPU on a main
em&e##e# &oar# usin I2C to "ommuni"ate +ith user interfa"e #e!i"es 'o"ate# on a
separate front pane' &oar#) an# SDRAM DIMMS +hi"h "an feature an I2C EEPROM
"ontainin parameters nee#e# to "orre"t'( "onfiure a memor( "ontro''er for that
mo#u'e%
E2( U,e Se%*e2t3
Te'e"om 3 Mo&i'e Phones) Base stations
Data pro"essin 3 PCs) Ser!ers
Instrumentation 3 Porta&'e Instrumentation ) Meterin s(stems
Automoti!e 3 Dash&oar#) Infotainment
Consumer 3 Au#io6Hi#eo s(stems) <ouseho'# e'e"troni"s
There are three mo#es of #ata transfer that "an &e a"hie!e# in I2C &us%
Stan#ar#4mo#e3 In this mo#e) #ata on the I2C &us "an &e transferre# at
rates of up to 1//*&it6s%
Bast4mo#e3 In this mo#e) #ata on the I2C &us "an &e transferre# at rates
of up to 7//*&it6s%
<ih4spee# mo#e 3 In this mo#e) #ata on the I2C &us "an &e Bit
Transferre# at rates of up to 8%7M&it6s
One "'o"* pu'se is enerate# for ea"h #ata &it transferre#%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 82
D)t) V)&i(it<0
The #ata on the SDA 'ine must &e sta&'e #urin the <I=< perio# of the
"'o"*% The <I=< or LO> state of the #ata 'ine "an on'( "hane +hen the
"'o"* sina' on the SCL 'ine is LO>%
START )2( STOP Co2(itio2,3

START co2(itio23 A <I=< to LO> transition on the SDA 'ine +hi'e SCL is
<I=< #efines START "on#ition%
STOP co2(itio23 A LO> to <I=< transition on the SDA 'ine +hi'e SCL is <I=<
#efines a STOP "on#ition%
START an# STOP "on#itions are a'+a(s enerate# &( the master% The &us is
"onsi#ere# to &e &us( after START "on#ition% The &us is "onsi#ere# to &e free aain a
"ertain time after STOP "on#ition% The &us sta(s &us( if a repeate# START 1Sr2 is
enerate# instea# of a STOP "on#ition%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 88
Tr)2,ferri2% DATA0
B/TE $ORMAT3 E!er( &(te put on the SDA 'ine must &e . &its 'on% The
num&er of &(tes that "an &e transmitte# per transfer is unrestri"te#% Ea"h &(te has to
&e fo''o+e# &( an a"*no+'e#e &it% Data is transferre# +ith most sinifi"ant &it
1MSB2 first% If a s'a!e "annot re"ei!e or transmit another "omp'ete &(te of #ata unti' it
has performe# some other fun"tion) for eCamp'e ser!i"in an interna' interrupt) it "an
ho'# the "'o"* 'ine SCL LO> to for"e the master into a +ait state% Data transfer then
"ontinues +hen the s'a!e is rea#( for another &(te of #ata an# re'eases "'o"* 'ine
SCL%
AC!#O4LED"E0
The A"*no+'e#e re'ate# "'o"* pu'se is enerate# &( the master% The
transmitter re'eases the SDA 'ine #urin the a"*no+'e#e "'o"* pu'se% The re"ei!er
must pu'' #o+n the SDA 'ine #urin the a"*no+'e#e "'o"* pu'se so that it remains
sta&'e LO> #urin the <I=< perio# of this "'o"* pu'se%
>hen a s'a!e #oesn0t a"*no+'e#e the s'a!e a##ress) the #ata 'ine must &e
'eft <I=< &( the s'a!e% The master "an then enerate either STOP "on#ition to a&ort
the transfer) or a repeate# START "on#ition to start a ne+ transfer%
1E REAL TIME CLOC! >DS119D?0
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 87
$EATURES
Rea'4time "'o"* 1RTC2 "ounts se"on#s) minutes) hours) #ate of the month) month)
#a( of the +ee*) an# (ear +ith 'eap4(ear "ompensation !a'i# up to 21//
S ;A4&(te) &atter(4&a"*e#) non!o'ati'e 1:H2 RAM for #ata storae
S T+o4+ire seria' interfa"e
S Proramma&'e s$uare +a!e output sina'
S Automati" po+er4fai' #ete"ts an# s+it"hes "ir"uitr(
S Consumes 'ess than ;//nA in &atter( &a"*up mo#e +ith os"i''ator runnin
S Optiona' in#ustria' temperature rane347/TC to L.;TC
S A!ai'a&'e in .4pin DIP or SOIC
S Un#er+riters La&orator( 1UL2 re"oniFe#
PI# ASSI"#ME#T0

$i%0 119 .i2 (i)%r)* of DS119D
PI# DESCRIPTIO#
HCC 4 Primar( Po+er Supp'(
I1 I 2 4 82%9A. *<F Cr(sta' Conne"tion
HBAT 4 L8H Batter( Input
=:D 4 =roun#
SDA 4 Seria' Data
SCL 4 Seria' C'o"*
SU>6OUT 4 S$uare >a!e6Output Dri!er
DESCRIPTIO#
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 8;
The DS18/9 Seria' Rea'4Time C'o"* is a 'o+4po+erK fu'' &inar(4"o#e#
#e"ima' 1BCD2 "'o"*6"a'en#ar p'us ;A &(tes of :H SRAM% A##ress an# #ata are
transferre# seria''( !ia a 24+ire) &i4#ire"tiona' &us% The "'o"*6"a'en#ar pro!i#es
se"on#s) minutes) hours) #a() #ate) month) an# (ear information% The en# of the
month #ate is automati"a''( a#,uste# for months +ith fe+er than 81 #a(s) in"'u#in
"orre"tions for 'eap (ear% The "'o"* operates in either the 274hour or 124hour format
+ith AM6PM in#i"ator% The DS18/9 has a &ui't4in po+er sense "ir"uit that #ete"ts
po+er fai'ures an# automati"a''( s+it"hes to the &atter( supp'(%
$i%0 111 ,c5e*)tic (i)%r)* of DS119D
OPERATIO#
The DS18/9 operates as a s'a!e #e!i"e on the seria' &us% A""ess is o&taine# &(
imp'ementin a START "on#ition an# pro!i#in a #e!i"e i#entifi"ation "o#e fo''o+e#
&( a reister a##ress% Su&se$uent reisters "an &e a""esse# se$uentia''( unti' a STOP
"on#ition is eCe"ute#% >hen HCC fa''s &e'o+ 1%2; C HBAT the #e!i"e terminates an
a""ess in proress an# resets the #e!i"e a##ress "ounter% Inputs to the #e!i"e +i'' not
&e re"oniFe# at this time to pre!ent erroneous #ata from &ein +ritten to the #e!i"e
from an out of to'eran"e s(stem% >hen HCC fa''s &e'o+ HBAT the #e!i"e s+it"hes
into a 'o+4"urrent &atter( &a"*up mo#e% Upon po+er4up) the #e!i"e s+it"hes from
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 8A
&atter( to HCC +hen HCC is reater than HBAT L /%2H an# re"oniFes inputs +hen
HCC is reater than 1%2; C HBAT%
SI"#AL DESCRIPTIO#S
VCCB "#D 3 DC po+er is pro!i#e# to the #e!i"e on these pins% HCC is the L;H
input% >hen ;H is app'ie# +ithin norma' 'imits) the #e!i"e is fu''( a""essi&'e an# #ata
"an &e +ritten an# rea#% >hen a 8H &atter( is "onne"te# to the #e!i"e an# HCC is
&e'o+ 1%2; C HBAT) rea#s an# +rites are inhi&ite#% <o+e!er) the time*eepin
fun"tion "ontinues unaffe"te# &( the 'o+er input !o'tae% As HCC fa''s &e'o+ HBAT
the RAM an# time*eeper are s+it"he# o!er to the eCterna' po+er supp'( 1nomina'
8%/H DC2 at HBAT%
VBAT 3 Batter( input for an( stan#ar# 8H 'ithium "e'' or other ener( sour"e%
Batter( !o'tae must &e he'# &et+een 2%/H an# 8%;H for proper operation% The
nomina' +rite prote"t trip point !o'tae at +hi"h a""ess to the RTC an# user RAM is
#enie# is set &( the interna' "ir"uitr( as 1%2; C HBAT nomina'% A 'ithium &atter( +ith
7.mAhr or reater +i'' &a"* up the DS18/9 for more than 1/ (ears in the a&sen"e of
po+er at 2;VC% UL re"oniFe# to ensure aainst re!erse "harin "urrent +hen use# in
"on,un"tion +ith a 'ithium &atter(%
SCL >Seri)& C&oc' I2.-t? 3 SCL is use# to s(n"hroniFe #ata mo!ement on the
seria' interfa"e%
SDA >Seri)& D)t) I2.-t:o-t.-t? 3 SDA is the input6output pin for the 24+ire
seria' interfa"e% The SDA pin is open #rain +hi"h re$uires an eCterna' pu''4up resistor%
SA4:OUT >SG-)re 4)ve:O-t.-t Driver? 3 >hen ena&'e#) the SU>E &it
set to 1) the SU>6OUT pin outputs one of four s$uare +a!e fre$uen"ies 11<F) 7*<F)
.*<F) 82*<F2% The SU>6OUT pin is open #rain an# re$uires an eCterna' pu''4up
resistor% SU>6OUT +i'' operate +ith either H"" or H&at app'ie#%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 89
;1B ;2 G Conne"tions for a stan#ar# 82%9A. *<F $uartF "r(sta'% The interna'
os"i''ator "ir"uitr( is #esine# for operation +ith a "r(sta' ha!in a spe"ifie# 'oa#
"apa"itan"e 1CL2 of 12%;pB% The DS18/9 "an a'so &e #ri!en &( an eCterna' 82%9A.
*<F os"i''ator% In this "onfiuration) the I1 pin is "onne"te# to the eCterna' os"i''ator
sina' an# the I2 pin is f'oate#%
CLOC! ACCURAC/
The a""ura"( of the "'o"* is #epen#ent upon the a""ura"( of the "r(sta' an#
the a""ura"( of the mat"h &et+een the "apa"iti!e 'oa# of the os"i''ator "ir"uit an# the
"apa"iti!e 'oa# for +hi"h the "r(sta' +as trimme#% A##itiona' error +i'' &e a##e# &(
"r(sta' fre$uen"( #rift "ause# &( temperature shifts% ECterna' "ir"uit noise "oup'e#
into the os"i''ator "ir"uit ma( resu't in the "'o"* runnin fast%
RTC A#D RAM ADDRESS MAP
The a##ress map for the RTC an# RAM reisters of the DS18/9 is sho+n in
Biure 2% The RTC reisters are 'o"ate# in a##ress 'o"ations //h to /9h% The RAM
reisters are 'o"ate# in a##ress 'o"ations /.h to 8Bh% Durin a mu'ti4&(te a""ess)
+hen the a##ress pointer rea"hes 8Bh) the en# of RAM spa"e) it +raps aroun# to
'o"ation //h) the &einnin of the "'o"* spa"e%
T)+&e 1E DS119D )((re,, *).
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 8.

CLOC! A#D CALE#DAR

The time an# "a'en#ar information is o&taine# &( rea#in the appropriate
reister &(tes% The RTC reisters are i''ustrate# in Biure 8% The time an# "a'en#ar are
set or initia'iFe# &( +ritin the appropriate reister &(tes% The "ontents of the time an#
"a'en#ar reisters are in the BCD format% Bit 9 of reister / is the "'o"* ha't 1C<2 &it%
>hen this &it is set to a 1) the os"i''ator is #isa&'e#% >hen "'eare# to a /) the os"i''ator
Therefore is ena&'e#%
P'ease note that the initia' po+er4on state of a'' reisters is not #efine#% It is
important to ena&'e the os"i''ator 1C< &it J /2 #urin initia' "onfiuration%
The DS18/9 "an &e run in either 124hour or 274hour mo#e% Bit A of the hours reister
is #efine# as the 124 or 274hour mo#e se'e"t &it% >hen hih) the 124hour mo#e is
se'e"te#% In the 124hour mo#e) &it ; is the AM6PM &it +ith 'oi" hih &ein PM% In
the 274hour mo#e) &it ; is the se"on# 1/ hour &it 12/4 28 hours2%
On a 24+ire START) the "urrent time is transferre# to a se"on# set of reisters% The
time information is rea# from these se"on#ar( reisters) +hi'e the "'o"* ma( "ontinue
to run% This e'iminates the nee# to rerea# the reisters in "ase of an up#ate of the main
reisters #urin a rea#%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 8-
CHAPTER-IV
SO$T 4ARE DESCRIPTIO#
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 7/
=1 !ie& ,oftw)re3

5ie' #e!e'ops) manufa"tures an# #istri&utes em&e##e# soft+are #e!e'opment
too's for ./;1) 2;1) ARM) an# IC1AC6C1AC6ST1/ mi"ro"ontro''er fami'ies% It
pro!i#es A:SIC Compi'ers) ma"ro assem&'ers) rea' time eCe"uti!es) #e&uers an#
simu'ators) interate# En!ironment an# e!a'uation &oar#s%
5ie' +as foun#e# in 1-.A to mar*et a## on pro#u"ts for the #e!e'opment too's
pro!i#e# &( man( of the si'i"on !en#ors% It soon &e"ame e!i#ent that there +as a !oi#
in the mar*et p'a"e that must fi''e# &( $ua'it( soft+are #e!e'opment too's% 5ie'
Imp'emente# the first C "ompi'er #esine# from the roun# up espe"ia''( for the ./;1
Mi"ro "ontro''er%
To#a() 5ie' pro!i#es a &roa# rane of #e!e'opment too's for the em&e##e#
s(stems mar*et p'a"e% Pro#u"ts in"'u#e A:SIC "ompi'ers) ma"ro assem&'ers)
#e&uers) 'in*ers) 'i&rar( manaers) an# rea' time operatin s(stems% Pro#u"ts su"h
as these ha!e he'pe# 5ie' &e"ome the +or'#0s 'ea#in #e!e'oper of em&e##e# s(stems
soft+are%
=2A,,e*+&< &)2%-)%e .ro%r)**i2%

>hen +e 'oo* at #ifferent t(pe of prorammin 'anuaes) +e ha!e to
un#erstan# the Mpa( me no+) pa( me 'ater ru'e that eCits +ith prorammin "osts%
Assem&'( 'anuae prorammin is enera''( the "heapest +a( to et into
mi"ro"ontro''er prorammin) &ut it is the most #iffi"u't to 'earn) re$uires the most
effort) an# is the 'east porta&'e to other p'atforms%
Con!erse'() usin a hih4'e!e' 'anuae 1su"h as BASIC or C2 "an ma*e it
mu"h easier for a &einner to proram a mi"ro"ontro''er) &ut it is most "ost'( option%
Co#e +ritten for a hih4'e!e' 'anuae is) &( #efinition) porta&'e to other p'atforms%
>here the Mpa( me no+) pa( me 'atter ru'e "omes into effe"t is if +e are
#e!e'opin ./;1 app'i"ations professiona''(% Spen#in time on assem&'( 'anuae
prorammin is pro&a&'( "ostin (ou mone( o!er #oin it in a hih4'e!e' 'anuae%
Bor 'earnin the ./;1 or Ma( other mi"ro"ontro''er or "omputer pro"essor)
assem&'( 'anuae is) as per the author opinion) the &est +a( of #oin it% Before oin
to an eCperiment) +e +i'' et a oo# fee'in for ho+ it +or*s%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 71
Assem&'( 'anuae prorammin is the pro"ess of +ritin "o#e that uses
assem&'er statement) +hi"h are the a"tua' instru"tions the ./;10s pro"essor eCe"utes
1the sma''est unit of ranu'arit(2%
A'on +ith assem&'er statement) #ire"ti!es are a##e# to the sour"e fi'e to
"ontro' the operation of the assem&'( pro"ess% Ma"ros an# "on#itiona' assem&'(
statements are t(pes of #ire"ti!es that "an he'p (ou #e!e'op "o# uni$ue to our
app'i"ation% Ma"ros are 'a&e's that are rep'a"e# +ith "o#eK the(0re simi'ar to
su&routines) eC"ept the su&routine "o#e "opie# #ire"t'( into the sour"e &efore the
assem&'( operation% Con#itiona' assem&'( statements are Mif6e'se6en# if statements
that eCe"ute #urin assem&'( an#) #epen#in on the "on#itions) not a''o+ "ertain
se"tions of "o#e to &e assem&'e#%
A "omp'ete# assem&'( 'anuae sour"e fi'e is assem&'e# into a 'istin fi'e
1sho+in ho+ the assem&'( proram "on!erte# the sour"e into &its for the pro"essor2
an# an o&,e"t) or heC) fi'e) +hi"h are the a"tua' &its an# &(tes to &e &urne# into the
./;1% Assem&'( 'anuae prorammin is the 'o+est form of3 Mhuman4rea#a&'e
sour"e "o#e pro"essin possi&'e% Interpreters an# "ompi'ers ta*e hih4'e!e' 'anuae
statements an# "on!ert them #ire"t'( into pro"essor instru"tions +ithout the
prorammer &ein in!o'!e#%
:o+) if +e are +e'' he'# an# #on0t +ant to #o the #ru#er( of assem&'(
'anuae prorammin) +e "ou'# &u( a "ompi.'er) &ut +e +i'' ne!er use the fu''
potentia' of the ./;1% *no+in an# &ein profi"ient in assem&'( 'anuae
prorammin +i'' a''o+ us to enhan"e our hih4'e!e' 'anuae app'i"ations &(
a''o+in us to a## "o#e that +i'' re#u"e the num&er of "("'es to eCe"ute) re#u"e of
&(tes re$uire# for the proram) or enhan"e the operation of the app'i"ations%
CHAPTER 3 V
SORURCE CODE
A&)r*0
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 72
Wmo#;2
K4444444444444444444444444444444444444444444444444444444444444444444444
Kpro,e"t 3 ./;1 =PB COLLE=E BELL47
Kpro"essor 3 .-s;2 X11%/;-2MhF)pp'%assem&'er)
Khar#+are K ./;1=PB1
Kf'o+ "hart 3
Ksoft+are 3 !er 1%2
KSTART DATE 3 1/1/2; 7pm
Ken#S#ate 3
Kremar*s 3 time a#,ust usin 2 s+it"hes) menu an# in"
Ksour"e 3 p& "o''ee &e''8
Kremar*s 3 Wrt" init)
K4444444444444444444444444444444444444444444444444444444444444444444444
Kport a''o"ation
&Fr e$u p1%/
*menu e$u p/%/
*in" e$u p/%1
RTCSCL5 EUU p8%;
RTCSIO EUU p8%7
REST EUU p8%8
RELA? e$u P8%1 K a"ti!e 'o+
K44444444444444444444444444444444444444444444444444444444444444444444444
K!e"tor ta&'e
K44444444444444444444444444444444444444444444444444444444444444444444444
or ////h
',mp LPO>ERSO: KPo+er O: Interrupt He"tor
or ///8h
reti
or ///&h
',mp TIMER/SISR KTimer / Interrupt He"tor
or //18h
reti
or //1&h
reti
or //28h
reti
K
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@XXXXXXXXXXX
K DELA? ROUTI:ES
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 78
K
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@XXXXXXXXXXX
#'(S83 mo! a)Y/8
S,mp #e'a(
#'(S2/3 mo! a) Y2/
#e'a(3 mo! H1mse"s)Y/ Ki6pJa1mse"s2) #estro(s4nothin
",ne a)H1mse"s)W
ret
#'(1//ms3 MOH HAR2)Y1-;
MOH HAR1)Y189
#'3 DZ:O HAR1)#'
DZ:O HAR2) #'
RET
#'(2//ms3 push a""
Mo! a)Y2
,mp #'(
#'(;//ms3 push a""
Mo! a)Y;
#'(3 mo! !1//mse"s)Y/
",ne a)H1//mse"s)W
pop a""
ret
#'(S1s3 MOH HAR8)Y8
MOH HAR2) Y91
MOH HAR1) Y9;
TT13 DZ:O HAR1) TT1
DZ:O HAR2) TT1
DZ:O HAR8)TT1
RET
#e'a(Sse"s3 push a"" K '# a""% +ith re$ se"s
mo! !1/mse"s)Y/
mo! !1//mse"s)Y/
mo! !se"s)Y/
",ne a)!se"s)W
pop a""
ret
K
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@XXXXXXXXXXX
LPO>ERSO:3
K
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@XXXXXXXXXXX
mo! sp) Ysta"*41
mo! TMOD)Y///1///1& KTimer /N13 1A4&it +ith no pres"a'er)t/4
Pfor 1ms Int%
mo! TCO:)Y///1////& Krun Timer /4stop T1
mo! IE)Y1///1/1/& Kena&'e Timer/ int%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 77
mo! IP)Y//////1/& Kpriorit( to Timer/ int%
mo! T</)Y5Timer/<i K!a'ues for 1ms interrupt
mo! TL/)Y5Timer/Lo
K44444444444444444444444444444444444444444444444444444444444444444444444
L*in"3
,n& *in")W
"a'' *#'(
,n& *in")W
mo! a)#isp#ata1
",ne a)YA/)[*in"r
mo! #isp#ata1)Y/
[*in"r3 in" #isp#ata1
mo! #ptr) YmStm
'"a'' #ispSmess1
mo! a)Y./hL/- K
'"a'' +r'"#"om7
'"a'' #ispS#iit
K44444444444444444444444444444444444444444444444444444444444444444444444
K up#ate rt" time
K44444444444444444444444444444444444444444444444444444444444444444444444
'"a'' enS+p
mo! rt"S#ata) #isp#ata1
,& Bhh)[fmm
mo! rt"S"omman#) Y+rhh
,mp *"ntn
[fmm3 ,& Bmm)[fss
mo! rt"S"omman#) Y+rmm
,mp *"ntn
[Bss3 mo! rt"S"omman#) Y+rse"
*"ntn3 '"a'' rt"S+riteSre
'"a'' a"*no+'e#e
,& *menu)L*in"
,n& *menu)W
ret
K44444444444444444444444444444444444444444444444444444444444444444444444
5#'(3 mo! rA)Y/ffh
'p13 mo! r7)Y/ffh
#,nF r7)W
#,nF rA)'p1
ret
K44444444444444444444444444444444444444444444444444444444444444444444444
"a'' in"rement
in" #isp#ata1
K44444444444444444444444444444444444444444444444444444444444444444444444
K"hane hours
K44444444444444444444444444444444444444444444444444444444444444444444444
Lmenu3 K,ump here +hen menu *e( presse#
mo! a)Y/C/hL/9 K
'"a'' +r'"#"om7
mo! a) Y/
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 7;
hhSin"3 ,& 5in")hhSmenu
"a'' *#'(
,n& *in")W
",ne a)Y28)in"hh
mo! a)Y2;;
in"hh3 '"a'' a"*no+'e#e
in" a
push a""
"a'' heC2&"#
'"a'' BCDSDISP K #isp'a( hours
mo! a)Y/C/hL/9 K
'"a'' +r'"#"om7
pop a""
,mp hhSin"
hhSmenu3 ,& 5menu)hhSin"
"a'' *#'(
,n& *menu)W
'"a'' enS+p
"a'' heC2&"#
mo! rt"S#ata) a
mo! rt"S"omman#) Y+rhh
'"a'' rt"S+riteSre
'"a'' a"*no+'e#e
K44444444444444444444444444444444444444444444444444444444444444444444444
K"hane minutes
K44444444444444444444444444444444444444444444444444444444444444444444444
mo! a)Y/C/hL1/ K
'"a'' +r'"#"om7
mo! a) Y/
mmSin"3 ,& 5in")mmSmenu
"a'' *#'(
,n& *in")W
",ne a)Y;-)in"mm
mo! a)Y2;;
in"mm3 '"a'' a"*no+'e#e
in" a
push a""
"a'' heC2&"#
'"a'' BCDSDISP K #isp'a( hours
mo! a)Y/C/hL1/ K
'"a'' +r'"#"om7
pop a""
,mp mmSin"
mmSmenu3 ,& 5menu)mmSin"
"a'' *#'(
,n& *menu)W
'"a'' enS+p
"a'' heC2&"#
mo! rt"S#ata) a
mo! rt"S"omman#) Y+rmin
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 7A
'"a'' rt"S+riteSre
'"a'' a"*no+'e#e
K44444444444444444444444444444444444444444444444444444444444444444444444
K"hane se"on#s
K44444444444444444444444444444444444444444444444444444444444444444444444
mo! a)Y/C/hL18 K
'"a'' +r'"#"om7
mo! a) Y/
ssSin"3 ,& 5in")ssSmenu
"a'' *#'(
,n& *in")W
",ne a)YA/)in"ss
mo! a)Y2;;
in"ss3 '"a'' a"*no+'e#e
in" a
push a""
"a'' heC2&"#
'"a'' BCDSDISP K #isp'a( hours
mo! a)Y/C/hL18 K
'"a'' +r'"#"om7
pop a""
,mp ssSin"
ssSmenu3 ,& 5menu)ssSin"
"a'' *#'(
,n& *menu)W
'"a'' enS+p
"a'' heC2&"#
mo! rt"S#ata) a
mo! rt"S"omman#) Y+rse"
'"a'' rt"S+riteSre
'"a'' a"*no+'e#e
ret
K\4444444444444444444444444444444444444444444444444444444444444444444444444444444444444
Lmain'p3
,& *menu)"ontSmain'p
,n& *menu)W
'"a'' a"*no+'e#e
"a'' Lmenu
"ontSmain'p3
L"a'' READSTIME
',mp pro"essS#& K "ompare time ta&'e
K"a'' #'(1//ms
,mp 'main'p
nCtS&e''3 "a'' statusS#isp
&#ata3 ,n& Bho'i#a()"mpSB#ata
mo! #ptr)YmSho'i#a(
mo! H#p')#p'
mo! H#ph)#ph
"'r BmessS#isp
s,mp 'main'p
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 79
K [entSpr3 a,mp enterSpro
K44444444444444444444444444444444444444444444444444444444444444444444444
a"*no+'e#e3
K44444444444444444444444444444444444444444444444444444444444444444444444
push a""
set& &Fr
L"a'' #'(;//ms
"'r &Fr
pop a""
ret
K44444444444444444444444444444444444444444444444444444444444444444444444
messaes3
K44444444444444444444444444444444444444444444444444444444444444444444444
mS13 #& ] COLLE=E BELL ])/ K/
mS23 #& ] init rt"%%% ])/ K/
K4444444444444444444444444444444444444444444444444444444444444444444444444444444444444
pro"essS#&3
K4444444444444444444444444444444444444444444444444444444444444444444444444444444444444
mo! #ptr)YBu''#a(S#ata
"ontSRtn3 "'r a
mo!" a) XaL#ptr
,F ,'main'p
",ne a)hours)S"a'SnCtSre"
in" #ptr
"'r a
mo!" a) XaL#ptr
",ne a)minutes)S"a'"SnCtSre"
in" #ptr
"'r a
mo!" a) XaL#ptr
mo! L&e''S#urn)a
in" #ptr
"'r a
mo!" a) XaL#ptr
mo! shortS&e''s)a
in" #ptr
"'r a
mo!" a) XaL#ptr
mo! HDph)a
in" #ptr
"'r a
ZLmain'p3 L,mp Lmain'p
Bu''#a(S#ata3
K hh mm '&# p%" #ph #p' messae
#& 1/h)//h)/.h)//h)/Dh)/EBh Kassem&'e
#& 1/h);/h)/.h)//h)/eh)//h Kpra(er start
#& 11h)7/h)/.h)//h)/fh).9h Kme#itation
#& 12h)8/h)/.h)//h)/eh)11h K1 pr#
#& 18h)//h)/.h)//h)/eh)22h K2 pr#
#& 18h)2/h)/.h)//h)/eh)/&&h Kshort &rea*
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 7.
#& 18h);/h)/.h)//h)/eh)/&&h Kshort &rea*
#& 17h)7/h)/.h)//h)/eh)88h K8 pr#
#& 1;h)8/h)/.h)//h)/eh)/""h K'un"h start
#& 1Ah)2/h)/.h)//h)/eh);;h K; pr#
#& //h Kreturn
E:D
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL 7-
CHAPTER-VI
$&ow c5)rt
3
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
START
Initia'iFe ports
Initia'iFe user !aria&'es
Initia'iFe s(stem !aria&'es
Initia'iFe LCD
Initia'iFe RTC
=ET RTC #ata
L main ' p
BELL ROUTI#E
IS set
time
JRTC
time
?
:
I2C BASED AUTOMATED PERIODIC BELL ;/
CHAPTER - VII
E;PERIME#TAL RESULTS
ECperimenta' *it) +hen the po+er supp'( is not "onne"te#%
$i% D1 EH.eri*e2t 'it
>hen the po+er is turne# on) the LCD automati"a''( #isp'a(s the time) #ate an# #a(
a""or#in to proram%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL ;1
$i% D2 EH.eri*e2t 'it )&o2% wit5 (i,.&)<
<ere) the &u'& is turne# O: a""or#in to the pre#efine# time%
$i%D1 eH.eri*e2t)&&< ,5ow2 wit5 +-&+
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL ;2
CO#CLUSIO# C $EATURE SCOPE
The MI2C +),e( )-to*)te( .erio(ic +e&& #esine# usin mi"ro
"ontro''er AT.-C;1 has foun# to &e usefu' in se!era' p'a"es for a""urate a'armin%
Perio#i"a''( rinin has &een a"hie!e# &( usin mo#ern te"hno'o( proto"o' "a''e#
I2C proto"o'%
In this) "ommuni"ation is su""essfu''( a"hie!e# &et+een master an#
s'a!e #e!i"e% Rep'a"in I2C proto"o' &( SM4&us) CA: an# other a#!an"e# proto"o's)
&etter a""urate resu'ts "an &e a"hie!e#%
Mi"ro"ontro''er0s fu'' "apa"it( "an &e uti'iFe# &( a##in more "ontro's to
the s(stem% The "apa"it( of num&er of s'a!es #epen#s up on the "ommuni"ation &us
nee#%
This pro,e"t "an &e eCten#e# &( ma*in the LCD to #isp'a( not on'( #ate)
#a() time) &ut a'so the perio# that is oin on at present) in s"hoo') "o''ees% This "an
a'so &e use# in "hur"hes) temp'es) in#ustries%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL ;8
BIBLIO"RAPH/
BOO!S0
The ./;1 mi"ro"ontro''er an# em&e##e# s(stems &( MAIIDI pu&'ishe# &(
Pe)r,o2 e(-c)tio2B i2c
E'e"troni"s an# Diita' "ir"uits &( SHALIVAHA#A) pu&'ishe# &( T)t)
Mc"r)w 5i&&
E'e"tri"a' an# E'e"troni" Measurements an# Instrumentation &(
A!SA4H#E/) pu&'ishe# &( D5)2.)t r)i C co &t(
4EBSITES0
1% +++%+i*ipe#ia%"om
2% +++%atme'%"om
8% +++%oo'e%"om
7% +++%en"("'ope#ia%"om
;% +++%phi'ips%"om
A% +++%i2"proto"o'#etai's%"om
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL ;7
APPE#DICES
AT76S82
B'ash Prorammin Mo#es
:otes3 1% Ea"h PRO= pu'se is 2// ns 4 ;// ns for Chip Erase%
2% Ea"h PRO= pu'se is 2// ns 4 ;// ns for >rite Co#e Data%
8% Ea"h PRO= pu'se is 2// ns 4 ;// ns for >rite Lo"* Bits%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL ;;
7% RD?6BS? sina' is output on P8%/ #urin prorammin% ;% I J #on0t "are%
Flash Programming and Verification Characteristics (Parallel
Mode)
TA = 20C to 30C, VCC = 4.5 to 5.5V
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL ;A
Figure15. Flash Programming and Verification a!eforms " Parallel #ode
Figure16. Flash #emor$ %erial &o'nloading
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL ;9
Flash Programming and Verification Waveforms erial Mode
Figure1!. %erial Programming a!eforms
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL ;.
DC C5)r)cteri,tic,
The !a'ues sho+n in this ta&'e are !a'i# for TA J 47/TC to .;TC an# HCC J 7%/H to
;%;H) un'ess other+ise note#%
:otes3 1% un#er stea#( state 1non4transient2 "on#itions) IOL must &e eCterna''( 'imite#
as fo''o+s3 MaCimum IOL per port
Pin3 1/ mAMaCimum IOL per .4&it port3
Port /3 2A mA Ports 1) 2) 83 1; mA
MaCimum tota' IOL for a'' output pins3 91 mA
If IOL eC"ee#s the test "on#ition) HOL ma( eC"ee# the re'ate# spe"ifi"ation% Pins are
not uarantee# to sin* "urrent reater
Than the 'iste# test "on#itions%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL ;-
2% Minimum HCC for Po+er4#o+n is 2H%
AC C5)r)cteri,tic,
Un#er operatin "on#itions) 'oa# "apa"itan"e for Port /) ALE6PRO=) an# PSE: J
1// pBK 'oa# "apa"itan"e for a'' other
Outputs J ./ pB%
"#ternal Program and $ata Memor% Characteristics
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL A/
"#ternal Program Memor% &ead C%cle
"#ternal $ata Memor% &ead C%cle
"#ternal $ata Memor% Write C%cle
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL A1
"#ternal Cloc' $rive Waveforms
"#ternal Cloc' $rive
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL A2
EHter2)& Pro%r)* )2( D)t) Me*or< C5)r)cteri,tic,
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL A8
P)c')%i2% I2for*)tio2

Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL A7
E&ectric)& c5)r)cteri,tic, of LD798 1refer to the test "ir"uits) TZ J 4;; to 1;/ TC) HI
J 1/ H) IO J ;// mA) CI J /%88 ^B) CO J /%1 ^B un'ess other+ise spe"ifie#2
1% Loa# an# 'ine reu'ation are spe"ifie# at "onstant ,un"tion temperature% Chanes in
HO #ue to heatin effe"ts must &e ta*en into a""ount separate'(% Pu'se testin +ith
'o+ #ut( "("'e is use#%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL A;
DS119D
()*+,-" M(./M,M &(-/012
Ho'tae on An( Pin Re'ati!e to =roun# 4/%;H to L9%/H
Storae Temperature 4;;TC to L12;TC
So'#erin Temperature 2A/TC for 1/ se"on#s DIP
See ZPC6ZEDEC Stan#ar# Z4
Surfa"e Mount De!i"es
@ This is a stress ratin on'( an# fun"tiona' operation of the #e!i"e at these or an(
other "on#itions a&o!e those in#i"ate# in the operation se"tions of this spe"ifi"ation is
not imp'ie#% ECposure to a&so'ute maCimum ratin "on#itions for eCten#e# perio#s of
time ma( affe"t re'ia&i'it(%
&"C*MM"0$"$ $C *P"&(-/01 C*0$/-/*0
()!er the o*erating range+,
@Un'ess other+ise spe"ifie#%
$C "+"C-&/C(+ C3(&(C-"&/-/C
()!er the o*erating range+,
@Un'ess other+ise spe"ifie#%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%
I2C BASED AUTOMATED PERIODIC BELL AA
(C "+"C-&/C(+ C3(&(C-"&/-/C
()!er the o*erating range+,
@Un'ess other+ise spe"ifie#%
0*-"4
1% ICCS spe"ifie# +ith HCC J ;%/H an# SDA) SCL J ;%/H%
2% HCC J /H) HBAT J 8H%
8% After this perio#) the first "'o"* pu'se is enerate#%
7% A #e!i"e must interna''( pro!i#e a ho'# time of at 'east 8//ns for the SDA sina'
1referre# to the HI<MI: of the SCL sina'2 in or#er to &ri#e the un#efine# reion of
the fa''in e#e of SCL%
;% The maCimum t<D3 DAT has on'( to &e met if the #e!i"e #oes not stret"h the LO>
perio# 1tLO>2 of the SCL sina'%
A% CB G Tota' "apa"itan"e of one &us 'ine in pB%
9% ICCA G SCL "'o"*in at maC fre$uen"( J 1// *<F%
.% HPB measure# at HBAT J 8%/H%
Department of ECE S%5%D Enineerin Co''ee) =OOT?%

You might also like