Vous êtes sur la page 1sur 68

CHAPTER 1

INTRODUCTION
For many people robot is a machine that imitates a humanlike the androids in Star Wars, Terminator and Star Trek: The Next Generation. Ho e!er much these robots capture our ima"ination, such robots still only inhabit Science Fiction. #eople still ha!en$t been able to "i!e a robot enou"h $common sense$ to reliably interact orld. The type o% robots that you ill encounter most %re&uently are robots that do ork that is too dan"erous, borin", onerous, or 'ust plain nasty. (ost o% the robots in the orld are o% this type. They can be %ound in auto, medical, manu%acturin" and space industries. )n %act, there are o!er a million o% these types o% robots orkin" %or us today. ith a dynamic

This robot is controlled by a *F remote. This can be mo!ed %or ard and re!erse direction usin" "eared motors o% +,*#(. -lso this robot can take sharp turnin"s to ards le%t and ri"ht directions. This pro'ect uses -T./S01 (23 as its controller. Simultaneously the ima"es around the robot ill be transmitted to remote place. 3ser can monitor the ima"es and metal detection alarms on Tele!ision. The *F modules used here are STT4566 (H7 Transmitter, ST*4566 (H7 *ecei!er, HT819 9ncoder and HT81: :ecoder. The three s itches are inter%aced to the *F transmitter throu"h *F 9ncoder. The encoder continuously reads the status o% the s itches, passes the data to the *F transmitter and the transmitter transmits the data. This pro'ect uses /; battery. This pro'ect is much use%ul %or detection and sur!eillance applications.

1.1 Block Diagram:

SW8

SW1 *F 9ncoder HT819 SW6

*F Transmitter STT 4 566

SW5

Step do n T<F

=rid"e *ecti%ier

Filter 2ircuit

*e"ulator #o er supply to all sections

Fig 1.1: Block Diagram: Transmitter

Wireless 2amera ith !oice transmission

*F *ecei!er

*F :ecoder -T ./S01 (23


H4 =rid"e

Geared (otor 4 )

Geared (otor 4 )) 88.,0/1(H7 2rystal ?scillator

#o er > ?n *eset

Step do n T<F

=rid"e *ecti%ier

Filter 2ircuit

*e"ulator #o er supply to all sections

Fig 1.2: Block Diagram: Receiver

1.2 Introduction o Em!"dd"d #$%t"m:


-n 9mbedded System is a combination o% computer hard are and so%t are, and perhaps additional mechanical or other parts, desi"ned to per%orm a speci%ic %unction. - "ood example is the micro a!e o!en. -lmost e!ery household has one, and tens o% millions o% them are used e!eryday, but !ery %e people reali7e that a processor and so%t are are in!ol!ed in the preparation o% their lunch or dinner. This is in direct contrast to the personal computer in the %amily room. )t too is comprised o% computer hard are and so%t are and mechanical components @disk dri!es, %or exampleA. Ho e!er, a personal computer is not desi"ned to per%orm a speci%ic %unction ratherB it is able to do many di%%erent thin"s. (any people use the term "eneral4purpose computer to make this distinction clear. -s shipped, a "eneral4purpose computer is a blank slateB the manu%acturer does not kno hat the customer ill do ish it. ?ne customer may use it %or a net ork %ile ser!er another may use it exclusi!ely %or playin" "ames, and a third may use it to rite the next "reat -merican no!el. Fre&uently, an embedded system is a component ithin some lar"er system. For

example, modern cars and trucks contain many embedded systems. ?ne embedded system controls the anti4lock brakes, other monitors and controls the !ehicle$s emissions, and a third displays in%ormation on the dashboard. )n some cases, these embedded systems are connected by some sort o% a communication net ork, but that is certainly not a re&uirement. -t the possible risk o% con%usin" you, it is important to point out that a "eneral4purpose computer is itsel% made up o% numerous embedded systems. For example, my computer consists o% a keyboard, mouse, !ideo card, modem, hard dri!e, %loppy dri!e, and sound card4each o% hich is an embedded system. 9ach o% these de!ices contains a processor 5

and so%t are and is desi"ned to per%orm a speci%ic %unction. For example, the modem is desi"ned to send and recei!e di"ital data o!er analo" telephone line. That$s it and all o% the other de!ices can be summari7ed in a sin"le sentence as ell. )% an embedded system is desi"ned ell, the existence o% the processor and so%t are ould e!en be possible to build

could be completely unnoticed by the user o% the de!ice. Such is the case %or a micro a!e o!en, ;2*, or alarm clock. )n some cases, it by replacin" the combination this an e&ui!alent de!ice that does not contain the processor and so%t are. This could be done ith a custom inte"rated circuit that per%orms the same lines o% so%t are than to %unctions in hard are. Ho e!er, a lot o% %lexibility is lost hen a desi"n is hard4cooled in ay. )t is mush easier, and cheaper, to chan"e a %e redesi"n a piece o% custom hard are.

1.& Hi%tor$ and 'utur":


Gi!en the de%inition o% embedded systems earlier is this chapterB the %irst such systems could not possibly ha!e appeared be%ore 8/C8. That orld$s %irst microprocessor. This chip, the 5,,5, as the year )ntel introduced the as desi"ned %or use in a line o%

business calculators produced by the Dapanese 2ompany =usicom. )n 8/+/, =usicom asked )ntel to desi"n a set o% custom inte"rated circuits4one %or each o% their ne calculator models. The 5,,5 as )ntel$s response rather than desi"n custom hard are %or each calculator, )ntel proposed a "eneral4purpose circuit that could be used throu"hout the entire line o% calculators. )ntel$s idea as that the so%t are ould "i!e each calculator its uni&ue set o% %eatures. The microcontroller as an o!erni"ht success, and its use increased steadily o!er the next decade. 9arly embedded applications included unmanned space probes, computeri7ed tra%%ic li"hts, and aircra%t %li"ht control systems. )n the 8/.,s, embedded systems &uietly rode the a!es o% the microcomputer a"e and brou"ht microprocessors into e!ery part o% our kitchens @bread machines, %ood processors, and micro a!e o!ensA, li!in" rooms

@tele!isions, stereos, and remote controlsA, and printers, cash re"isters, and credit card readersA.

orkplaces @%ax machines, pa"ers, laser

)t seems ine!itable hat the number o% embedded systems ill continue to increase rapidly. -lready there are promisin" ne embedded de!ices that ha!e enormous market potentialB li"ht s itches and thermostats that can be central computer, intelli"ent air4ba" systems that don$t in%late hen children or small adults are present, pal4si7ed electronic or"ani7ers and personal di"ital assistants @#:-sA, di"ital cameras, and dashboard na!i"ation systems. 2learly, indi!iduals ho possess the skills and desire to desi"n the next "eneration o% embedded systems ill be in demand %or &uite some time.

1.( R"al Tim" #$%t"m%:


?ne subclass o% embedded is orthy o% an introduction at this point. -s commonly

de%ined, a real4time system is a computer system that has timin" constraints. )n other ords, a real4time system is partly speci%ied in terms o% its ability to make certain calculations or decisions in a timely manner. These important calculations are said to ha!e deadlines %or completion. -nd, %or all practical purposes, a missed deadline is 'ust as bad as a ron" ans er. The issue o% hat i% a deadline is missed is a crucial one. For example, i% the real4time to be endan"ered by a sin"le missed deadline. Ho e!er, i% instead ill be said

system is part o% an airplane$s %li"ht control system, it is possible %or the li!es o% the passen"ers and cre the system is in!ol!ed in satellite communication, the dama"e could be limited to a sin"le corrupt data packet. The more se!ere the conse&uences, the more likely it systems at the other end o% this discussion are said to ha!e Eso%tE deadlines. -ll o% the topics and examples presented in this book are applicable to the desi"ners o% real4time system ho is more deli"ht in his ork. He must "uarantee reliable operation o% the so%t are and hard are under all the possible conditions and to the de"ree that human + that the deadline is EhardE and thus, the system is a hard real4time system. *eal4time

li!es depend upon three system$s proper execution, en"ineerin" calculations and descripti!e paper ork.

1.) O*"r*i"+ o Em!"dd"d #$%t"m Arc,it"ctur"


