Sunteți pe pagina 1din 54

KARNATAKA STATE OPEN UNIVERSITY MANASA GANGOTHRI, MYSORE- 570006

TITLE OF THE PROJECT REPORT DOOR LOCKING SYSTEM BASED ON EMBEDDED PASSWARD
A PROJECT REPORT Submitted by

NAME OF THE CANDIDATE KUSUMA.R !" #LDEC0 "


Under the guidance of

G$%&' N()' KANNAN


I* +(,-%(. /$./%..)'*- 0/ -1' ,'2$%,')'*F0, -1' (3(,& 0/ -1' &'4,'' 0/ D%+.0)(

%n
ELECTRONICS AND COMMUNICATION ENGINEERING

S1(,(&( V%5(6 T,$6N0.!507 7 !, "*& /.00,. L(561)% 80)+.'9, 0-1 )(%* "7-1 8,066, !-1 :.085, J(;(*(4(,, B(*4(.0,'-

M0*-1 < Y'(, = JULY "0 #


[1]

KARNATAKA STATE OPEN UNIVERSITY MANASA GANGOTHRI, MYSORE- 570006

TITLE OF THE PROJECT REPORT DOOR LOCKING SYSTEM BASED ON EMBEDDED PASSWARD
A PROJECT REPORT Submitted by

NAME OF THE CANDIDATE KUSUMA.R !" #LDEC0 "


Under the guidance of

G$%&' N()' KANNAN


I* +(,-%(. /$./%..)'*- 0/ -1' ,'2$%,')'*F0, -1' (3(,& 0/ -1' &'4,'' 0/ D%+.0)(

%n
ELECTRONICS AND COMMUNICATION ENGINEERING

S1(,(&( V%5(6 T,$6N0.!507 7 !, "*& /.00,. L(561)% 80)+.'9, 0-1 )(%* "7-1 8,066, !-1 :.085, J(;(*(4(,, B(*4(.0,'-

M0*-1 < Y'(, = JULY "0 #


[2]

KARNATAKA STATE OPEN UNIVERSITY MANASA GANGOTHRI, MYSORE- 570006


CERTIFICATE

This is to certify that this ro!ect entit"e# $DOOR LOCKING SYSTEM BASED ON EMBEDDED PASSWARD% S&'(itte# 'y st&#ent na(e KUSUMA.R )ith Re*ister N0 !" #LDEC0 " is s&'(itte# on1+,-+2,1. to the KARNATAKA STATE OPEN UNIVERSITY/ 0arnata1a/ In#ia/ in artia" f&"fi""(ent of the re2&ire(ents for the a)ar# of D%+.0)( %* ELECTRONICS AND COMMUNICATION ENGINEERING is a recor# of 'onafie# )or1 &n#erta1en 'y her+hi(3 St&#ent Na(e4 0USUMA3R Si*nat&re4 Date4 1+,-+2,1 Interna" G&i#e Na(e4 Desi*nation4 Interna" G&i#e Si*nat&re4 Date4

St&#y Center Na(e4 Sea" of St&#y Centre Date4

E5terna" G&i#e Na(e4 Desi*nation4 E5terna" G&i#e Si*nat&re4 Date4

[.]

TABLE OF CONTENTS
1. ". #. !. ABSTRACT SCHEMATIC DIAGRAM CIRCUIT DESCRIPTION INTRODUCTION
6313 EM7EDDED S8STEMS 6323 MICROCONTROLLER AT9:;;2 63.3 LCD 6363 LED 63;3 0EIL SO<T=ARE 5.

COMPONENT DESCRIPTION OF
;313 DC MOTOR ;323 L2:.D ;3.3 0E8>AD ;363 IS> >ROGRAMMER

6. 7.

CODING REFERENCE
[6]

D'8.(,(-%0*
I certify that a3 The )or1 containe# in this re ort is ori*ina" an# has 'een #one 'y (e &n#er the *&i#ance of (y s& er?isor@sA3 '3 The )or1 has not 'een s&'(itte# to any other Instit&te for any #e*ree or #i "o(a3 c3 I ha?e fo""o)e# the *&i#e"ines ro?i#e# 'y the Instit&te in re arin* the re ort3 #3 I ha?e confor(e# to the nor(s an# *&i#e"ines *i?en in the Ethica" Co#e of Con#&ct of the Instit&te3 e3 =hene?er I ha?e &se# (ateria"s @#ata/ theoretica" ana"ysis/ fi*&res/ an# te5tA fro( other so&rces/ I ha?e *i?en #&e cre#it to the( 'y citin* the( in the te5t of the re ort an# *i?in* their #etai"s in the references3 <&rther/ I ha?e ta1en er(ission fro( the co yri*ht o)ners of the so&rces/ )hene?er necessary3

Si*nat&re of the St&#ent

[;]

A85*03.'&4' )'*-

[B]

A85*03.'&4')'*-

[-]

DOOR LOCK SYSTEM BASED ON EMBEDDED PASSWORD

[9]

TABLE OF CONTENTS
1. ". #. !. ABSTRACT SCHEMATIC DIAGRAM CIRCUIT DESCRIPTION INTRODUCTION
6313 EM7EDDED S8STEMS 6323 MICROCONTROLLER AT9:;;2 63.3 LCD 6363 LED 63;3 0EIL SO<T=ARE 5.

COMPONENT DESCRIPTION OF
;313 DC MOTOR ;323 L2:.D ;3.3 0E8>AD ;363 IS> >ROGRAMMER

6. >.

CODING REFERENCE

[:]

ABSTRACT
AIM=
This ro!ect is #escri'e# to #esi*n an# #e?e"o a #i*ita" co#e "oc1 &sin* (icro contro""er AT 9:s;2

DESCRIPTION=
Co(e+office sec&rity is to riority of a"" concerne#3 To#ay there are "enty of ho(e+office sec&rity ro#&cts to ens&re yo&r fa(i"yDs sec&rity co( "ete"y3 Co(e+office sec&rity is the (ost si*nificant one for e?ery ho(e+office o)ner either in an in#i?i#&a" ho&se or an a art(ent3 <or that #ifferent sec&rity syste(s are a?ai"a'"e3 Those are s(art car#s/ R<IDDs/ IE'&tton/ ass)or# an# 'io(etrics etc3 Access contro" is the a'i"ity to er(it or #eny the &se of a artic&"ar reso&rce 'y a artic&"ar entity3 Access contro" syste( can 'e &se# in (ana*in* hysica" reso&rces @s&ch as a (o?ie theater/ to )hich on"y tic1et ho"#ers sho&"# 'e a#(itte#A/ "o*ica" reso&rces @a 'an1 acco&nt/ )ith a "i(ite# n&('er of eo "e a&thoriFe# to (a1e a )ith#ra)a"A/ or #i*ita" reso&rces/ for these 1in#s of thin*s3 The (ain i#ea of #esi*nin* #i*ita" "oc1in* syste( is to ro?i#e (any (o#ern sec&rity feat&res than (echanica" "oc1G here 1ey a# is &se# to enter the ass)or#3 If that ass)or# (atches to the ass)or# that )as a"rea#y store# in f"ash of the contro""er then the #c (otor is acti?ate# an# the #oor )i"" 'e o ene#3 If it #oes not (atche# then the '&FFer is acti?ate#3 A "ications are entrance #oors/ car #oors/ 'an1 "oc1ers etc3

[1,]

BLOCK DIAGRAM=

LCD A T > @ S 5 "

KEYPAD

L"@#D

DOOR

RE?UIREMENTS= HARDWARE RE?UIREMENTS=


AT9:S;2 LCD DIS>LA8 7UHHER 0E8>AD

SOFTWARE RE?UIREMENTS4
0EIL C Co( i"er >ROGRAMMING IN EM7EDDED C
[11]

SCHEMATIC DIAGRAM

10K P& LL& P

R8 R7 R6 R5 R4 R3 R2 R1 C

1 2 3 4 VC C 1 2 3 4 $ 7 8 9 1 1 1 1 1 1 1 0 1 2 3 4 $ (T 2 ) P 1 .0 (T 2 ( X ) P 1 .1 P 1.2 P 1.3 P 1.4 (M O S I) P 1 . (M IS O ) P 1 .$ (S C K ) P 1 .7 R ST VC C ,A D 0 ,A D 1 ,A D 2 ,A D 3 ,A D 4 ,A D ,A D $ ,A D 7 ,V P P 4 3 3 3 3 3 3 3 3 3 0 9 8 7 $ 4 3 2 1 VC C 9 8 7 $ 4 3 2 1 VC C P P P P P P P P 0 .0 0 .1 0 .2 0 .3 0 .4 0. 0 .$ 0 .7 (A A 4 (L 2 9 3 D ) %& ' '(R A 3 (L 2 9 3 D ) F R O M IS P (1 0 ) F R O M IS P (2 ) F R O M IS P (4 ) F R O M IS P ($ )1 R S T

$ 7 8 9

C R1 R2 R3 R4 R5 R6 R7 R8

10K P& LL& P

R S (L C D ) ( D D D D N (L C 4 (L C (L C $ (L C 7 (L C D D D D D ) ) ) ) )

VC C VC C

GND
1 2 3 4 $ 7 8 9 10 11 12 13 14 1 1$ VC C

4.7 K

XTA L2 XTA L1

17 18 19 20

(R XD ) P 3 .0 (T XD ) P 3 .1 A L ( ,P R O G (IN T 0 ) P 3 .2 (IN T 1 ) P 3 .3 PS(N (T 0 ) P 3 .4 P 2 .7 ,A 1 (T 1 ) P 3 . (- R ) P 3 .$ P 2 .$ ,A 1 4 P 2 . ,A 1 3 (R D ) P 3 .7 P 2 .4 ,A 1 2 XTA L2 P 2 .3 ,A 1 1 P 2 .2 ,A 1 0 XTA L1 P 2 .1 ,A 9 G N D P 2 .0 ,A 8

30 29 28 2 2 2 2 2 2 2 7 $ 4 3 2 1 VC C

P 0 .1 G N D P 0 .3

K(!PAD

1 2 3 4 $ 7

K TR IM P O T P P P P 0 0 0 0 .4 . .$ .7

GND VCC VEE RS R# EN D$ D1 D2 D3 D4 D5 D6 D7


%ED+ %ED-

GND

GND

GND

LC D

AT89S 2

9 8 7 $

10K P& LL& P

4 3 2 1

C R1 R2 R3 R4 R5 R6 R7 R8
VC C % R ID G ( R ( C T IF I( R

780
2 1 2 3 0 V *A .C TRANSFORMER 2 + 4 1 V IN

R (G & L A TO R
VO & T 3

VC C )

V BUZZER 1K P 1 .2

"

GND 2
1 0 0 0 + f ,3 V 33pf 104pf 3

220 ./0

( V,1!AMP"

# %C 109

L(D

P O - (R S& P PL!( VD C )
GND GND

GND
VC C G N D S - IT C 2 33 pf 1 3 7 9 VC C 1 2 3 4 $ 7 8 VC C 1,2EN VCC1 A1 A4 Y1 Y4 GND GND GND GND Y2 Y3 A2 A3 VCC2 3,4EN 1 1 1 1 1 1 1 9 $ 4 3 2 1 0 P 1 .0 1 1 0 + f ,3 V

I S P

33 pf XTA L1

R ST

P1.

8 .2 K

GND

P1.

GND
2

GND

A T 8 9 S 2 IS P

AT89S 2 C R !STAL

GND

VC C

R (S(T

L293D

[12]

D C M O T O R

2 4 $ 8 10

P 1 .$ P 1 .7 R ST

XTA L2 1 1 .0 9 2 M 2 3

1 0 + f ,$ 3 V

CIRCUIT DESCRIPTION
DESIGNING=
Since the (ain intension of this ro!ect is to #esi*n a sec&rity Door "oc1s syste(3 In or#er to f&"fi"" this a has 'een erfor(e# i3e3 1A Desi*nin* the o)er s& "y for the entire circ&itry3 "ication3 "ication there are fe) ste s that

2A Se"ection of (icrocontro""er that s&its o&r a .A Se"ection 0ey a#3 6A Se"ection of DC (otor3

;A Se"ection of '&FFer accor#in* to the re2&ire(ent3 Co( "ete st&#ies of a"" the a'o?e oints are &sef&" to #e?e"o this ro!ect3

POWER SUPPLY SECTION=


InEor#er to )or1 )ith any co( onents 'asic re2&ire(ent is o)er s& "y3 In this section there is a re2&ire(ent of ;I o)er s& "y3

Transformers 4.56789 AC 7:7498;4;9< f8.0 .57 6.:9=>7 9. =5.9/78 ?;9/ :;99:7 :.@@ .f p.?78. T8=5@f.8078@ ?.8A .5:< ?;9/ AC =5B 9/;@ ;@ .57 .f 9/7 87=@.5@ ?/< 0=;5@ 7:7498;4;9< ;@ AC.
[1.]

S97p#+p 98=5@f.8078@ ;5487=@7 6.:9=>7* @97p#B.?5 98=5@f.8078@ 87B+47 6.:9=>7. M.@9 p.?78 @+pp:;7@ +@7 = @97p#B.?5 98=5@f.8078 9. 87B+47 9/7 B=5>78.+@:< /;>/ 0=;5@ 6.:9=>7 (230V ;5 &K) 9. = @=f78 :.? 6.:9=>7. A Bridge Rectifier 4=5 C7 0=B7 +@;5> f.+8 ;5B;6;B+=: B;.B7@* C+9 ;9 ;@ =:@. =6=;:=C:7 ;5 @p74;=: p=4A=>7@ 4.59=;5;5> 9/7 f.+8 B;.B7@ 87D+;87B. I9 ;@ 4=::7B = f+::#?=67 8749;f;78 C74=+@7 ;9 +@7@ =:: 9/7 AC ?=67 (C.9/ p.@;9;67 =5B 57>=9;67 @749;.5@

%< 9/7 electrolytic Capacitor 4.557497B =48.@@ 9/7 DC @+pp:< 9. =49 =@ = 87@786.;8* S0..9/;5> ;@ p78f.807B C< = :=8>7 6=:+7 @+pp:<;5> 4+88759 9. 9/7 .+9p+9 ?/75 9/7 6=8<;5> DC 6.:9=>7 f8.0 9/7 8749;f;78 ;@ f=::;5>

Regulator

[16]

V.:9=>7 87>+:=9.8 IC@ =87 =6=;:=C:7 ?;9/ f;E7B (9<p;4=::< * 12 =5B 1 V) .8 6=8;=C:7 .+9p+9 6.:9=>7@. T/7< =87 =:@. 8=97B C< 9/7 0=E;0+0 4+88759 9/7< 4=5 p=@@. N7>=9;67 6.:9=>7 87>+:=9.8@ =87 =6=;:=C:7*0=;5:< f.8 +@7 ;5 B+=: @+pp:;7@

SELECTION OF MICROCONTROLLER=
As )e 1no) that there so (any ty es of (icro contro""er fa(i"ies that are a?ai"a'"e in the (ar1et3 Those are 1A 9,;1 <a(i"y 2A AIR (icrocontro""er <a(i"y .A >IC (icrocontro""er <a(i"y 6A ARM <a(i"y 7asic 9,;1 fa(i"y is eno&*h for o&r a "icationG hence )e are not concentratin* on hi*her en# contro""er fa(i"ies37&t sti"" )e se"ecte# AT9:S;2 contro""er 'eca&se of in'&i"t IS> @in syste( ro*ra((erA o tion3 There are (ini(&( si5 re2&ire(ents for ro er o eration of (icrocontro""er3 Those are4 1A o)er s& "y section 2A &""E& s for orts @it is (&st for >ORT,A .A Reset circ&it 6A Crysta" circ&it ;A IS> circ&it @for ro*ra( #&( in*A
[1;]

BA EA+I>> in is connecte# to Icc3 >ORT, is o en co""ector thatDs )hy )e are &sin* &""E& resistor )hich (a1es >ORT, as an I+O ort3 Reset circ&it is &se# to reset the (icrocontro""er3 Crysta" circ&it is &se# for the (icrocontro""er for ti(in* "&ses3 In this ro!ect )e are not &sin* e5terna" (e(ory thatDs )hy EA+I>> in in the (icrocontro""er is connecte# to Icc that in#icates interna" (e(ory is &se# for this a "ication3

SELECTION OF KEYPAD=
In this ro!ect to enter the ass)or# I se"ecte# the 6J. 1ey a#3 There are (any 1ey a#Ds a?ai"a'"e in the (ar1et '&t for (y re2&ire(ent this 1ey a# eno&*h3

SELECTION OF DC MOTOR=
In (y ro!ect I se"ecte# DC ;I 26,, R>M DC (otor3 7eca&se (y har#)are 1it is )or1in* )ith ; ?o"ts DC

CIRCUIT OPERATION=
Cere after *i?in* the o)er s& "y it )i"" #is "ay to o en the #oor or to c"ose the #oor to c"ose the #oor )e ha?e to ress the KLD an# for o enin* the #oor KMD has to resse#3 >ro*ra( )i"" not contin&e ti"" )e ress KLD or DMD3after that it )i"" as1 to enter the ass)or# an# instea# of #is "ayin* the ass)or# )e are #is "ayin* KLD on the LCD3 If ass)or# is (atche# accor#in* to the co((an# #oor )i"" o en+c"ose3 <or o enin* an# c"osin* the #oor in this ro!ect )e connecte# DC (otors an# )e are rotatin* for)ar# #irection for o enin* the #oor an# re?erse #irection for c"osin* the #oor3 If ass)or# not (atche# '&FFer )i"" start 3This rocess )i"" contin&e 3Cere in

[1B]

this ro!ect )e 1e t ass)or# as 1B, )e can chan*e it thro&*h ro*ra( an# chan*e# ro*ra( )e ha?e to #&( it in to the (icrocontro""er3

EMBEDDED SYSTEMS

E('e##e# syste(s are e"ectronic #e?ices that incor orate (icro rocessors )ith in their i( "e(entations3 The (ain &r oses of the (icro rocessors are to si( "ify the syste( #esi*n an# ro?i#e f"e5i'i"ity3 Ca?in* a (icro rocessor in the #e?ice he" s in re(o?in* the '&*s/ (a1in* (o#ifications/ or a##in* ne) feat&res are on"y (atter of re)ritin* the soft)are that contro"s the #e?ice3 Or in other )or#s e('e##e# co( &ter syste(s are e"ectronic syste(s that inc"&#e a (icroco( &ter to erfor( a s ecific #e#icate# a "ication3 The co( &ter is hi##en insi#e these ro#&cts3 E('e##e# syste(s are &'i2&ito&s3 E('e##e# syste(s #esi*ners &s&a""y ha?e a si*nificant *ras of har#)are techno"o*ies3 They &se s ecific ro*ra((in* "an*&a*es an# soft)are to #e?e"o e('e##e# syste(s an# (ani &"ate the e2&i (ent3

CHARACTERISTICS=
T)o (a!or areas of #ifferences are cost an# o)er cons&( tion3 Since (any e('e##e# syste(s are ro#&ce# in tens of tho&san#s to (i""ions of &nits ran*e/ re#&cin* cost is a (a!or concern3 E('e##e# syste(s often

[1-]

&se a @re"ati?e"yA s"o) rocessor an# s(a"" (e(ory siFe to (ini(iFe costs3

PLATFORM=
There are (any #ifferent C>U architect&res &se# in e('e##e# #esi*ns3 This in contrast to the #es1to co( &ter (ar1et )hich is "i(ite# to !&st a fe) co( etin* architect&res (ain"y the Inte"+AMD 59B an# the A "e+Motoro"a+I7M >o)er >CDs )hich are &se# in the A "e Macintosh3 One co((on confi*&ration for e('e##e# syste(s is the syste( on a chi / an a "icationEs ecific inte*rate# circ&it/ for )hich the C>U )as &rchase# as inte""ect&a" ro erty to a## to the ICNs #esi*n3

OPERATING SYSTEM=
They often ha?e no o eratin* syste(/ or a s ecia"iFe# e('e##e# o eratin* syste( @often a rea"Eti(e o eratin* syste(A/ or the ro*ra((er is assi*ne# to ort one of these to the ne) syste(3

DEBUGGING=
De'&**in* is &s&a""y erfor(e# )ith an inEcirc&it e(&"ator/ or so(e ty e of #e'&**er that can interr& t the (icro contro""erDs interna" (icroco#e3 The (icroco#e interr& t "ets the #e'&**er o erate in har#)are in )hich on"y the C>U )or1s3 The C>UE'ase# #e'&**er can 'e &se# to test an# #e'&* the e"ectronics of the co( &ter fro( the ?ie) oint of the C>U3

DESIGN OF EMBEDDED SYSTEMS=


The e"ectronics &s&a""y &ses either a (icro rocessor or a (icrocontro""er3 So(e "ar*e or o"# syste(s &se *enera"E &r ose (ainfra(es co( &ters or (inico( &ters3
[19]

START-UP=
A"" e('e##e# syste(s ha?e startE& interr& ts/ sets & soft)areA/ an# then starts the a co#e3 Us&a""y it #isa'"es the e"ectronics/ tests the co( &ter @RAM/ C>U an# "ication co#e3 Many e('e##e# syste(s

reco?er fro( shortEter( o)er fai"&res 'y restartin* @)itho&t recent se"fE testsA3 Restart ti(es &n#er a tenth of a secon# are co((on3Many #esi*ners ha?e fo&n# one of (ore har#)are "&s soft)areEcontro""e# LEDDs &sef&" to in#icate errors #&rin* #e?e"o (ent @an# in so(e instances/ after ro#&ct re"ease/ to ro#&ce tro&'"eshootin* #ia*nosticsA3

THE CONTROL LOOP=


In this #esi*n/ the soft)are has a "oo 3 The "oo ca""s s&'ro&tines3 Each s&'ro&tine (ana*es a art of the har#)are or soft)are3 Interr& ts *enera""y set f"a*s/ or & #ate co&nters that are rea# 'y the rest of the soft)are3 A si( "e A>I #isa'"es an# ena'"es interr& ts3 Done ri*ht/ it han#"es neste# ca""s in neste# s&'ro&tines/ an# restores the of creatin* an e5ocrine3 One (a!or #isa#?anta*e of this syste( is that it #oes not *&arantee a ti(e to res on# to any artic&"ar har#)are e?ent3 Caref&" co#in* can easi"y ass&re that nothin* #isa'"es interr& ts for "on*3 Th&s interr& t co#e can r&n at ?ery recise ti(in*s3 Another (a!or )ea1ness of this syste( is that it can 'eco(e co( "e5 to a## ne) feat&res3 A"*orith(s that ta1e a "on* ti(e to r&n (&st 'e caref&""y 'ro1en #o)n so on"y a "itt"e iece *ets #one each ti(e thro&*h the (ain "oo 3 rece#in* interr& t state in the o&ter(ost ena'"e3 This is one of the si( "est (etho#s

[1:]

USER INTERFACES=
Interface #esi*ners at >ARC/ A "e Co( &ter/ 7oein* an# C> (ini(iFe the n&('er of ty es of &ser actions3 <or e5a( "e/ &se t)o '&ttons @the a'so"&te (ini(&(A to contro" a (en& syste( @!&st to 'e c"ear/ one '&tton sho&"# 'e One5t (en& entryO the other '&tton sho&"# 'e Ose"ect this (en& entryOA3 A to&chEscreen or screenEe#*e '&ttons a"so (ini(iFe the ty es of &ser actions3

MICROCONTROLLER 89S52
Microcontro""ers as the na(e s&**ests are s(a"" contro""ers3 They are "i1e sin*"e chi co( &ters that are often e('e##e# into other syste(s to f&nction as rocessin*+contro""in* &nit3 <or e5a( "e the re(ote contro" yo& are &sin* ro'a'"y has (icrocontro""ers insi#e that #o #eco#in* an# other contro""in* f&nctions3 They are a"so &se# in a&to(o'i"es/ )ashin* (achines/ (icro)a?e o?ens/ toys 333 etc/ )here a&to(ation is nee#e#3

FEATURES=
Co( ati'"e )ith MCSPE;1 >ro#&cts 90 7ytes of InESyste( >ro*ra((a'"e @IS>A <"ash Me(ory EEn#&rance4 1,,, =rite+Erase Cyc"es 63,I to ;3;I O eratin* Ran*e <&""y Static O eration4 , CF to .. MCF ThreeE"e?e" >ro*ra( Me(ory Loc1 2;B 5 9E'it Interna" RAM
[2,]

.2 >ro*ra((a'"e I+O Lines Three 1BE'it Ti(er+Co&nters Ei*ht Interr& t So&rces <&"" D& "e5 UART Seria" Channe"

DESCRIPTION=
The AT9:S;2 is a "o)E o)er/ hi*hE erfor(ance CMOS 9E'it (icrocontro""er )ith 90 'ytes of inEsyste( ro*ra((a'"e <"ash (e(ory3 The #e?ice is (an&fact&re# &sin* At(e"Ds hi*hE#ensity non?o"ati"e (e(ory techno"o*y an# is co( ati'"e )ith the in#&stryEstan#ar# 9,C;1 instr&ction set an# ino&t3 The onEchi <"ash a""o)s the ro*ra( (e(ory to 'e re ro*ra((e# inEsyste( or 'y a con?entiona" non?o"ati"e (e(ory ro*ra((er3 7y co('inin* a ?ersati"e 9E'it C>U )ith inEsyste( ro*ra((a'"e <"ash on a (ono"ithic chi / the At(e" 9:S;2 is a o)erf&" (icrocontro""er )hich ro?i#es a hi*h"yEf"e5i'"e an# costEeffecti?e so"&tion to (any e('e##e# contro" a "ications3 The AT9:S;2 ro?i#es the fo""o)in* stan#ar# feat&res4 90 'ytes of <"ash/ 2;B 'ytes of RAM/ .2 I+O "ines/ =atch#o* ti(er/ t)o #ata ointers/ three 1BE'it ti(er+co&nters/ a si5E ?ector t)oE"e?e" interr& t architect&re/ a f&"" #& "e5 seria" osci""ator/ an# c"oc1 circ&itry ort/ onEchi

[21]

PIN CONFIGURATION !0-.'(& PDIP=

[22]

ARCHITECTURE=

PIN DESCRIPTION= VCC=


S& "y ?o"ta*e3

GND=
Gro&n#3
[2.]

P0,- 0=
>ort , is an 9E'it o en #rain 'i#irectiona" I+O ort3 As an o&t &t ort/ each in can sin1 ei*ht TTL in &ts3 =hen 1s are )ritten to ort , ins/ the ins can 'e &se# as hi*hEi( e#ance in &ts3 >ort , can a"so 'e confi*&re# to 'e the (&"ti "e5e# "o)Eor#er a##ress+#ata '&s #&rin* accesses to e5terna" ro*ra( an# #ata (e(ory3 In this (o#e/ >, has interna" &""E& s3

P0,- =
>ort 1 is an 9E'it 'i#irectiona" I+O ort )ith interna" &""E& s3 The >ort 1 o&t &t '&ffers can sin1+so&rce fo&r TTL in &ts3 In a##ition/ >13, an# >131 can 'e confi*&re# to 'e the ti(er+co&nter 2 e5terna" co&nt in &t @>13,+T2A an# the ti(er+co&nter 2 tri**er in &t @>131+T2EJA/ res ecti?e"y/ as sho)n in the fo""o)in* ta'"e3 P0,- P%*
>13, >131 >13; >13B >13-

A.-',*(-' F$*8-%0*6
T2@e5terna" co&nt to Ti(er+Co&nter 2A/ c"oc1Eo&t T2EJ@Ti(er+Co&nter 2 ca t&re+re"oa# tri**er an# #irection contro"A MOSI @&se# for InESyste( >ro*ra((in*A MISO@&se# for InESyste( >ro*ra((in*A SC0@&se# for InESyste( >ro*ra((in*A

P0,- "=
>ort 2 is an 9E'it 'i#irectiona" I+O ort )ith interna" &""E& s3 The >ort 2 o&t &t '&ffers can sin1+so&rce fo&r TTL in &ts3 =hen 1s are )ritten to >ort 2 ins/ they are &""e# hi*h 'y the interna" &""E& s an# can 'e &se# as in &ts3 As in &ts/ >ort 2 ins that are e5terna""y 'ein* &""e# "o) )i"" so&rce c&rrent @IILA 'eca&se of the interna" &""E& s3

P0,- #=
>ort . is an 9E'it 'i#irectiona" I+O ort )ith interna" &""E& s3 The >ort . o&t &t '&ffers can sin1+so&rce fo&r TTL in &ts3 >ort . a"so
[26]

ser?es the f&nctions of ?ario&s s ecia" feat&res of the AT9:S;2/ as sho)n in the fo""o)in* ta'"e3 P0,- P%*
>.3, >.31 >.32 >.3. >.36 >.3; >.3B >.3-

A.-',*(-' F$*8-%0*6
RJD @seria" In &t ortA TJD @seria" o&t &t ortA INT, 'ar @e5terna" Interr& t ,A INT1 'ar @e5terna" Interr& t 1A T, @ti(er , e5terna" In &tA T1 @ti(er 1 e5terna" in &tA =R 'ar @e5terna" #ata (e(ory )rite stro'eA RD 'ar @e5terna" #ata (e(ory rea# stro'eA

RST=
Reset in &t3 A hi*h on this in for t)o (achine cyc"es )hi"e the osci""ator is r&nnin* resets the #e?ice3 This in #ri?es hi*h for :9 osci""ator erio#s after the =atch#o* ti(es o&t3 The DISRTO 'it in S<R AUJR @a##ress 9ECA can 'e &se# to #isa'"e this feat&re3 In the #efa&"t state of 'it DISRTO/ the RESET CIGC o&t feat&re is ena'"e#3 A##ress Latch Ena'"e @ALEA is an o&t &t &"se for "atchin* the "o) 'yte of the a##ress #&rin* accesses to e5terna" (e(ory3 This in is a"so the ro*ra( &"se in &t @>ROG 'arA #&rin* <"ash ro*ra((in*3

ATAL =
In &t to the in?ertin* osci""ator a( "ifier an# in &t to the interna" c"oc1 o eratin* circ&it3

[2;]

ATAL"=
O&t &t fro( the in?ertin* osci""ator a( "ifier

LIQUID CRYSTAL DISPLAY (LCD)


A .%2$%& 8,;6-(. &%6+.(; @LCDA is a thin/ f"at ane" &se# for e"ectronica""y #is "ayin* infor(ation s&ch as te5t/ i(a*es/ an# (o?in* ict&res3 Its &ses inc"&#e (onitors for co( &ters/ te"e?isions/ "ayers/ *a(in* #e?ices/ instr&(ent ane"s/ an# other #e?ices ran*in* fro( aircraft coc1 it #is "ays/ to e?eryE#ay cons&(er #e?ices s&ch as ?i#eo c"oc1s/ )atches/ ca"c&"ators/ an# te"e hones3 A(on* its (a!or feat&res are its "i*ht)ei*ht constr&ction/ its orta'i"ity/ an# its a'i"ity to 'e ro#&ce# in (&ch "ar*er screen siFes than are ractica" for the constr&ction of catho#e ray t&'e @CRTA #is "ay techno"o*y PIN DESCRIPTION=

[2B]

PIN DESCRIPTION=
PIN 1 2 . 6 ; B 9 : 1, 11 SYMBOL ISS ICC IEE RS R+= EN D7, D71 D72 D7. D76 I7O EE EE EE I I I+O I+O I+O I+O I+O I+O [2-] DESCRIPTION Gro&n# Q;I o)er s& "y >o)er s& "y to contro" contrast RSR, to se"ect co((an# re*ister RSR1 to se"ect #ata re*ister R+=R, for )rite R+=R1 for rea# Ena'"e The 9E'it #ata '&s The 9E'it #ata '&s The 9E'it #ata '&s The 9E'it #ata '&s The 9E'it #ata '&s

12 1. 16

D7; D7B D7-

I+O I+O I+O

The 9E'it #ata '&s The 9E'it #ata '&s The 9E'it #ata '&s

V88, V66 (*& V''=


=hi"e ICC an# ISS ro?i#e Q;I an# *ro&n# res ecti?e"y/ IEE is &se# for contro""in* LCD contrast3

RS BREGISTER SELECTC=
There are t)o i( ortant re*isters insi#e the LCD3 =hen RS is "o) @,A/ the #ata is to 'e treate# as a co((an# or s ecia" instr&ction @s&ch as c"ear screen/ osition c&rsor/ etc3A3 =hen RS is hi*h @1A/ the #ata that is sent is a te5t #ata )hich sho&"# 'e #is "aye# on the screen3 <or e5a( "e/ to #is "ay the "etter OTO on the screen yo& )o&"# set RS hi*h3

RW BREAD7WRITEC=

The RW "ine is the ORea#+=riteO contro" "ine3

=hen R= is "o) @,A/ the infor(ation on the #ata '&s is 'ein* )ritten to the LCD3 =hen R= is hi*h @1A/ the ro*ra( is effecti?e"y 2&eryin* @or rea#in*A the LCD3 On"y one instr&ction @OGet LCD stat&sOA is a rea# co((an#3 A"" others are )rite co((an#s/ so R= )i"" a"(ost 'e "o)3

EN BENABLEC=

The EN "ine is ca""e# OEna'"eO3 This contro" "ine is &se# to te"" the LCD that yo& are sen#in* it #ata3 To sen# #ata to the LCD/ yo&r ro*ra( sho&"# first set this "ine hi*h @1A an# then set the other t)o contro" "ines an#+or &t #ata on the #ata '&s3

D0-D7 BDATA LINESC=

The 9E'it #ata ins/ D,ED- are &se# to sen#

infor(ation to the LCD or rea# the content of the LCDDs interna" re*isters3 To #is "ay "etters an# n&('ers/ )e sen# ASCII co#es for the "etters AEH/ aEF an# n&('ers ,E: to these ins )hi"e (a1in* RSR13 There are a"so instr&ction co((an# co#es that can 'e sent to the LCD to c"ear the #is "ay or force the c&rsor to the ho(e osition or '"in1 the c&rsor3
[29]

LCD COMMAND CODES=


CODE BHEAC 1 2 6 B ; 9 A C E < 1, 16 19 1C 9, C, .9 COMMAND TO LCD INSTRUCTION REGISTER CLEAR DIS>LA8 SCREEN RETURN COME DECREMENT CURSOR@SCI<T CURSOR TO LE<TA INCREMENT CURSOR@SCI<T CURSOR TO RIGCTA SCI<T DIS>LA8 RIGCT SCI<T DIS>LA8 LE<T DIS>LA8 O<</CURSOR O<< DIS>LA8 O<</CURSOR ON DIS>LA8 ON/CURSOR O<< DIS>LA8 ON CURSOR 7LIN0ING DIS>LA8 ON CURSOR 7LIN0ING SCI<T CURSOR >OSITION TO LE<T SCI<T CURSOR >OSITION TO RIGCT SCI<T TCE ENTIRE DIS>LA8 TO TCE LE<T SCI<T TCE ENTIRE DIS>LA8 TO TCE RIGCT <ORCE CURSOR TO 7EGINNING O< 1ST LINE <ORCE CURSOR TO 7EGINNING O< 2ND LINE 2 LINES AND ;5- MATRIJ

ADVANTAGES=
LCD interfacin* )ith 9,;1 is a rea"E)or"# a se*(ent LEDDs or other (&"ti se*(ent LEDDsA3 This is #&e to fo""o)in* reasons4 The #ec"inin* rices of LCDDs3 The a'i"ity to #is "ay n&('ers/ characters an# *ra hics3 This is in contrast to LEDDs/ )hich are "i(ite# to n&('ers an# a fe) characters3 "ication3 In recent years the LCD is fin#in* )i#es rea# &se re "acin* LEDDs @se?en

[2:]

LIGHT EMITTING DIODE (LED)


A "i*htEe(ittin* #io#e @LEDA is a se(icon#&ctor #io#e that e(its incoherent narro) s ectr&( "i*ht )hen e"ectrica""y 'iase# in the for)ar# #irection of the nE!&nction/ as in the co((on LED circ&it3 This effect is a for( of e"ectro"&(inescence3

[.,]

The )a?e"en*th of the "i*ht e(itte#/ an# therefore its co"or/ #e en#s on the 'an# *a ener*y of the (ateria"s for(in* the En !&nction3 In si"icon or *er(ani&( #io#es/ the e"ectrons an# ho"es reco('ine 'y a nonEra#iati?e

[.1]

transition )hich ro#&ces no o tica" e(ission/ 'eca&se these are in#irect

'an# *a (ateria"s3

ADVANTAGES OF LEDS=
LEDDs ha?e (any a#?anta*es o?er other techno"o*ies "i1e "asers3 As co( are# to "aser #io#es or IR so&rces LEDDs offer a#?anta*es s&ch as "o) cost an# "on* ser?ice "ife3 Moreo?er LEDDs ha?e ?ery "o) o)er cons&( tion an# are easy to (aintain3

DIS ADVANTAGES OF LEDS=


LEDDs erfor(ance "ar*e"y #e en#s on the a('ient te( erat&re of the o eratin* en?iron(ent3 LEDDs (&st 'e s& "ie# )ith the correct c&rrent3
[.2]

KIEL SOFTWARE
Many co( anies ro?i#e the 9,;1 asse('"er/ so(e of the( ro?i#e share)are ?ersion of their ro#&ct on the =e'/ 0ie" is one of the(3 =e can #o)n"oa# the( fro( their =e'sites3 Co)e?er/ the siFe of co#e for these share)are ?ersions is "i(ite# an# )e ha?e to consi#er )hich asse('"er is s&ita'"e for o&r a "ication3

CREATING YOUR OWN APPLICATION IN UVISION"=


To create a ne) ro!ect in &Iision2/ yo& (&st4 C1B5+ST1, So&rce ro!ect3 Se"ect >ro!ect E O tions an# set the too" o tions3 Note )hen yo& se"ect the tar*et #e?ice fro( the De?ice Data'ase a""Es ecia" o tions are set a&to(atica""y3 8o& on"y nee# to confi*&re the (e(ory (a of yo&r tar*et har#)are3 Defa&"t (e(ory (o#e" settin*s are o ti(a" for (ost3 Se"ect >ro!ect E Ne) >ro!ect3 Se"ect a #irectory an# enter the na(e of the ro!ect fi"e3 Se"ect >ro!ect E Se"ect De?ice an# se"ect an 9,;1/ 2;1/ or #e?ice fro( the De?ice Data'ase Create so&rce fi"es to a## to the ro!ect3 Se"ect >ro!ect E Tar*ets/ Gro& s/ an# <i"es3 A##+<i"es/ se"ect Gro& 1/ an# a## the so&rce fi"es to the

[..]

APPLICATIONS=

Se"ect >ro!ect E Re'&i"# a"" tar*et fi"es or 7&i"# tar*et3

DEBUGGING AN APPLICATION IN UVISION"=


To #e'&* an a "ication create# &sin* &Iision2/ yo& (&st4 Se"ect De'&* E Start+Sto De'&* Session3 Use the Ste too"'ar '&ttons to sin*"eEste thro&*h yo&r

ro*ra(3 8o& (ay enter G/ (ain in the O&t &t =in#o) to e5ec&te to the (ain C f&nction3 too"'ar3 De'&* yo&r on3 ro*ra( &sin* stan#ar# o tions "i1e Ste / Go/ 7rea1/ an# so O en the Seria" =in#o) &sin* the Seria" M1 '&tton on the

[.6]

EVALUATION SOFTWARE=
Co#eE7an1in* Lin1er+Locator Li'rary Mana*er3 RTJE;1 Tiny Rea"ETi(e O eratin* Syste(

[.;]

DC MOTOR
PRINCIPLE=
It is 'ase# on the rinci "e that )hen a c&rrentEcarryin* con#&ctor is "ace# in a (a*netic fie"#/ it e5 eriences a (echanica" force )hose #irection is *i?en 'y <"e(in*Ns LeftEhan# r&"e an# )hose (a*nit&#e is *i?en 'y <orce/ F D B I . Ne)ton The force/ c&rrent an# the (a*netic fie"# are a"" in #ifferent #irections3 If an E"ectric c&rrent f"o)s thro&*h t)o co #o)n)ar# force )i"" (o?e the other )ire #o)n3 er )ires that are 'et)een the o"es of a (a*net/ an & )ar# force )i"" (o?e one )ire & an# a

SPEED CONTROL:
There are t)o )ays to a#!&st the s ee# of a )o&n#Efie"# #c (otor3 Co('inations of the t)o are so(eti(es &se# to a#!&st the s ee# of a #c (otor3

SELECTION=
[.B]

Choosin* #c (otor an# associate# e2&i (ent for a *i?en a "ication re2&ires consi#eration of se?era" factors3

WORKING=
Motors con?ert e"ectrica" ener*y @fro( a 'attery or ?o"ta*e so&rceA into (echanica" ener*y @&se# to ca&se rotationA3 This is acco( "ishe# 'y forcin* c&rrent thro&*h a coi" an# ro#&cin* a (a*netic fie"# that s ins the (otor3 DC (otors are fair"y si( "e to &n#erstan#3 They are a"so si( "e to (a1e an# on"y re2&ire a 'attery or #c s& the( r&n3 "y to (a1e

[.-]

L293D
B,,(a o&t &t c&rrent ca a'i"ity er channe" 132a ea1 o&t &t c&rrent @non re etiti?eA er channe" Ena'"e faci"ity O?er te( erat&re rotection Lo*ica" O,O in &t ?o"ta*e & to 13; ? @hi*h noise i((&nityA Interna" c"a( #io#es =i#e S& "yEIo"ta*e Ran*e4 63; I to .B I "y

Se arate In &tELo*ic S& Interna" ESD >rotection Ther(a" Sh&t#o)n

Ci*hENoiseEI((&nity In &ts <&nctiona""y Si(i"ar to SGS L2:. an# SGS L2:.D O&t &t C&rrent 1 A >er Channe" @B,, (A for L2:.DA >ea1 O&t &t C&rrent 2 A >er Channe" @132 A for L2:.DA O&t &t C"a( Dio#es for In#&cti?e Transient S& ression @L2:.DA

DESCRIPTION=
The De?ice is a (ono"ithic inte*rate# hi*h ?o"ta*e/ hi*h c&rrent fo&r channe" #ri?er #esi*ne# to acce t stan#ar# DTL or TTL "o*ic "e?e"s an# #ri?e in#&cti?e "oa#s @s&ch as re"ays so"enoi#s/ DC an# ste
[.9]

in* (otorsA an#

s)itchin* o)er transistors3 To si( "ify &se as t)o 'ri#*es each air of channe"s is e2&i e# )ith an ena'"e in &t3 A se arate s& "y in &t is ro?i#e# for the "o*ic/ a""o)in* o eration at a "o)er ?o"ta*e an# interna" c"a( #io#es are inc"&#e#

BLOCK DIAGRAM=

PIN CONFIGURATION=

[.:]

4X3 KEYPAD
A 1ey a# is a set of '&ttons arran*e# in a '"oc1 or O a#O )hich &s&a""y 'ear #i*its an# other sy('o"s an# &s&a""y a co( "ete set of a" ha'etica" "etters3 If it (ost"y contains n&('ers then it can a"so 'e ca""e# a n&(eric 1ey a#3 0ey a#s are fo&n# on (any a" han&(eric 1ey'oar#s an# on other #e?ices s&ch as ca"c&"ators/ &shE'&tton te"e hones/ co('ination "oc1s/ an# #i*ita" #oor "oc1s/ )hich re2&ire (ain"y n&(eric in &t3 In or#er to #etect )hich 1ey is resse# fro( the (atri5/ )e (a1e ro) "ines "o) one 'y one an# rea# the co"&(ns3 LetDs say )e first (a1e Ro)1 "o)/ an# then rea# the co"&(ns3 If any one of the 1ey in ro)1 is resse# it )i"" (a1e the corres on#in* co"&(n as "o) i3e3 if secon# 1ey is resse# in Ro)1/ then the co"&(n2 )i"" 'e "o)3 So )e co(e to 1no) that 1ey 2 of Ro)1 is resse#3 This is ho) scannin* is #one3

[6,]

INTERFACING THE KEYBOARD TO THE MICROCONTROLLER=


At the "o)est "e?e"/ 1ey'oar#s are or*aniFe# in a (atri5 of ro)s an# co"&(ns3 The C>U accesses 'oth ro)s an# co"&(ns thro&*h ortsG therefore/ )ith t)o 9E'it orts/ an 959 (atri5 of 1eys can 'e connecte# to a (icro rocessor3 =hen a 1ey is resse#/ a ro) an# a co"&(n (a1e a contactG other)ise/ there is no connection 'et)een ro)s an# co"&(ns3 In I7M >C 1ey'oar#s/ a sin*"e (icrocontro""er @consistin* of a (icro rocessor/ RAM an# E>ROM/ an# se?era" >ORTS a"" on a sin*"e chi A ta1es care of har#)are an# soft)are interfacin* of the 1ey'oar#/ in s&ch syste(s/ it is the f&nction of ro*ra(s store# in the E>ROM of the (icrocontro""er to scan the 1eys contin&o&s"y3

SCANNING AND IDENTIFYING THE KEY=

[61]

<i* sho)s a 656 (atri5 connecte# to t)o orts3 The ro)s are connecte# to an o&t &t ort an# the co"&(ns are connecte# to an in &t ort3 If no 1ey has 'een resse#/ rea#in* the in &t ort )i"" yie"# 1s for a"" co"&(ns since they are a"" connecte# to hi*h @IccA3 If a"" the ro)s are *ro&n#e# an# a 1ey is resse#/ one of the co"&(ns )i"" ha?e , since the resse# ro?i#es the ath to *ro&n#3 It is the f&nction of the (icrocontro""er to scan the 1ey'oar# contin&o&s"y to #etect an# i#entify the 1ey e5 "aine# ne5t3 resse#3 Co) it is #one is

GROUNDING ROWS AND READING THE COLUMNS=


To #etect a resse# 1ey/ the (icrocontro""er *ro&n#s a"" ro)s 'y ro?i#in* , to the o&t &t "atch/ an# then it rea#s the co"&(ns3 If the #ata rea# fro( the co"&(ns is D.ED,R1111/ no 1ey has 'een resse# an# the rocess contin&es &nti" a 1ey ress is #etecte#3 Co)e?er/ if one of the co"&(n 'its has a ,/ this (eans that a 1ey ress has occ&rre#3

THE PROCESS OF SCANNING A KEY GOES THROUGH THE FOLLOWING ! STEPS=


[62]

13 To (a1e sense that the rece#in* 1ey has 'een re"ease#/ ,Ds are o&t &t to a"" ro)s at once an# the co"&(ns are rea# an# chec1e# re eate#"y &nti" a"" the co"&(ns are hi*h3 =hen a"" co"&(ns are fo&n# to 'e hi*h/ the ro*ra( )aits for a short a(o&nt of ti(e 'efore it *oes to the ne5t sta*e of )aitin* for a 1ey to 'e resse#3 23 To see if any 1ey is resse#/ the co"&(ns scanne# o?er an# o?er in an infinite "oo &nti" one of the( has a Fero @,A on it3 Re(e('er that the o&t &t "atches connecte# to ro)s sti"" ha?e their initia" FeroDs (a1in* the( *ro&n#e#3 After the 1ey ress #etection it )aits 2,(s for 'o&nce an# then scans the co"&(ns a*ain3 This ser?es t)o f&nctions It ens&res that the first 1ey #etection )as not an erroneo&s one #&e to a s i1e noise an# the 2,(s #e"ay re?ents the sa(e 1ey ress fro( 'ein* inter rete# as a (&"ti "e 1ey ress 3If after 2, (s #e"ay the 1ey is sti"" resse#/ it *oes to the ne5t sta*e to #etect )hich ro) it 'e"on*s to Gother)ise it *oes 'ac1 in to the "oo to #etect a rea# 1ey ress3 .3 To #etect )hich ro) the 1ey ress 'e"on*s to/ it *ro&n#s one ro) at a ti(e rea#in* the co"&(n search ti(e 3If it fin#s that a"" co"&(ns are hi*h this (eans that the 1ey ress #oes not 'e"on*s to the ro)/ therefore it *ro&n#s the ne5t ro) an# contin&es &nti" it fin#s the ro) 1ey ress 'e"on*s to/ it sets & the startin* a##ress for the "oo1 & ta'"e ho"#in* the scan co#es for that ro) an# *oes to The ne5t sta*e to i#entify the 1ey3 63 To i#entify the 1ey ress/ it rotates the co"&(n 'its one 'it at a ti(e in to the carry f"a* an# chec1 to see if it is "o)3 U on fin#in* the Fero/ it &""s o&t the @ASCII co#eA character for that 1ey fro( the "oo1 & ta'"e3 Other)ise it incre(ents the ointer to oint to the ne5t e"e(ent of the "oo1 & ta'"e3

[6.]

ISP PROGRAMMER:
I*-S;6-') P,04,())%*4 @a''re?iate# IS>A is the a'i"ity of so(e ro*ra((a'"e "o*ic #e?ices/ (icrocontro""ers/ an# other ro*ra((a'"e e"ectronic chi s to 'e ro*ra((e# )hi"e insta""e# in a co( "ete syste(/ rather than re2&irin* the chi to 'e ro*ra((e# rior to insta""in* it into the syste(3 Other)ise/ InEsyste( ro*ra((in* (eans that the ro*ra( an#+or #ata (e(ory can 'e (o#ifie# )itho&t #isasse('"in* the e('e##e# syste( to hysica""y re "ace (e(ory3 The RST in is a"so &se# to ena'"e the . ins @MOSI/ MISO an# SCKA to 'e &se# for IS> si( "y 'y settin* RST to CIGC @;IA/ other)ise if RST is "o) @,IA/ ro*ra( start r&nnin* an# those three ins/ are &se# nor(a""y as >13;/ >13B an# >13-3 After RST is set hi*h/ the >ro*ra((in* Ena'"e instr&ction nee#s to 'e e5ec&te# first 'efore other o erations can 'e e5ec&te#3 7efore a re ro*ra((in* se2&ence can occ&r/ a Chi (e(ory "ocation in the Co#e array into Erase <<C3 o eration is re2&ire#3 The Chi Erase o eration t&rns the content of e?ery

[66]

$'1UF(35V

1$$&

GND

GND VCC 13 2 12 24 11 23 10 22 9 21 8 20 7 19 $ 18 17 4 1$ 3 1 2 14 1 C O N N ( C TO R D % 2 1 2 3 4 $ 7 8 9 10 GA I1A O1B I2A O2B I3A O3B I4A O4B GND 742 C 244 GND VCC GB O1A I1B O2A I2B $3A I3B O4A I4B 20 19 18 17 1$ 1 14 13 12 11

1 3 7 9

2 4 $ 8 10

GND

In the a'o?e fi*&re )e can see the IS> ro*rammer connections using 74ls244

7!LS"!!=
The -6LS266 is &se# to )or1 'et)een >RINT orts to the chi s AT9:S;23 =e cannot o'ser?e -6LS266 on the >C7 )hich is AT9:S;2 "ocate#3 It hi# in the !oint 'et)een >C an# B trans(ission "ines3 The -6LS266 in confi*&ration/ "o*ic #ia*ra(/ connection an# f&nction ta'"e is on the 'e"o)3

[6;]

EAAMPLE= CONNECTING THE PROGRAMMER TO AN AT>@S5"

[6B]

AT9:S92;2 (icrocontro""er feat&res an S>I ort/ thro&*h )hich onEchi <"ash (e(ory an# EE>ROM (ay 'e ro*ra((e#3 To ro*ra( the (icrocontro""er/ RST is he"# hi*h )hi"e co((an#s/ a##resses an# #ata are a "ie# to the S>I ort3

ATMEL ISP FLASH PROGRAMMER=


This is the soft)are that )i"" ta1e the CEJ fi"e *enerate# 'y )hate?er co( i"er yo& are &sin*/ an# sen# it E )ith res ect to the ?ery s ecific IS> transfer rotoco" E to the (icrocontro""er3 <o""o)in* are the (ain feat&res of this soft)are4 Rea# an# )rite the Inte" Ce5 fi"e Rea# si*nat&re/ "oc1 an# f&se 'its C"ear an# <i"" (e(ory '&ffer Ierify )ith (e(ory '&ffer
[6-]

Re"oa# c&rrent Ce5 fi"e Dis "ay '&ffer chec1s&( >ro*ra( se"ecte# "oc1 'its S f&ses A&to #etection of har#)are The soft)are #oes not ro?i#e the erase co((an# 'eca&se this f&nction is erfor(e# a&to(atica""y #&rin* #e?ice ro*ra((in*3 If yo& are re2&ire# to erase the contro""er/ first &se the c"ear '&ffer co((an# then ro*ra( the contro""er/ this )i"" erase the contro""er an# a"so set the #e?iceT to #efa&"t settin*3

ISP PROGRAMMER PICTURE=

[69]

CODING
+LCEADER <ILESL+ Minc"&#eUre*;13hV Minc"&#eUstrin*3hV +LLCD >IN CONNECTIONSL+ M#efine "c# >, s'it rsR>,W1G s'it enR>,W.G +LLCD <UNCTIONS DECLARATIONSL+ ?oi# initX"c#@?oi#AG ?oi# c(#X"c#@&nsi*ne# charAG ?oi# #ataX"c#@&nsi*ne# charAG ?oi# strX"c#@&nsi*ne# char LAG ?oi# De"ayX(s@&nsi*ne# intAG +L0E8>AD >IN CONNECTIONSL+ s'it ro),R>2W.G s'it ro)1R>2W;G s'it ro)2R>2WBG s'it ro).R>2W,G s'it co",R>2W6G s'it co"1R>2W2G s'it co"2R>2W1G +LMOTOR >IN CONNECTIONSL+ s'it M1R>1W,G s'it M2R>1W;G +L7UHHER >IN CONNECTIONL+ s'it 7UHHERR>1W2G +LIARIA7LES DECLARATIONL+ &nsi*ne# char i/!G &nsi*ne# char co"?a"/ro)?a"/ )#chan*eG &nsi*ne# char )#[1;]/str1[]RO12.6;OG
[6:]

&nsi*ne# char 1ey a#[6][.]RYN1N/N2N/N.N/ N6N/N;N/NBN/ N-N/N9N/N:N/ NLN/N,N/NMN/ZG +L>ASS=ORD <UNCTION DECLARATIONL+ ?oi# ass)or#@?oi#AG +L0E8>AD <UNCTION DECLARATIONL+ &nsi*ne# char 1ey@?oi#AG +LMAIN <UNCTIONL+ (ain@A Y &nsi*ne# char 1R,G 7UHHERR,G M1RM2R,G

++7UHHER O<< ++MOTOR O<<

initX"c#@AG ++LCD INITIALIHATION <UNCTION CALLING strX"c#@OENTER >ASS=ORD4OAG ++DIS>LA8 STRING ON LCD )hi"e@1A Y c(#X"c#@,5c,AG ++2ND LINE DIS>LA8 ass)or#@AG ++>ASS=ORD <UNCTION CALLING if@ )#chan*eA Y )#chan*eR,G contin&eG Z if@[strc( @str1/ )#AA ++COM>ARING =ITC 1ST >ASS=ORD Y 7UHHERR,G ++7UHHER O<< c(#X"c#@,5c,AG strX"c#@ODOOR O>ENOAG M1R,G ++MOTOR RUNS IN <OR=ARD DIRECTION M2R1G De"ayX(s@.,AG ++., MILLISECONDS DELA8 c(#X"c#@,5c,AG strX"c#@O OAG M1R,G
[;,]

++MOTOR O<<

M2R,G De"ayX(s@1;,,AG c(#X"c#@,5c,AG strX"c#@ODOOR CLOSEOAG M1R1G M2R,G De"ayX(s@.,AG c(#X"c#@,5c,AG strX"c#@O OAG M1R,G M2R,G 1R,G Z e"se Y strc y@te( / )#AG c(#X"c#@,5,1AG strX"c#@OConfir( >ass)or#OAG c(#X"c#@,5c,AG ass)or#@AG if@[strc( @te( / )#AA Y strc y@str1/te( AG c(#X"c#@,5,1AG strX"c#@O>ass)or# Z KChan*e#OAG De"ayX(s@1,,,AG c(#X"c#@,5,1AG strX"c#@OEnter >ass)or#OAG c(#X"c#@,5c,AG )#chan*eR1G ret&rnG Z e"se Y c(#X"c#@,5,1AG strX"c#@O>ass)or# ErrorOAG
[;1]

++MOTOR O<<

De"ayX(s@1,,,AG c(#X"c#@,5,1AG strX"c#@OEnter >ass)or#OAG c(#X"c#@,5c,AG )#chan*eR1G ret&rnG Z Z e"se Y c(#X"c#@,5,1AG strX"c#@O>ass)or# ErrorOAG De"ayX(s@1,,,AG c(#X"c#@,5,1AG strX"c#@OEnter >ass)or#OAG c(#X"c#@,5c,AG )#chan*eR1G ret&rnG Z Z e"se *oto "a'e"G Z e"se *oto "a'e"G Z e"se Y "a'e"4 )#[iQQ]R!G #ataX"c#@NLNAG Z Z )#[i]RN\,NG Z

[;2]

REFERENCE
TEAT BOOKS REFERED=
1. $The 9,;1 Microcontro""er an# E('e##e# Syste(s% 'y M&ha((a# A"i MaFi#i an# ]anice Gi""is ie MaFi#i/ >earson E#&cation3 23 9,;1 Microcontro""er Architect&re/ ro*ra((in* an# a 0ENNETC ]A8ALA .3 ATMEL 9:s;2 Data sheets 63 Can# 'oo1 for Di*ita" ICDs fro( Ana"o*ic De?ices "ication 'y

WEBSITES VIEWED=

)))3at(e"3co( )))3'eyon#"o*ic3or* )))3#a""asse(icon#&ctors3co(

)))3(a5i(Eic3co( )))3a""#atasheets3co( )))3ho)st&ff)or1s3co(

[;.]

[;6]

S-ar putea să vă placă și