9!ery embedded system consists o% custom4built hard are built around a 2entral #rocessin" 3nit @2#3A. This hard are also contains memory chips onto hich the so%t are is loaded. The so%t are residin" on the memory chip is also called the F%irm areG. The embedded system architecture can be represented as a layered architecture. The operatin" system runs abo!e the hard are, and the application so%t are runs abo!e the operatin" system. The same architecture is applicable to any computer includin" a desktop computer. Ho e!er, there are si"ni%icant di%%erences. )t is not compulsory to ha!e an operatin" system in e!ery embedded system. For small appliances such as remote control units, air conditioners, toys etc., there is no need for an operatin" system and you can rite only the so%t are speci%ic to that application. For applications in!ol!in" complex processin", it is ad!isable to ha!e an operatin" system. )n such a case, you need to inte"rate the application so%t are ith the operatin" system and then trans%er the entire so%t are on to the memory chip. ?nce the so%t are is trans%erred to the memory chip, the so%t are ill continue to run for a lon" time you donGt need to reload ne so%t are. No , let us see the details o% the !arious buildin" blocks o% the hard are o% an embedded system. -s sho n in Fi". the buildin" blocks areB H 2entral #rocessin" 3nit @2#3A H (emory @*ead4only (emory and *andom -ccess (emoryA H )nput :e!ices H ?utput de!ices H 2ommunication inter%aces H -pplication4speci%ic circuitry C

'ig 1.&: "m!"dd"d %$%t"m C"ntral Proc"%%ing Unit -CPU.: The 2entral #rocessin" 3nit @processor, in shortA can be any o% the %ollo in": microcontroller, microprocessor or :i"ital Si"nal #rocessor @:S#A. - micro4controller is a lo 4cost processor. )ts main attraction is that on the chip itsel%, there ill be many other components such as memory, serial communication inter%ace, analo"4to di"ital con!erter etc. So, %or small applications, a micro4controller is the best choice as the number o% external components re&uired mainly %or applications in processin". /"mor$: The memory is cate"ori7ed as *andom -ccess 88emory @*-(A and *ead ?nly (emory @*?(A. The contents o% the *-( to the chip, ill be erased i% po er is s itched o%% hereas *?( retains the contents e!en i% the po er is s itched o%%. So, the ill be !ery less. ?n the other hand, microprocessors are ith them. :0# is used more po er%ul, but you need to use many external components

hich si"nal processin" is in!ol!ed such as audio and !ideo

%irm are is stored in the *?(. When po er is s itched on, the processor reads the *?(B the pro"ram is pro"ram is executed. In0ut d"*ic"%: 3nlike the desktops, the input de!ices to an embedded system ha!e !ery limited capability. There ill be no keyboard or a mouse, and hence interactin" . ith the

embedded system is no easy task. (any embedded systems ill ha!e a small keypad4you press one key to "i!e a speci%ic command. - keypad may be used to input only the di"its. (any embedded systems used in process control do not ha!e any input de!ice for user interactionB they take inputs from sensors or transducers 8G%nd produce electrical si"nals that are in turn %ed to other systems. Out0ut d"*ic"%: The output de!ices o% the embedded systems also ha!e !ery limited capability. Some embedded systems ill ha!e a few Ii"ht 9mittin" :iodes @I9:sA to indicate the health status o% the system modules, or for !isual indication o% alarms. - small Ii&uid 2rystal :isplay @I2:A may also be used to display some important parameters. Communication int"r ac"%: The embedded systems may need to, interact ith other embedded systems at they may ha!e to transmit data to a desktop. To %acilitate this, the embedded systems are pro!ided ith one or a few communication inter%aces such as *S161, *S511, *S5.0, 3ni!ersal Serial =us @3S=A, )999 86/5, 9thernet etc. A00lication1%0"ci ic circuitr$: Sensors, transducers, special processin" and control circuitry may be re&uired %at an embedded system, dependin" on its application. This circuitry interacts processor to carry out the necessary ith the ork. The entire hard are has to be "i!en po er

supply either throu"h the 16, !olts main supply or throu"h a battery. The hard are has to desi"n in such a ay that the po er consumption is minimi7ed.

1.2 Conclu%ion%:

9mbedded Systems plays a !ital role in our day today li%e. They are used %or household appliances like micro a!e o!en to the stellite applications. They pro!ide "ood man to machine inter%ace. -utomation is the %urther step in the orld o% 9mbedded Systems, hich includes the

elimination o% the human bein" in the mundane applications. They are cost e%%ecti!e, accurate and can ork in any conditions and round the clock.

8,

CHAPTER 2

RADIO 'RE3UENC4 @R'A


2.1 5,at I% R'6
Radio r"7u"nc$ @R'A is a %re&uency or rate o% oscillation ithin the ran"e o% about 6 H7 to 6,, GH7. This ran"e corresponds to %re&uency o% alternatin" current electrical si"nals used to produce and detect radio a!es. Since most o% this ran"e is beyond the !ibration rate that most mechanical systems can respond to, *F usually re%ers to oscillations in electrical circuits or electroma"netic radiation .

2.2 Pro0"rti"% O R':


9lectrical currents that oscillate at *F ha!e special properties not shared by direct current si"nals. ?ne such property is the ease ith hich it can ioni7e air to create a conducti!e path throu"h air. This property is exploited by $hi"h %re&uency$ units used in electric arc eldin". -nother special property is an electroma"netic %orce that dri!es the *F current to the sur%ace o% conductors, kno n as the skin e%%ect. -nother property is the ability to appear to %lo si"nals. throu"h paths that contain insulatin" material, like the dielectric insulator o% a capacitor. The de"ree o% e%%ect o% these properties depends on the %re&uency o% the

2.& Bri" D"%cri0tion O R':


*adio %re&uency @abbre!iated *FA is a term that re%ers to alternatin" current @-2A ha!in" characteristics such that, i% the current is input to an antenna, an electroma"netic @9(A %ield is "enerated suitable %or ireless broadcastin" and<or communications. These ireless communications %re&uencies co!er a si"ni%icant portion o% the electroma"netic radiation spectrum, extendin" %rom nine kilohert7 @/ kH7A,the lo est allocated %re&uency @it$s ithin the ran"e o% human hearin"A, to thousands o% "i"ahert7@GH7A.

88

When an *F current is supplied to an antenna, it "i!es rise to an electroma"netic %ield that propa"ates throu"h space. This %ield is sometimes called an *F %ieldB in less technical 'ar"on it is a Eradio a!e.E -ny *F %ield has a a!elen"th that is in!ersely proportional to the %re&uency. )n the atmosphere or in outer space, i% is the %re&uency in me"ahert7 and %is the a!elen"th in meters, then s 8 &99:% The %re&uency o% an *F si"nal is in!ersely proportional to the a!elen"th o% the 9( %ield to hich it corresponds. -t / kH7, the %ree4space a!elen"th is approximately 66 a!elen"ths kilometers @kmA or 18 miles @miA. -t the hi"hest radio %re&uencies, the 9(

measure approximately one millimeter @8 mmA. -s the %re&uency is increased beyond that o% the *F spectrum, 9( ener"y takes the %orm o% in%rared @)*A, !isible, ultra!iolet @3;A, J rays, and "amma rays. (any types o% ireless de!ices make use o% *F %ields. 2ordless and cellular telephone, ireless de!ices operate at )* or

radio and tele!ision broadcast stations, satellite communications systems, and t o4 ay radio ser!ices all operate in the *F spectrum. Some !isible4li"ht %re&uencies, hose electroma"netic a!elen"ths are shorter than those o%

*F %ields. 9xamples include most tele!ision4set remote4control boxes Some cordless computer keyboards and mice, and a %e ireless hi4%i stereo headsets.

The *F spectrum is di!ided into se!eral ran"es, or bands. With the exception o% the lo est4%re&uency se"ment, each band represents an increase o% %re&uency correspondin" to an order o% ma"nitude @po er o% 8,A. The table depicts the ei"ht bands in the *F spectrum, sho in" %re&uency and band idth ran"es. The SHF and 9HF bands are o%ten re%erred to as the micro+a*" %0"ctrum.

5H4 DO 5E ;O 'OR R' CO//UNICATION6 R' Ad*antag"%: 8. No line o% si"ht is needed. 81

1. Not blocked by common materials: )t can penetrate most solids and pass throu"h alls. 6. Ion"er ran"e. 5. )t is not sensiti!e to the li"htB. 0. )t is not much sensiti!e to the en!ironmental chan"es and eather conditions. 5HAT CARE #HOU<D BE TA=EN IN R' CO//UNICATION6 R' Di%ad*antag"%: 8. )nter%erence: communication de!ices usin" similar %re&uencies 4

ireless phones,

scanners, rist radios and personal locators can inter%ere ith transmission 1. Iack o% security: easier to Eea!esdropE on transmissions since si"nals are spread out in space rather than con%ined to a ire 6. Hi"her cost than in%rared 5. Federal 2ommunications 2ommission@F22A licenses re&uired %or some products 0. Io er speed: data rate transmission is lo er than ired and in%rared transmission

2.) R' Tran%mitt"r #tt1(&&m,>:

86

Fi" 1.8: #TT1(&& /H> TRAN#/ITTER

'ACTOR# IN'<UENCED TO CHOO#E #TT1(&&/H>


ABOUT THE TRAN#/ITTER:

The STT4566 is ideal %or remote control applications re&uired.

here lo

cost and lon"er ran"e is

8. The transmitter operates %rom a8.0481; supply, makin" it ideal %or battery4 po ered applications. 1. The transmitter employs a S-W4stabili7ed oscillator, ensurin" accurate %re&uency control %or best ran"e per%ormance. 6. The manu%acturin"4%riendly S)# style packa"e and lo 4cost make the STT4566 suitable %or hi"h !olume applications. '"atur"% 8. 1. 6. 5. 566./1 (H7 Fre&uency Io 2ost 8.0481; operation Small si7e

PIN DE#CRIPTION:

85

%i" 1.1: pin dia"ram@transmitterA

;ND Tran%mitt"r ground. 2onnect to "round plane DATA Digital data in0ut. This input is 2(?S compatible and should be dri!en le!el inputs. ith 2(?S

?CC O0"rating *oltag" or t," tran%mitt"r. ;22 should be bypassed capacitor and %iltered de"rade transmitter noise per%ormance. ANT ith a .,8uF ceramic ill ith a 5.CuF tantalum capacitor. Noise on the po er supply

80

)9 o,m ant"nna out0ut. The antenna port impedance a%%ects output po er and harmonic emissions. -ntenna can be sin"le core #2= trace antenna. APP<ICATION: ire o% approximately 8Ccm len"th or

ig 2.&: a00lication o tran%mitt"r The typical connection sho n in the abo!e %i"ure cannot because there microcontroller unit. i.e., ran"e. Thus, ork exactly at all times ill be no proper synchroni7ation bet een the transmitter and the hate!er the microcontroller sends the data to the transmitter, ill be not in the radio %re&uency hich can accept the input %rom the

the transmitter is not able to accept this data as this e need an intermediate de!ice

microcontroller, process it in the ran"e o% radio %re&uency ran"e and then send it to the transmitter. Thus, an encoder is used. The encoder used here is HT12E %rom HO<TE= #E/ICONDUCTOR# INC. ENCODER HT12E:

8+

'ig 2.(: Encod"r HT12E

HO5 DOE# THE ENCODER 5OR=6 The 181 series o% encoders be"in a 54 ord transmission cycle upon receipt o% a transmission enable @T9 %or the HT819 or :.K:88 %or the HT81-, acti!e lo A. This cycle ill repeat itsel% as lon" as the transmission enable @T9 or :.K:88A is held lo . ?nce the transmission enables returns hi"h the encoder output completes its %inal cycle and then stops as sho n belo .

'ig 2.): Tran%mi%%ion Timing

Addr"%%:data 0rogramming -0r"%"t. The status o% each address<data pin can be indi!idually pre4set to lo"ic Lhi"hL or Llo L. )% a transmission4enable si"nal is applied, the encoder scans and transmits the status o%

8C

the 81 bits o% address<data serially in the order -, to -:88 %or the HT819 encoder and -, to :88 %or the HT81- encoder.

'ig 2.2: Pr"%"t Circuit Tran%mi%%ion Ena!l" For the T9 tri""er type o% encoders, transmission is enabled by applyin" a hi"h si"nal to the T9 pin. =ut %or the :ata tri""er type o% encoders, it is enabled by applyin" a hi"h si"nal to one o% the data pins :81K:8C. '<O5CHART:

8.

'ig 2.@: 'lo+c,art -tran%mitt"r.

8/

5,$ i% t,i% gra0, r"7uir"d6

'ig 2.A: ;ra0, %,o+ing 'r"7u"nc$ *"r%u% ?oltag" The "raph sho n abo!e decides the resistance !alue to be connected to the oscillator pins o% the encoder. The oscillator resistance ill ha!e an e%%ect on startup time and steady state amplitude. For the data communication at a particular %re&uency in the *F ran"e, both the transmitter and recei!er should be set to a particular %re&uency. The exact settin" o% the %re&uency can be obtained in the encoder and decoder circuits. The %re&uency !alue can be set usin" the "raph. The operatin" !olta"e o% encoder and decoder is 0;. Thus lookin" at the "raph at 0; ;::, i% e select the %re&uency in the ran"e o% 8.10 and 8.0, e are selectin" 11,k resistance.

1,

DE/O CIRCUIT: Tran%mi%%ion Circuit

'ig 2.19: DE/O CIRCUIT: Tran%mi%%ion Circuit

18

The data sent %rom the microcontroller is encoded and sent to *F transmitter. The data is transmitted on the antenna pin. Thus, this data should be recei!ed on the destination i.e, on *F recei!er.

2.2 R' R"c"i*"r #tr1(&& /,>:

Fi" 1.88: *F recei!er The data is recei!ed by the *F recei!er %rom the antenna pin and this data is a!ailable on the data pins. T o :ata pins are pro!ided in the recei!er module. Thus, this data can be used %or %urther applications. PINOUT:

'ig 2.12: Pin Diagram o R"c"i*"r

11

;ND *ecei!er Ground. 2onnect to "round plane. ?CC -)?. ;22 pins are electrically connected and pro!ide operatin" !olta"e %or the recei!er. ;22 can be applied to either or both. ;22 should be bypassed Noise on the po er supply ill de"rade recei!er sensiti!ity. DATA :i"ital data output. This output is capable o% dri!in" one TTI or 2(?S load. )t is a 2(?S compatible output. ith a .8MF ceramic capacitor.

Similarly, as the transmitter re&uires an encoder, the recei!er module re&uires a decoder.

The decoder used is HT12D %rom HO<TE= #E/ICONDUCTOR INC. 16

DECODER HT12D:

'"atur"% 8. ?peratin" !olta"e: 1.5;K81;. 1. Io po er and hi"h noise immunity 2(?S technolo"y. 6. Io standby current. 5. 2apable o% decodin" 8. bits o% in%ormation. 0. #airs ith H?IT9NGs 68. series o% encoders. +. .K8. address pins. C. ,K. data pins.

Ho+ Do"% T," D"cod"r 5ork6


The 181 series o% decoders pro!ides !arious combinations o% addresses and data pins in di%%erent packa"es so as to pair ith the 181 series o% encoders. The decoders recei!e data that are transmitted by an encoder and interpret the %irst N bits o% code period as addresses and the last 81LN bits as data, here N is the address code number. si"nal on the :)N pin acti!ates the oscillator hich in turn decodes the incomin" address 15

and data. The decoders

ill then check the recei!ed address three times continuously. )%

the recei!ed address codes all match the contents o% the decoderLs local address, the 81LN bits o% data are decoded to acti!ate the output pins and the ;T pin is set hi"h to indicate a !alid transmission. This ?ther ise it is al ays lo . '<O5 CHART: ill last unless the address code is incorrect or no hen the transmission is !alid. si"nal is recei!ed. The output o% the ;T pin is hi"h only

'ig 2.1& : 'lo+c,art o R"c"i*"r

10

BA#IC APP<ICATION CIRCUIT O' HT12D DECODER:

ig 2.1(: a00 circuit-HT12D.

1+

DE/O CIRCUIT: R"c"0tion circuit RECIE?ER

'ig 2.1): D"mo Circuit-r"c"i*"r. The data transmitted into the air is recei!ed by the recei!er. The recei!ed data is taken %rom the data line o% the recei!er and is %ed to the decoder .The output o% decoder is "i!en to microcontroller and then data is processed accordin" to the applications.

1C

BC ))@ TRAN#I#TOR: 'ig 2.12: #$m!ol

'EATURE# H Io current @max. 8,, m-A H Io !olta"e @max. +0 ;A. APP<ICATION# H General purpose s itchin" and ampli%ication

CHAPTER &

PO5ER #UPP<4:
Introduction:
The input to the circuit is applied %rom the re"ulated po er supply. The a.c. input i.e., 16,; %rom the mains supply is step do n by the trans%ormer to 81; and is %ed to a 1.

recti%ier. The output obtained %rom the recti%ier is a pulsatin" d.c !olta"e. So in order to "et a pure d.c !olta"e, the output !olta"e %rom the recti%ier is %ed to a %ilter to remo!e any a.c components present e!en a%ter recti%ication. No , this !olta"e is "i!en to a !olta"e re"ulator to obtain a pure constant dc !olta"e.

2&9? AC )9H>

D.C Out0ut

#t"0 do+n tran% orm"r

Bridg" R"cti i"r Filter R"gulator

'ig &.1 : 0o+"r %u00l$ Tran% orm"r: 3sually, :2 !olta"es are re&uired to operate !arious electronic e&uipment and these !olta"es are 0;, /; or 81;. =ut these !olta"es cannot be obtained directly. Thus the a.c input a!ailable at the mains supply i.e., 16,; is to be brou"ht do n to the re&uired !olta"e le!el. This is done by a trans%ormer. Thus, a step do n trans%ormer is employed to decrease the !olta"e to a re&uired le!el.

R"cti i"r: The output %rom the trans%ormer is %ed to the recti%ier. )t con!erts -.2. into pulsatin" :.2. The recti%ier may be a hal% a!e or a %ull a!e recti%ier. )n this pro'ect, a brid"e recti%ier is used because o% its merits like "ood stability and %ull a!e recti%ication. 1/

'ilt"r: 2apaciti!e %ilter is used in this pro'ect. )t remo!es the ripples %rom the output o% recti%ier and smoothens the :.2. ?utput recei!ed %rom this %ilter is constant until the mains !olta"e and load is maintained constant. Ho e!er, i% either o% the t o is !aried, :.2. !olta"e recei!ed at this point chan"es. There%ore a re"ulator is applied at the output sta"e. ?oltag" r"gulator: -s the name itsel% implies, it re"ulates the input applied to it. - !olta"e re"ulator is an electrical re"ulator desi"ned to automatically maintain a constant !olta"e le!el. )n this pro'ect, po er supply o% 0; and 81; are re&uired. )n order to obtain these !olta"e le!els, C.,0 and C.81 !olta"e re"ulators are to be used. The %irst number C. represents positi!e supply and the numbers ,0, 81 represent the re&uired output !olta"e le!els.

CHAPTER (

/ICROCONTRO<<ER#
(.1 Introduction:
(icroprocessors and microcontrollers are idely used in embedded systems products.

Microcontroller is a programmable device. - microcontroller has a 2#3 in addition to a %ixed amount o% *-(, *?(, )<? ports and a timer embedded all on a sin"le chip. The 6,

%ixed amount o% on4chip *?(, *-( and number o% )<? ports in microcontrollers makes them ideal %or many applications in hich cost and space are critical. The )ntel .,08 is a Har!ard architecture, sin"le chip microcontroller @O2A hich as

de!eloped by )ntel in 8/., %or use in embedded systems. )t as popular in the 8/.,s and early 8//,s, but today it has lar"ely been superseded by a !ast ran"e o% enhanced de!ices ith .,084compatible processor cores that are manu%actured by more than 1, independent manu%acturers includin" -tmel, )n%ineon Technolo"ies and (axim )nte"rated #roducts. .,08 is an .4bit processor, meanin" that the 2#3 can ork on only . bits o% data at a

time. :ata lar"er than . bits has to be broken into .4bit pieces to be processed by the 2#3. .,08 is a!ailable in di%%erent memory types such as 3;49#*?(, Flash and N;4 *-(. The microcontroller used in this pro'ect is -T./S01. -tmel 2orporation introduced this ./208 microcontroller. This microcontroller belon"s to .,08 %amily. This

microcontroller had 81. bytes o% *-(, 5N bytes o% on4chip *?(, t o timers, one serial port and %our ports @each .4bits ideA all on a sin"le chip. -T./S01 is Flash type .,08. The present pro'ect is implemented on Neil 3 !ision. )n order to pro"ram the de!ice, proload tool has been used to burn the pro"ram onto the microcontroller. The %eatures, pin description o% the microcontroller and the so%t are tools used are discussed in the %ollo in" sections.

68

(.2 '"atur"% O ATAB#)2:


8. .N =ytes o% *e4pro"rammable Flash (emory. 1. *-( is 10+ bytes. 6. 1.C; to +; ?peratin" *an"e. 5. Fully Static ?peration: , H7 to 15 (H7. 0. 61 #ro"rammable )<? Iines. +. T o 8+4bit Timer<2ounters. C. Io 4po er )dle and #o er4do n (odes.

(.& D"%cri0tion:
The -T./S01 is a lo 4!olta"e, hi"h4per%ormance 2(?S .4bit microcomputer ith .N

bytes o% Flash pro"rammable memory. The de!ice is manu%actured usin" -tmelGs hi"h4 density non!olatile memory technolo"y and is compatible (2S408 instruction set. =y combinin" a !ersatile .4bit 2#3 chip, the -tmel -T./S01 is a po er%ul microcomputer, ith the industry4standard ith Flash on a monolithic

hich pro!ides a hi"hly %lexible

and cost4e%%ecti!e solution to many embedded control applications.

61

)n addition, the -T./S01 is desi"ned

ith static lo"ic %or operation do n to 7ero

%re&uency and supports t o so%t are selectable po er sa!in" modes. The )dle (ode stops the 2#3 hile allo in" the *-(, timer<counters, serial port and interrupt system

to continue %unctionin".

'ig(.1: /C Pin diagram

66

'ig (.2 : /C Block diagram

65

PIN DE#CRIPTION: ?cc #in 5, pro!ides supply !olta"e to the chip. The !olta"e source is P0;. ;ND #in 1, is the "round. CTA<1 and CTA<2 JT-I8 and JT-I1 are the input and output, respecti!ely, o% an in!ertin" ampli%ier that can be con%i"ured %or use as an on4chip oscillator, as sho n in Fi"ure 88. 9ither a &uart7 crystal or ceramic resonator may be used. To dri!e the de!ice %rom an external clock source, JT-I1 should be le%t unconnected belo hile JT-I8 is dri!en, as sho n in the

%i"ure. There are no re&uirements on the duty cycle o% the external clock si"nal,

since the input to the internal clockin" circuitry is throu"h a di!ide4by4t o %lip4%lop, but minimum and maximum !olta"e hi"h and lo time speci%ications must be obser!ed.

60

'ig(.&: O%cillator Conn"ction% 28, 21 Q 6, pF R 8, pF %or 2rystals Q 5, pF R 8, pF %or 2eramic *esonators

Fi": EDt"rnal Clock Dri*" Con iguration 6+

RE#ET #in/ is the reset pin. )t is an input and is acti!e hi"h. 3pon applyin" a hi"h pulse to this pin, the microcontroller as a po er4on reset. EA -EDt"rnal acc"%%. #in 68 is 9-. )t is an acti!e lo si"nal. )t is an input pin and must be connected to either ith ill reset and terminate all the acti!ities. This is o%ten re%erred to

;cc or GN: but it cannot be le%t unconnected. The .,08 %amily members all come

on4chip *?( to store pro"rams. )n such cases, the 9- pin is connected to ;cc. )% the code is stored on an external *?(, the 9- pin must be connected to GN: to indicate that the code is stored externally. P#EN -Program %tor" "na!l". This is an output pin. A<E -Addr"%% latc, "na!l". This is an output pin and is acti!e hi"h.

6C

Port% 9E 1E 2 and & The %our ports #,, #8, #1 and #6 each use . pins, makin" them .4bit ports. -ll the ports upon *9S9T are con%i"ured as input, since #,4#6 ha!e !alue FFH on them. Port 9-P9. #ort , is also desi"nated as -:,4-:C, allo in" it to be used %or both address and data. -I9 indicates i% #, has address or data. When -I9Q,, it pro!ides data :,4:C, but hen -I9Q8, it has address -,4-C. There%ore, -I9 is used %or demultiplexin" address and data ith the help o% an internal latch. When there is no external memory connection, the pins o% #, must be connected to a 8,N4ohm pull4up resistor. This is due to the %act that #, is an open drain. With external pull4up resistors connected to #,, it can be used as a simple )<?, 'ust like #8 and #1. =ut the ports #8, #1 and #6 do not need any pull4up resistors since they already ha!e pull4up resistors internally. 3pon reset, ports #8, #1 and #6 are con%i"ured as input ports. Port 1 and Port 2 With no external memory connection, both #8 and #1 are used as simple )<?. With external memory connections, port 1 must be used alon" ith #, to pro!ide the 8+4bit

address %or the external memory. #ort 1 is desi"nated as -.4-80 indicatin" its dual %unction. While #, pro!ides the lo er . bits !ia -,4-C, it is the 'ob o% #1 to pro!ide bits -.4-80 o% the address.

6.

Port & #ort 6 occupies a total o% . pins, pins 8, throu"h 8C. )t can be used as input or output. #6 does not need any pull4up resistors, the same as port 8 and port 1. #ort 6 has an additional %unction o% pro!idin" some extremely important si"nals such as interrupts. Ta!l"(.1: Port & Alt"rnat" 'unction%

/ac,in" c$cl" or t," A9)1 The 2#3 takes a certain number o% clock cycles to execute an instruction. )n the .,08 %amily, these clock cycles are re%erred to as machine cycles. The len"th o% the machine cycle depends on the %re&uency o% the crystal oscillator. The crystal oscillator, alon" ith on4chip circuitry, pro!ides the clock source %or the .,08 2#3.

6/

The %re&uency can !ary %rom 5 (H7 to 6, (H7, dependin" upon the chip ratin" and manu%acturer. =ut the exact %re&uency o% 88.,0/1 (H7 crystal oscillator is used to make the .,08 based system compatible ith the serial port o% the )=( #2. )n the ori"inal !ersion o% .,08, one machine cycle lasts 81 oscillator periods. There%ore, to calculate the machine cycle %or the .,08, the calculation is made as 8<81 o% the crystal %re&uency and its in!erse is taken. The assembly lan"ua"e pro"ram is ritten and this pro"ram has to be dumped into the

microcontroller %or the hard are kit to %unction accordin" to the so%t are. The pro"ram dumped in the microcontroller is stored in the Flash memory in the microcontroller. =e%ore that, this Flash memory has to be pro"rammed and is discussed in the next section.

(.( Programming T," 'la%,:


The -T./S01 is normally shipped ith the on4chip Flash memory array in the erased

state @that is, contents Q FFHA and ready to be pro"rammed. The pro"rammin" inter%ace accepts either a hi"h4!olta"e @814!oltA or a lo 4!olta"e @;22A pro"ram enable si"nal. The lo 4!olta"e pro"rammin" mode pro!ides a con!enient ay to pro"ram the -T./S01 inside the userGs system, hile the hi"h4!olta"e pro"rammin" mode is compatible ith ith

con!entional third party Flash or 9#*?( pro"rammers. The -T./S01 is shipped

either the hi"h4!olta"e or lo 4!olta"e pro"rammin" mode enabled. The respecti!e top4 side markin" and de!ice si"nature codes are listed in the %ollo in" table.

5,

The -T./S01 code memory array is pro"rammed byte4byte in either pro"rammin" mode. To program any nonblank byte in the on-chip Flash Memory, the entire memory must be erased using the Chip Erase Mode. Programming Algorit,m: =e%ore pro"rammin" the -T./S01, the address, data and control si"nals should be set up accordin" to the Flash pro"rammin" mode table. To pro"ram the -T./S01, the %ollo in" steps should be considered: 8. )nput the desired memory location on the address lines. 1. )nput the appropriate data byte on the data lines. 6. -cti!ate the correct combination o% control si"nals. 5. *aise 9-<;## to 81; %or the hi"h4!olta"e pro"rammin" mode. 0. #ulse -I9<#*?G once to pro"ram a byte in the Flash array or the lock bits. The byte4 rite cycle is sel%4timed and typically takes no more than 8.0 ms. 58

*epeat steps 8 throu"h 0, chan"in" the address and data %or the entire array or until the end o% the ob'ect %ile is reached. Data Polling: The -T./S01 %eatures :ata #ollin" to indicate the end o% a cycle, an attempted read o% the last byte ritten datum on #?.C. ?nce the ritten rite cycle. :urin" a rite

ill result in the complement o% the

rite cycle has been completed, true data are !alid on rite

all outputs, and the next cycle may be"in. :ata #ollin" may be"in any time a%ter a cycle has been initiated. R"ad$:Bu%$:

The pro"ress o% byte pro"rammin" can also be monitored by the *:S<=SS output si"nal. #6.5 is pulled lo a%ter -I9 "oes hi"h durin" pro"rammin" to indicate =3SS. #6.5 is

pulled hi"h a"ain hen pro"rammin" is done to indicate *9-:S. C,i0 Era%": The entire Flash array is erased electrically by usin" the proper combination o% control si"nals and by holdin" -I9<#*?G lo %or 8, ms. The code array is ritten ith all

T8Us. The chip erase operation must be executed be%ore the code memory can be re4 pro"rammed.

51

R"ading t," #ignatur" B$t"%: The si"nature bytes are read by the same procedure as a normal !eri%ication o% locations ,6,H, ,68H, and ,61H, except that #6.+ and #6.C must be pulled to a lo"ic lo . The !alues returned are as %ollo s. @,6,HA Q 89H indicates manu%actured by -tmel @,68HA Q 08H indicates ./208 @,61HA Q FFH indicates 81; pro"rammin" @,61HA Q ,0H indicates 0; pro"rammin" Programming Int"r ac": 9!ery code byte in the Flash array can be ritten and the entire array can be erased by rite operation cycle is sel%

usin" the appropriate combination o% control si"nals. The timed and once initiated,

ill automatically time itsel% to completion. -ll ma'or

pro"rammin" !endors o%%er orld ide support %or the -tmel microcontroller series.

56

CHAPTER )

<I;HT1E/ITTIN; DIODE -<ED.


).1 Introduction:
Ii"ht4emittin" diodes are elements %or li"ht si"nali7ation in electronics. They are manu%actured in di%%erent shapes, colors and si7es. For their lo %irst place. They per%orm similar to common diodes li"ht hen current %lo s throu"h them. price, lo consumption and simple use, they ha!e almost completely pushed aside other li"ht sources4 bulbs at ith the di%%erence that they emit

%i" 0.8: I9: )t is important to kno that each diode ill be immediately destroyed unless its current is limited. This means that a conductor must be connected in parallel to a diode. )n order to correctly determine !alue o% this conductor, it is necessary to kno diodeGs !olta"e drop in %or ard direction, hich depends on hat material a diode 55

is made o% and

hat colour it is. ;alues typical %or the most %re&uently used diodes are

sho n in table belo : -s seen, there are three main types o% I9:s. tandard ones "et %ul bri"htness at current o% 1,m-. !ow Current diodes "et %ul bri"htness at ten times lo er current hile uper "right diodes produce more intensi!e li"ht than Standard ones. Since the .,08 microcontrollers can pro!ide only lo are con%i"ured as outputs output pinA. input current and since their pins

hen !olta"e le!el on them is e&ual to ,, direct connectin" to

I9:s is carried out as it is sho n on %i"ure @ !ow current I9:, cathode is connected to

).2 #+itc,"% and Pu%,!utton%


There is nothin" simpler than thisV This is the simplest explanation o% ho these components operate. ay o% controllin" appearance o%

some !olta"e on microcontrollerGs input pin. There is also no need %or additional

%i" 0.1: led inter%acin" Ne!ertheless, it is not so simple in practice... This is about somethin" commonly unnoticeable hen usin" these components in e!eryday li%e. )t is about contact bounce4 a ith m e c h a n i c a l s itches. )% contact s itchin" does not happen hole this process common problem

so &uickly, se!eral consecuti!e bounces can be noticed prior to maintain stable state. The reasons %or this are: !ibrations, sli"ht rou"h spots and dirt. -ny ay, does not last lon" @a %e micro4 or milisecondsA, but lon" enou"h to be re"istered by the

microcontroller. 2oncernin" pulse counter, error occurs in almost 8,,W o% casesV

50

%i" 0.6: led inter%acin"1 The simplest solution is to connect simple *2 circuit hich ill TsuppressU each &uick

!olta"e chan"e. Since the bouncin" time is not de%ined, the !alues o% elements are not strictly determined. )n the most cases, the !alues sho n on %i"ure are su%%icient. )% complete sa%ety is needed, radical measures should be takenV The circuit, sho n on the %i"ure @*S %lip4%lopA, chan"es lo"ic state on its output ith the %irst pulse tri""ered by contact bounce. 9!en thou"h this is more expensi!e solution @S#:T s itchA, the problem is de%initely resol!edV =esides, since the condensator is not used, !ery short pulses can be also re"istered in this ay. )n addition to these hard are solutions, a simple so%t are hen a pro"ram tests the state o% some input pin and solution is commonly applied too:

%inds chan"es, the check should be done one more time a%ter certain time delay. )% the chan"e is con%irmed it means that s itch @or pushbuttonA has chan"ed its position. The ad!anta"es o% such solution are ob!ious: it is %ree o% char"e, e%%ects o% disturbances are eliminated too and it can be ad'usted to the orst4&uality contacts.

5+

CHAPTER 2

THEOR4 O' DC /OTOR


+.8 Introduction: The speed o% a :2 motor is directly proportional to the supply !olta"e, so i% this be achie!ed hen the battery is %ixed at 81 ;oltsX The speed controller e reduce orks by the supply !olta"e %rom 81 ;olts to + ;olts, the motor ill run at hal% the speed. Ho can !aryin" the a!era"e !olta"e sent to the motor. )t could do this by simply ad'ustin" the !olta"e sent to the motor, but this is &uite ine%%icient to do. - better notice it, it only notices the a!era"e e%%ect. When you atch a %ilm in the cinema, or the tele!ision, hat you are actually seein" is a ay is to s itch the motor$s supply on and o%% !ery &uickly. )% the s itchin" is %ast enou"h, the motor doesn$t

series o% %ixed pictures,

hich chan"e rapidly enou"h that your eyes 'ust see the a!era"e

e%%ect 4 mo!ement. Sour brain %ills in the "aps to "i!e an a!era"e e%%ect. No ima"ine a li"ht bulb ith a s itch. When you close the s itch, the bulb "oes on and is at %ull bri"htness, say 8,, Watts. When you open the s itch it "oes o%% @, WattsA. No i% you close the s itch %or a %raction o% a second, then open it %or the same amount o% time, the %ilament a!era"e "lo ;olts, and on$t ha!e time to cool do n and heat up, and you lamp dimmers ill 'ust "et an o% 0, Watts. This is ho ork, and the same principle is

used by speed controllers to dri!e a motor. When the s itch is closed, the motor sees 81 hen it is open it sees , ;olts. )% the s itch is open %or the same amount o% ill see an a!era"e o% + ;olts, and ill run more slo ly time as it is closed, the motor

accordin"ly. The "raph belo sho s the speed o% a motor that is bein" turned on and o%%

5C

2.2 H1BRID;E:
-n H4brid"e is an electronic circuit hich enables :2 electric motors to be run %or ards or back ards. These circuits are o%ten used in robotics. H4brid"es are a!ailable as inte"rated circuits, or can be built %rom discrete components. 'ig 2.1: H1Bridg"

The t o basic states o% a H4brid"e.The term EH4brid"eE is deri!ed %rom the typical "raphical representation o% such a circuit. -n H4brid"e is built closed @and S1 and S6 are openA a positi!e !olta"e allo in" re!erse operation o% the motor. 3sin" the nomenclature abo!e, the s itches S8 and S1 should ne!er be closed at the same time, as this ould cause a short circuit on the input !olta"e source. The same applies to the s itches S6 and S5. This condition is kno n as shoot4throu"h. ith %our s itches @solid4 state or mechanicalA. When the s itches S8 and S5 @accordin" to the %irst %i"ureA are ill be applied across the motor. =y openin" S8 and S5 s itches and closin" S1 and S6 s itches, this !olta"e is re!ersed,

O0"ration The H4=rid"e arran"ement is "enerally used to re!erse the polarity o% the motor, but can also be used to $brake$ the motor, here the motor comes to a sudden stop, as the motors terminals are shorted, or to let the motor $%ree run$ to a stop, as the motor is e%%ecti!ely disconnected %rom the circuit. The %ollo in" table summari7es operation. 5.

Ta!l" 2.1: H1Bridg" o0"ration #1 #2 #& #( R"%ult

8 , , 8

(otor ri"ht

mo!es

, 8 8 , (otor mo!es le%t

, , , , (otor %ree runs

, 8 , 8 (otor brakes

2.& H1Bridg" Dri*"r:


The s itchin" property o% this H4=rid"e can be replace by a Transistor or a *elay or e!en by an )2. Here '"atur"%: +,,m- ?3T#3T 23**9NT 2-#-=)I)TS #9* 2H-NN9I 8.1- #9-N ?3T#3T 23**9NT @non repetiti!eA 9N-=I9 F-2)I)TS ?;9*T9(#9*-T3*9 #*?T92T)?N I?G)2-I E,E )N#3T ;?IT-G9 3# T? 8.0 ; @H)GH N?)S9 )((3N)TSA e are replacin" this ith an )2 named I1/6: as the dri!er hose description is as "i!en belo .

2.( D"%cri0tion:
The :e!ice is a monolithic inte"rated hi"h !olta"e, hi"h current %our channel dri!er desi"ned to accept standard :TI or TTI lo"ic le!els and dri!e inducti!e loads @such as 5/

relays solenoids, :2 and steppin" motorsA and s itchin" po er transistors. To simpli%y use as t o brid"es each pair o% channels is e&uipped ith an enable input. - separate supply input is pro!ided %or the lo"ic, allo in" operation at a lo er !olta"e and internal clamp diodes are included. This de!ice is suitable %or use in s itchin" applications at %re&uencies up to 0 kH7. The I1/6: is assembled in a 8+ lead plastic packa"e 1, lead sur%ace mount sinkin". hich has 5 center pins connected to"ether and used %or heat sinkin" The I1/6:: is assembled in a hich has . center pins connected to"ether and used %or heat

B<OC= DIA;RA/:

'ig 2.2 : H1!ridg" ckt

Ta!l" 2.2: AB#O<UTE /ACI/U/ RATIN;#

0,

PIN CONNECTION#

Fi" +.6 : pin connections o% H4brid"e

08

CHAPTER 7

ADVANTAGES AND APPLICATIONS


7.1 Advantages
8. Not line o% si"ht 1. Not blocked by common materials: can penetrate most solids and pass throu"h alls 6. Ion"er ran"e 5. Not li"ht sensiti!e 0. Not as sensiti!e to eather<en!ironmental conditions

@.2 A00lication%:
8A )ndustries are usin" *F solutions %or monitorin", control, process, in!entory trackin", data links and bar code readin" de!ices. 1A 2ommercial ireless applications such as door announcers, security and access

systems, "ate control, remote acti!ation, score board and pa"in" systems. 6A -utomoti!e companies employin" *F %or entry and sa%ety applications. 5A 2onsumer products includin" electronic toys, home security, "ate and "ara"e door openers, )ntercom, %ire and sa%ety systems, and irri"ation controllers. 0A (edical products like patient call and monitorin", handicap assistance de!ice, sur"ery 2ommunication system, remote patient data lo""in" and 92G monitor. ireless remote control, remote keyless

01

CHAPTER A PROFECT CODIN;


A.1 RECEI?ER:
BHard are: sp!al e&u 5,h or" ,,,,h s'mp po eron or" ,,,6h reti or" ,,,bh reti or" ,,86h reti or" ,,8bh reti or" ,,16h reti or" ,,1bh reti or" ,,66h po eron: mo! sp,Y,%%h (?; )9,Y,,H (?; )#,Y,,H (?; #,,Y,FFH (?; #8,Y,FFH B :isable all the interrupts B :issable the interrupt priority re"ister B (o!e ,FFH in in port , B (o!e ,FFH in in port 8 06

(?; #1,Y,FFH (?; #6,Y,FFH clr ledtr mo! sp,Ysp!al mainloop: mo! a,p8 anl a,Y,%h c'ne a,Y1d,'8 setb p,., clr p,.8 setb p,.1 clr p,.6 '8:c'ne a,Y.d,'1 clr p,., setb p,.8 clr p,.1 setb p,.6 '1:c'ne a,Y+d,'6 setb p,., clr p,.8 clr p,.1 clr p,.6 '6:c'ne a,Y5d,'5 clr p,., clr p,.8 setb p,.1

B (o!e ,FFH in in port 1

05

clr p,.6 '5:ret s'mp mainloop end

A.2 Tran%mitt"r
BHard are: ledport e&u p, leddsp e&u p8 ledtr e&u p8.5 sp!al e&u 5,h kp e&u 0,h kpl e&u 08h ro , e&u p1., ro 8 e&u p1.8 ro 1 e&u p1.1 ro 6 e&u p1.6 col, e&u p1.5 col8 e&u p1.0 col1 e&u p1.+ or" ,,,,h s'mp po eron or" ,,,6h reti or" ,,,bh reti 00

or" ,,86h reti or" ,,8bh reti or" ,,16h reti or" ,,1bh reti or" ,,66h po eron: mo! sp,Y,%%h (?; )9,Y,,H (?; )#,Y,,H (?; #,,Y,FFH (?; #8,Y,FFH (?; #1,Y,FFH (?; #6,Y,FFH clr ledtr mo! sp,Ysp!al mainloop: acall keycheck acall keyaction s'mp mainloop keycheck: setb col, setb col8 setb col1 0+ B :isable all the interrupts B :isable the interrupt priority re"ister B (o!e ,FFH in in port , B (o!e ,FFH in in port 8 B (o!e ,FFH in in port 1

clr col, 'nb ro ,,l8 'nb ro 8,l5 'nb ro 1,lC 'nb ro 6,l8, setb col, clr col8 'nb ro ,,l1 'nb ro 8,l0 'nb ro 1,l. 'nb ro 6,l88 setb col8 clr col1 'nb ro ,,l6 'nb ro 8,l+ 'nb ro 1,l/ 'nb ro 6,l81 setb col1 mo! kp,Y,,h ret l8:mo! kp,Y8d ret l1:mo! kp,Y1d ret l6:mo! kp,Y6d ret 0C

l5:mo! kp,Y5d ret l0:mo! kp,Y0d ret l+:mo! kp,Y+d ret lC:mo! kp,YCd ret l.:mo! kp,Y.d ret l/:mo! kp,Y/d ret l8,:mo! kp,Y8,d ret l88:mo! kp,Y88d ret l81:mo! kp,Y81d ret keyaction: mo! a,kp anl a,Y,%h mo! kpl,a mo! leddsp,kpl ret

0.

CONC<U#ION
This pro'ect presents a metal detectin" robot usin" *F communication audio and !ideo transmission and it is desi"ned and implemented ith ireless

ith -tmel ./S01

(23 in embedded system domain. The robot is mo!ed in particular direction usin" s itches and the ima"es are captured alon" ith the audio and ima"es are atched on the tele!ision .9xperimental ork has been carried out care%ully. The result sho s that hi"her e%%iciency is indeed achie!ed usin" the embedded system. The proposed method is !eri%ied to be hi"hly bene%icial %or the security purpose and industrial purpose.

0/

APPENDIC 1 'lo+ C,art #$m!ol%

Ta!l" A00"ndiD 1.1 'lo+ C,art #$m!ol%

#$m!ol Nam"
?!al

#$m!ol

P!r"#se
:enotes be"innin" or end o% the %lo chart

Rectangle

:enotes a process to be carried out

#arallelo"ram

:enotes an in or output operation

*hombus

:enotes a decision or branch to be made

-rro

:enotes the direction o% %lo o% lo"ic

+,

APPENDIX 2 AT89S52 INSTRUCTION SET

:ependin" on operation they per%orm, all instructions are di!ided in se!eral "roups:

-rithmetic )nstructions =ranch )nstructions :ata Trans%er )nstructions Io"ic )nstructions =it4oriented )nstructions

Arit,m"tic In%truction%
-rithmetic instructions per%orm se!eral basic operations such as addition, subtraction, di!ision, multiplication etc Ta!l" A00"ndiD 2.1 Arit,m"tic In%truction%

ARITH/ETIC IN#TRUCTION# /n"monic -:: -,*n -:: -,direct -:: -,Z*i -:: -,Ydata -::2 -,*n -::2 -,direct -::2 -,Z*i -::2 -,Ydata S3== -,*n S3== -,direct D"%cri0tion -dds the re"ister to the accumulator -dds the direct byte to the accumulator -dds the indirect *-( to the accumulator -dds the immediate data to the accumulator -dds the re"ister to the accumulator ith a carry %la" -dds the direct byte to the accumulator ith a carry %la" -dds the indirect *-( to the accumulator ith a carry %la" -dds the immediate data to the accumulator ith a carry %la" Subtracts the re"ister %rom the accumulator ith a borro Subtracts the direct byte %rom the accumulator ith a borro +8 B$t" C$cl" 8 1 8 1 8 1 8 1 8 1 8 1 1 1 8 1 1 1 8 1

S3== -,Z*i S3== -,Ydata )N2 )N2 *n )N2 *x )N2 Z*i :92 :92 *n :92 *x :92 Z*i )N2 :#T* (3I -= :); -= :- -

Subtracts the indirect *-( %rom the accumulator ith a borro Subtracts the immediate data %rom the accumulator ith a borro )ncrements the accumulator by 8 )ncrements the re"ister by 8 )ncrements the direct byte by 8 )ncrements the indirect *-( by 8 :ecrements the accumulator by 8 :ecrements the re"ister by 8 :ecrements the direct byte by 8 :ecrements the indirect *-( by 8 )ncrements the :ata #ointer by 8 (ultiplies - and = :i!ides - by = :ecimal ad'ustment o% the accumulator accordin" to =2: code

8 1 8 8 1 8 8 8 8 1 8 8 8 8

1 1 8 1 6 6 8 8 1 6 6 0 0 8

Branc, In%truction%
There are t o kinds o% branch instructions: 3nconditional 'ump instructions: upon their execution a 'ump to a ne location %rom here the pro"ram continues execution is executed. 2onditional 'ump instructions: a 'ump to a ne pro"ram location is executed only i% a speci%ied condition is met. ?ther ise, the pro"ram normally proceeds ith the next instruction. Ta!l" A00"ndiD 2.2 Branc, In%truction%

BRANCH IN#TRUCTION# /n"monic -2-II addr88 I2-II addr8+ D"%cri0tion -bsolute subroutine call Ion" subroutine call +1 B$t" C$cl" 1 6 + +

*9T *9T) -D(# addr88 ID(# addr8+ SD(# rel D2 rel DN2 rel D= bit,rel D=2 bit,rel D(# Z-P:#T* D[ rel DN[ rel 2DN9 -,direct,rel 2DN9 -,Ydata,rel 2DN9 *n,Ydata,rel 2DN9 Z*i,Ydata,rel :DN[ *n,rel :DN[ *x,rel N?#

*eturns %rom subroutine *eturns %rom interrupt subroutine -bsolute 'ump Ion" 'ump Short 'ump @%rom >81. to P81C locations relati!e to the %ollo in" instructionA Dump i% carry %la" is set. Short 'ump. Dump i% carry %la" is not set. Short 'ump. Dump i% direct bit is set. Short 'ump. Dump i% direct bit is set and clears bit. Short 'ump. Dump indirect relati!e to the :#T* Dump i% the accumulator is 7ero. Short 'ump. Dump i% the accumulator is not 7ero. Short 'ump. 2ompares direct byte to the accumulator and 'umps i% not e&ual. Short 'ump. 2ompares immediate data to the accumulator and 'umps i% not e&ual. Short 'ump. 2ompares immediate data to the re"ister and 'umps i% not e&ual. Short 'ump. 2ompares immediate data to indirect re"ister and 'umps i% not e&ual. Short 'ump. :ecrements re"ister and 'ump i% not ,. Short 'ump. :ecrements direct byte and 'ump i% not ,. Short 'ump. No operation

8 8 1 6 1 1 1 6 6 8 1 1 6 6 6 6 1 6 8

5 5 6 5 6 6 6 5 5 1 6 6 5 5 5 5 6 5 8

+6

Data Tran% "r In%truction%


:ata trans%er instructions mo!e the content o% one re"ister to another. The re"ister the content o% hich is mo!ed remains unchan"ed. )% they ha!e the su%%ix TJU @(?;JA, the data is exchan"ed ith external memory.

Ta!l" A00"ndiD 2.& Data Tran% "r In%truction%

DATA TRAN#'ER IN#TRUCTION# Mnemonic (?; -,*n (?; -,direct (?; -,Z*i (?; -,Ydata (?; *n,(?; *n,direct (?; *n,Ydata (?; direct,(?; direct,*n (?; direct,direct (?; direct,Z*i (?; direct,Ydata (?; Z*i,(?; Z*i,direct (?; Z*i,Ydata (?; :#T*,Ydata D"%cri0tion (o!es the re"ister to the accumulator (o!es the direct byte to the accumulator (o!es the indirect *-( to the accumulator (o!es the immediate data to the accumulator (o!es the accumulator to the re"ister (o!es the direct byte to the re"ister (o!es the immediate data to the re"ister (o!es the accumulator to the direct byte (o!es the re"ister to the direct byte (o!es the direct byte to the direct byte (o!es the indirect *-( to the direct byte (o!es the immediate data to the direct byte (o!es the accumulator to the indirect *-( (o!es the direct byte to the indirect *-( (o!es the immediate data to the indirect *-( (o!es a 8+4bit data to the data pointer B$t" 8 1 8 1 8 1 1 1 1 6 1 6 8 1 1 6 C$cl" 8 1 1 1 1 5 1 6 6 5 5 6 6 0 6 6

+5

(?;2 -,Z-P:#T* (?;2 -,Z-P#2 (?;J -,Z*i (?;J -,Z:#T* (?;J Z*i,(?;J Z:#T*,#3SH direct #?# direct J2H -,*n J2H -,direct J2H -,Z*i J2H: -,Z*i

(o!es the code byte relati!e to the :#T* to the accumulator @addressQ-P:#T*A (o!es the code byte relati!e to the #2 to the accumulator @addressQ-P#2A (o!es the external *-( @.4bit addressA to the accumulator (o!es the external *-( @8+4bit addressA to the accumulator (o!es the accumulator to the external *-( @.4bit addressA (o!es the accumulator to the external *-( @8+4bit addressA #ushes the direct byte onto the stack #ops the direct byte %rom the stack<td\ 9xchan"es the re"ister ith the accumulator 9xchan"es the direct byte ith the accumulator 9xchan"es the indirect *-( ith the accumulator 9xchan"es the lo 4order nibble indirect *-( ith the accumulator

8 8 8 8 8 8 1 1 8 1 8 8

6 6 648, 648, 5488 5488 5 6 1 6 6 6

<ogic In%truction%
Io"ic instructions per%orm lo"ic operations upon correspondin" bits o% t o re"isters. -%ter execution, the result is stored in the %irst operand.

Ta!l" A00"ndiD 2.( <ogical In%truction%

+0

!#$%C %& T'(CT%#& /n"monic -NI -,*n -NI -,direct -NI -,Z*i -NI -,Ydata -NI direct,-NI direct,Ydata ?*I -,*n ?*I -,direct ?*I -,Z*i ?*I direct,?*I direct,Ydata J*I -,*n J*I -,direct J*I -,Z*i J*I -,Ydata J*I direct,J?*I direct,Ydata 2I* 2#I SW-# *I *I2 ** **2 Description

B$t" -N: re"ister to accumulator -N: direct byte to accumulator -N: indirect *-( to accumulator -N: immediate data to accumulator -N: accumulator to direct byte 8 1 8 1 1 6 8 1 8 1 6 8 1 8 1 1 6 8 8 8 8 8 8 8

C$cl" 8 1 1 1 6 5 8 1 1 6 5 8 1 1 1 6 5 8 8 8 8 8 8 8

-N: immediae data to direct re"ister ?* re"ister to accumulator ?* direct byte to accumulator ?* indirect *-( to accumulator ?* accumulator to direct byte ?* immediate data to direct byte 9xclusi!e ?* re"ister to accumulator 9xclusi!e ?* direct byte to accumulator 9xclusi!e ?* indirect *-( to accumulator 9xclusi!e ?* immediate data to accumulator 9xclusi!e ?* accumulator to direct byte 9xclusi!e ?* immediate data to direct byte 2lears the accumulator 2omplements the accumulator @8Q,, ,Q8A S aps nibbles ithin the accumulator *otates bits in the accumulator le%t *otates bits in the accumulator le%t throu"h carry *otates bits in the accumulator ri"ht *otates bits in the accumulator ri"ht throu"h carry

Bit1ori"nt"d In%truction%
++

Similar to lo"ic instructions, bit4oriented instructions per%orm lo"ic operations. The di%%erence is that these are per%ormed upon sin"le bits. Ta!l" A00"ndiD 2.) Bit1Ori"nt"d In%truction%

BIT1ORIENTED IN#TRUCTION#
Mnemonic

D"%cri0tion 2lears the carry %la" 2lears the direct bit Sets the carry %la" Sets the direct bit 2omplements the carry %la" 2omplements the direct bit -N: direct bit to the carry %la" -N: complements o% direct bit to the carry %la" ?* direct bit to the carry %la" ?* complements o% direct bit to the carry %la" (o!es the direct bit to the carry %la" (o!es the carry %la" to the direct bit

B$t" 8 1 8 1 8 1 1 1 1 1 1 1

C$cl" 8 6 8 6 8 6 1 1 1 1 1 6

2I* 2 2I* bit S9T= 2 S9T= bit 2#I 2 2#I bit -NI 2,bit -NI 2,<bit ?*I 2,bit ?*I 2,<bit (?; 2,bit (?; bit,2

+C

RE'ERENCE#

8. (ohd (a7id @1,,+A .,08 (icrocontroller and 9mbedded System >#earson 9ducation. 1. Nenneth D -yala @1,,6A .,08 (icrocontroller and -rchitecture4:elimar 2en"a"e Iearnin" 6. ;.N (ehtha @8/.,A #rinciple o% 9lectronics4S.2 2hand and 2ompany Itd.

NA/E O' THE #ITE#: 8. 1. 6. 5. .mitel.databook.com .atmel.databook.com .%ranklin.com .keil.com

+.

Vous aimerez peut-être aussi