1. INTR INTROD ODUC UCTI TION ON 1.1 Objective The main objective of this project is to develop a fire detector which can sense the formation of smoke and temperature then actuate the control system to extinguish the fire. Here the system has to detect smoke so that we can detect the fire accidents quickly and avoid the major damage. The environmental conditions that exist in industrial facilities can present huge challenges. High levels of dust and dirt can cause malfunctions and nuisance alarms, smoke smoke diluti dilution on in large large volume volumetri tricc enclos enclosure uress influen influenced ced by air moveme movement nt and stratification make it difficult to detect the early signs of fire. Normally occurring background levels of smoke cannot easily be distinguished from real fire conditions. nheated or un!cooled spaces cause temperature extremes outside of the operating range of some smoke detectors. To provide the best possible fire protection for an industrial application or environment means selecting the correct technology and the most appropriate product in the first instance. The detector must maintain its sensitivity over the life of the detector and provide a low total cost of ownership.
1.2 High Level Design "n any closed area if any fire accidents occur then the damage will be more sometimes even the loss of life. To avoid this we have to detect them as early as possible and take any preventive measures. #ometimes it is not possible for a human being to react quickly. "n such cases the automated systems are very useful. "n this system we are using a smoke sensor which can detect the smoke and send a signal as input to the micro micro controller. The micro controller will be continuously checking the respective respective pin. $hen it gets a high signal signal at that pin it means that smoke smoke has been detected. %t that time it first gives siren to alert any humans in that premises to vacate and then it actuates the extinguishers. They may be the water sprinklers or the &'( containers. %t the same time control appliances based on the light sensor.
)
1.3 Block Diagram
Fig 1: Block Dig!"
The smoke sensor senses the environmental conditions. $hile sensing if there is any bad condition in a particular *one i.e, fire ha*ards, then it gives the commands the sensor for its operation. %t the same time, the measured physical quantity will be displayed on the +&. The output of +& is given to -/) micro controller. 0icro contro controller ller gives gives comman commands ds to operate operate 1u**er 1u**er and sprink sprinkler ler instan instantan taneou eously sly.. To operate sprinkler, we require very less voltage. This voltage is obtained with the help of opto coupler and T2"%&, such that fire is extinguished. +ight sensor senses the environmental condition. "f it is dark, the output of +2 will be high, such that the bulb glows up, else off.
(
2. #$B#DD#D %&%T#$ 2.1 INTRODUCTION &omputers have evolved from few, huge mainframes shared by many people, and mini computers that were smaller but still shared to today3s 4&s5millions in number, miniscule in si*e compared to the mainframes, and used by only one person at a time. The next generation could be invisible, with billions being around and each of us using more than one at a time. $elcome $elcome to the world of embedded systems, systems, of computers that will not look like computers and won3t function like anything we3re familiar with.
2.2 'ht is e"be((e( s)ste"* %n 6mbedded #ystem is a combination of computer hardware and software, and perhaps additional mechanical or other parts, designed to perform a specific function. function. %n embedded embedded system is a microcontro microcontroller!b ller!based, ased, software driven, driven, reliable, reliable, real!time control system, autonomous, or human or network interactive, operating on diverse physical variables and in diverse environments and sold into a competitive and cost conscious market.
Fig 2.1: #"be((e( s)ste" (esign clls
7
%n embedded system is not a computer system that is used primarily for processing, not a software system on 4& or N"8, not a traditional business or scientific application. High!end embedded 9 lower end embedded systems. High!end embed embedde ded d syst system em ! :ene :enera rally lly 7(, 7(, ;< 1it 1it &ont &ontro roll llers ers used used with with '#. '#. 6xam 6xampl ples es 4ersonal igital %ssistant and 0obile phones etc .+ower end embedded systems ! :enerally -,); 1it &ontrollers used with an minimal operating systems and hardware layout designed for the specific purpose.
Fig 2.2: +#"be((e( s)ste" (esign c)cle v (ig!",
2.- Ch!cte!istics o #"be((e( %)ste": =
%n embe embedd dded ed system system is any comp comput uter er system system hidd hidden en insid insidee a prod produc uctt other other than a computer.
=
They They will will encount encounter er a number number of diffi difficul culties ties when when writi writing ng embedd embedded ed system system software in addition to those we encounter when we write applications. >
Throughput > 'ur system may need to handle a lot of data in a short period of time.
>
2esponse>'ur system may need to react to events quickly. quickly.
>
Testability>#etting Testability>#etting up equipment to test embedded software can be difficult.
>
ebugability>$ithout ebugability>$ithout a screen or a keyboard, finding out what the software is doing wrong ?other than not working@ is a troublesome problem.
>
2eliability > embedded systems must be able to handle any situation without human intervention.
<
>
0emory space > 0emory is limited on embedded systems, and you must make the software and the data fit into whatever memory exists.
>
4rogram installation > you will need special tools to get your software s oftware into embedded systems.
>
4ower consumption > 4ortable systems must run on batter y power, and the software in these systems must conserve power.
>
4rocessor hogs > computing that requires large amounts of &4 time can complicate the response problem.
>
&ost > 2educing the cost of the hardware is a concern in many embedded system projectsA software often operates on hardware that is barely adequate for the job.
•
6mbedded systems have a microprocessorB microcontroller and a memory. #ome have a serial port or a network connection. They usually do not not have keyboards, screens or disk drives.
)@ (@ 7@ <@ /@ ;@ C@
/00LIC/TION% 0ilitary and aerospace aerospace embedd embedded ed software software applications applications & o mm m m u ni n i c a ti t i o n % pp p p l i ca c a t i on on s " n d u s t r i a l a u t o m a t io i o n a n d p r o c e s s c on o n t r o l s of of t w a r e 0asteri 0astering ng the comple complexity xity of of applicati applications ons.. 2educt 2eduction ion of prod product uct desig design n time. time. 2eal time time processin processing g of ever increasi increasing ng amounts amounts of data. data. "ntell "ntelligen igent, t, auton autonomo omous us sensor sensors. s.
CL/%%IFIC/TION •
2eal Time #ystems.
•
2T# is one which has to respond to events within a specified deadline.
•
% right answer after the dead line is a wrong answer.
RT% CL/%%IFIC/TION •
Hard 2eal Time #ystems
•
#oft 2eal Time #ystem
H/RD R#/L TI$# %&%T#$ •
DHardD real!time systems have very narrow response time. /
•
6xampleE Nuclear power system, &ardiac pacemaker. %OFT R#/L TI$# %&%T#$
•
D#oftD real!time systems have reduced constrains on DlatenessD but still must operate very quickly and repeatable.
•
6xampleE 2ailway reservation system > takes a few extra seconds the data remains valid.
-. H/RD'/R# R#UIR#$#NT% ;
-.1 0O'#R %U00L& BLOC The input to the circuit is applied from the regulated power supply. The a.c. input i.e., (7F from the mains supply is step down by the transformer to )(F and is fed to a rectifier. The output obtained from the rectifier is a pulsating d.c voltage. #o in order to get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to remove any a.c components present even after rectification. Now, this voltage is given to a voltage regulator to obtain a pure constant dc voltage.
Fig -.1: 0o3e! s455l) ci!c4it (ig!"
-.1.1 T!nso!"e! Transformers convert %& electricity from one voltage to another with a little loss of power. #tep!up transformers increase voltage, step!down transformers reduce voltage. 0ost power supplies use a step!down transformer to reduce the dangerously high voltage to a safer low voltage.
Fig -.1.1: / T)5icl T!nso!"e!
The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coilsA instead they are linked by an alternating magnetic field created in the soft!iron core of the transformer. The two C
lines in the middle of the circuit symbol represent the core. Transformers waste very little power so the power out is ?almost@ equal to the power in. Note that as voltage is stepped down and current is stepped up. The ratio of the number of turns on each coil, called the turn3s ratio, determines the ratio of the voltages. % step!down transformer has a large number of turns on its primary ?input@ coil which is connected to the high voltage mains supply, and a small number of turns on its secondary ?output@ coil to give a low output voltage. T2N# 2%T"' E
$here, Fp G primary ?input@ voltage, Fs G secondary ?output@ voltage Np G number of turns on primary coil Ns G number of turns on secondary coil "p G primary ?input@ current "s G secondary ?output@ current.
-.1.2 Rectiie!: The output from the transformer is fed to the rectifier. "t converts %.&. into pulsating .&. The rectifier may be a half wave or a full wave rectifie r. "n this project, a bridge rectifier is used because of its merits like good stability and full wave rectification.
Fig -.1.2: F4ll B!i(ge Rectiie!
-.1.- Filte!: &apacitive filter is used in this project. "t removes the ripples from the output of rectifier and smoothens the .&. 'utput received from this filter is constant until -
the mains voltage and load is maintained constant. However, if either of the two is varied, .&. voltage received at this point changes. Therefore a regulator is applied at the output stage.
Fig -.1.-: C5citive Filte!
-.1.6 7oltge !eg4lto! %s the name itself implies, it regulates the input applied to it. % voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. "n this project, power supply of /F and )(F are required. "n order to obtain these voltage levels, C-/ and C-)( voltage regulators are to be used. The first number C- represents positive supply and the numbers /, )( represent the required output voltage levels. Fet4!es
= 'utput &urrent up to )%. = 'utput Foltages of /, ;, -, , ), )(, )/, )-, (
Fig -.1.6: L$89; 7oltge !eg4lto!
The +0C-/ is simple to use. Iou simply connect the positive lead of your unregulated & power supply ?anything from F& to (
-.2 $ic!ocont!olle! /T9<%;2 The %T-#/( is a low!power, high!performance &0'# -!bit microcontroller with -J bytes of in!system programmable Klash memory. The device is manufactured using %tmel3s high!density non volatile memory technology and is compatible with the industry standard -&/) instruction set and pin out. The on!chip Klash allows the program memory to be reprogrammed in!system or by a conventional non volatile memory programmer. 1y combining a versatile -!bit &4 with in!system programmable Klash on a monolithic chip, the %tmel %T-#/( is a powerful microcontroller which provides a highly!flexible and cost!effective solution to many embedded control applications. The %T-#/( provides the following standard featuresE -J bytes of Klash, (/; bytes of 2%0, 7( "B' lines, $atchdog timer, two data pointers, three );!bit timerBcounters, a six!vector two!level interrupt architecture, a full duplex serial port, on!chip oscillator, and clock circuitry. "n addition, the %T-#/( is designed with static logic for operation down to *ero frequency and supports two software selectable power saving modes. The "dle 0ode stops the &4 while allowing the 2%0, timerBcounters, serial port, and interrupt system to continue functioning. The 4ower!down mode saves the 2%0
)
contents but free*es the oscillator, disabling all other chip functions until the next interrupt or hardware reset.
Block Dig!" o /T9<%;2:
Fig -.2: Block (ig!" o /T9<%;2
Fet4!es = &ompatible with 0L!/) 4roducts = -J 1ytes of "n!#ystem 4rogrammable ?"#4@ Klash 0emory > 6nduranceE ), $riteB6rase &ycles = <.F to /./F 'perating 2ange = Kully #tatic 'perationE H* to 77 0H* = Three!level 4rogram 0emory +ock = (/; x -!bit "nternal 2%0 = 7( 4rogrammable "B' +ines ))
= Three );!bit TimerB&ounters = 6ight "nterrupt #ources = Kull uplex %2T #erial &hannel = +ow!power "dle and 4ower!down 0odes = "nterrupt 2ecovery from 4ower!down 0ode = $atchdog Timer = ual ata 4ointer = 4ower!off Klag = Kast 4rogramming Time = Klexible "#4 4rogramming ?1yte and 4age 0ode@ = :reen ?4bBHalide!free@ 4ackaging 'ption
0in Conig4!tions o /T9<%;2
Fig -.-: 0in (ig!" o /T9<%;2 0in Desc!i5tion: 7CC:
#upply voltage. =ND:
:round
)(
0o!t :
4ort is an -!bit open drain bidirectional "B' port. %s an output port, each pin can sink eight TT+ inputs. $hen )s are written to port pins, the pins can be used as high!impedance inputs. 4ort can also be configured to be the multiplexed low!order addressBdata bus during accesses to external program and data memory. "n this mode, 4 has internal pull!ups. 4ort also receives the code bytes during Klash programming and outputs the code bytes during program verification. 6xternal pull! ups are required during program verification.
0o!t 1:
4ort ) is an -!bit bidirectional "B' port with internal pull!ups. The 4ort ) output buffers can sinkBsource four TT+ inputs. $hen )s are written to 4ort ) pins, they are pulled high by the internal pull!ups and can be used as inputs. %s inputs, 4ort ) pins that are externally being pulled low will source current ?""+@ because of the internal pull!ups. "n addition, 4). and 4).) can be configured to be the timerBcounter ( external count input ?4).BT(@ and the timerBcounter ( trigger input ?4).)BT(68@.
0o!t 2:
4ort ( is an -!bit bidirectional "B' port with internal pull!ups. The 4ort ( output buffers can sinkBsource four TT+ inputs. $hen )s are written to 4ort ( pins, they are pulled high by the internal pull!ups and can be used as inputs. %s inputs, 4ort ( pins that are externally being pulled low will source current ?""+@ because of the internal pull!ups. 4ort ( emits the high!order address byte during fetches from external program memory and during accesses to external data memory that uses );! bit addresses ?0'F8 M 4T2@. "n this application, 4ort ( uses strong internal pull! ups when emitting )s. uring accesses to external data memory that uses -!bit addresses ?0'F8 M 2"@, 4ort ( emits the contents of the 4( #pecial Kunction 2egister.
0o!t -:
4ort 7 is an -!bit bidirectional "B' port with internal pull!ups. The 4ort 7 output buffers can sinkBsource four TT+ inputs. $hen )s are written to 4ort 7 pins, they are pulled high by the internal pull!ups and can be used as inputs. %s inputs, 4ort
)7
7 pins that are externally being pulled low will source current ?""+@ because of the pull!ups.
R%T:
2eset input. % high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives high for - oscillator periods after the $atchdog times out. The "#2T' bit in #K2 %82 ?address -6H@ can be used to disable this feature. "n the default state of bit "#2T', the 26#6T H":H out feature is enabled.
/L#>0RO=:
%ddress +atch 6nable ?%+6@ is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input ?42':@ during Klash programming. "n normal operation, %+6 is emitted at a constant rate of )B; the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one %+6 pulse is skipped during each access to external data memory.
0%#N:
4rogram #tore 6nable ?4#6N@ is the read strobe to external program memory. $hen the %T-#/( is executing code from external program memory, 4#6N is activated twice each machine cycle, except that two 4#6N activations are skipped during each access to external data memory.
#/>700:
6xternal %ccess 6nable. 6% must be strapped to :N in order to enable the device to fetch code from external program memory locations starting at H up to KKKKH. Note, however, that if lock bit ) is programmed, 6% will be internally la tched on reset. 6% should be strapped to F&& for internal program executions. This pin also receives the )(!volt programming enable voltage ?F44@ during Klash programming.
?T/L1:
"nput to the inverting oscillator amplifier and input to the internal clock operating circuit. )<
?T/L2:
'utput from the inverting oscillator amplifier.
Oscillto! Ch!cte!istics:
8T%+) and 8T%+( are the input and output, respectively, of an inverting amplifier which can be configured for use as an on!chip oscillator, as shown in Kigure ). 6ither a quart* crystal or ceramic resonator may be used. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide!by!two flip!flop, but minimum and maximum voltage high and low time specifications must be observed. I(le $o(e
"n idle mode, the &4 puts itself to sleep while all the on chip peripherals remain active. The mode is invoked by software. The content of the on!chip 2%0 and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset.
0o3e! (o3n $o(e
"n the power down mode the oscillator is stopped, and the instruction that invokes power down is the last instruction executed. The on!chip 2%0 and #pecial Kunction 2egisters retain their values until the power down mode is terminated. The only exit from power down is a hardware reset. 2eset redefines the #K2s but does not change the on!chip 2%0. The reset should not be activated before F&& is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabili*e.
-.- LDR @Light De5en(ent Resisto!A % photo resistor or light dependent resistor ?+2@ is a resistor whose resistance decreases with increasing incident light intensityA in other words, it exhibits photoconductivity. % photo resistor is made of a high resistance semiconductor. "f light falling on the device is of high enough frequency, photons absorbed by the semiconductor give bound electrons enough energy to jump into the conduction band. The resulting free electron ?and its hole partner@ conduct electricity, thereby lowering resistance. % photoelectric device can be either intrinsic or extrinsic. %n intrinsic )/
semiconductor has its own charge carriers and is not an efficient semiconductor, for example, silicon. "n intrinsic devices the only available electrons are in the valence band, and hence the photon must have enough energy to excite the electron across the entire band gap.
Fig -.6: LDR
6xtrinsic devices have impurities, also called do pants, added whose ground state energy is closer to the conduction bandA since the electrons do not have as far to jump, lower energy photons ?that is, longer wavelengths and lower frequencies@ are sufficient to trigger the device. "f a sample of silicon has some of its atoms replaced by phosphorus atoms ?impurities@, there will be extra electrons available for conduction. This is an example of an extrinsic semiconductor. 4hoto resistors are basically photocells.
e) %5eciictions>%5ecil Fet4!es:
#pecificationsE
•
o
0aximum power consumptionE /F &
o
0aximum peak valueE /m$
o
#pectrum peak valueE /<nm
o
+ight resistanceE / to )k
o
ark resistanceE .;0
4erformances and featuresE
•
o
&oated with epoxy
o
:ood reliability
o
#mall volume
o
High sensitivity );
o
Kast response
o
:ood spectrum characteristic Typical applicationsE
•
o
&amera automatic photometry
o
4hotoelectric controls
o
"ndoor ray controls
o
%nnunciation
o
"ndustrial controls
o
+ight control switches
o
+ight control lamps
o
6lectronic toys 0easuring conditionsE
•
+ight resistanceE measured at ) lux with standard light % ?(-/
o
color temperature@ and (hrs illumination at < to ; lux prior to testing. o
ark resistanceE measured ) seconds after closed ) lux.
o
:amma characteristicE between ) lux and ) lux and given byO G lg ?2)B2)@ 2), 2) &ell resistance at ) lux and ) lux
o
The error of O is P .).
o
4maxE maximum power dissipation at ambient temperature of (/ Q&.
o
FmaxE maximum voltage in darkness that may be applied to the cell continuously.
-.6 L$-; The +07/ series are precision integrated!circuit temperature sensors, whose output voltage is linearly proportional to the &elsius ?&entigrade@ temperature. The +07/ thus has an advantage over linear temperature sensors calibrated in Q Jelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient &entigrade scaling. The +07/ does not require any external calibration or trimming to provide typical accuracies of P)R
power supplies, or with plus and minus supplies. %s it draws only ; U% from its supply, it has very low self!heating, less than .)Q& in still air. The +07/ is rated to operate over a S//Q to )/Q& temperature range.
Fet4!es: •
&alibrated directly in Q &elsius ?&entigrade@
•
+inear ). mFBQ& scale factor
•
./Q& accuracy guarantee able ?at (/Q&@
•
2ated for full S//Q to )/Q& range
•
#uitable for remote applications
•
+ow cost due to wafer!level trimming
•
'perates from < to 7 volts
•
+ess than ; U% current drain
•
+ow self!heating, .-Q& in still air
•
•
Nonlinearity only P)R
T)5icl /55lictions
Fig -.;: Bsic Centig!(e Te"5e!t4!e %enso!
-.6.1 $2 =/% %#N%OR "t can detectE +4:, i!butane, propane, methane, alcohol, Hydrogen, smoke
)-
Fig -.: $2 =s %enso! Desc!i5tion:
0V!( #emiconductor #ensor for &ombustible :as #ensitive material of 0V!( gas sensor is #n'(, which with lower conductivity in clean air. $hen the target combustible gas exist, the sensors conductivity is more high along with the gas concentration rising. 4lease use simple electro circuit, &onvert change of conductivity to correspond output signal of gas concentration. 0V!( gas sensor has high sensitivity to +4:, 4ropane and Hydrogen, also could be used to 0ethane and other combustible steam,
it
is
with
low
cost
and
suitable
for
different
application.
Ch!cte!istics:
)
High sensitivity to &ombustible gas in wide range
(
High sensitivity to +4:, 4ropane 9 Hydrogen
7
Kast response
<
$ide detection range
/
#table performance long life low cost
;
#imple drive circuit
.
.
.
.
.
.
/55lictions:
). omestic gas leakage detector (. "ndustrial &ombustible gas detector 7. 4ortable gas detector <. They are used in gas leakage detecting equipments in family and industry, are suitable for detecting of +4:, i!butane, propane, methane, alcohol, Hydrogen, smoke.
-.; /DC99><
)
The %&--, %&- data acquisition component is a monolithic &0'# device with an -!bit analog!to!digital converter, -!channel multiplexer and microprocessor compatible control logic. The -!bit %B converter uses successive approximation as the conversion technique. The converter features a high impedance chopper stabili*ed comparator, a (/;2 voltage divider with analog switch tree and a successive approximation register. The -!channel multiplexer can directly access any of -!single!ended analog signals.
Fig -.8: 0in (ig!"
FUNCTION/L D#%CRI0TION $4lti5lee!:
The device contains an -!channel single!ended analog signal multiplexer. % particular input channel is selected by using the address decoder. The below table shows the input states for the address lines to select any channel. The address is latched into the decoder on the low! to!high transition of the address latch enable signal.
CON7#RT#R CH/R/CT#RI%TIC% The Conve!te!
The heart of this single chip data acquisition system is its -!bit analog!to!digital converter. The converter is designed to give fast, accurate, and repeatable conversions over a wide range of temperatures. The converter is partitioned into 7 major sectionsE the (/;2 ladder network, the successive approximation register, and the comparator. The converter3s
(
digital outputs are positive true. The (/;2 ladder network approach ?Kigure )@ was chosen over the conventional 2B(2 ladder because of its inherent monotonicity, which guarantees no missing digital codes. 0onotonicity is particularly important in closed loop feedback control systems. % non!monotonic relationship can cause oscillations that will be catastrophic for the system. %dditionally, the (/;2 network does not cause load variations on the reference voltage. The %B converter3s successive approximation register ?#%2@ is reset on the positive edge of the start conversion ?#&@ pulse. The conversion is begun on the falling edge of the start conversion pulse. % conversion in process will be interrupted by receipt of a new start conversion pulse. &ontinuous conversion may be accomplished by tying the end of conversion ?6'&@ output to the #& input. "f used in this mode, an external start conversion pulse should be applied after power up. 6nd!of!conversion will go low between and - clock pulses after the rising edge of start conversion. The most important section of the %B converter is the comparator. "t is this section which is responsible for the ultimate accuracy of the entire converter. "t is also the comparator drift which has the greatest influence on the repeatability of the device. % chopper!stabili*ed comparator provides the most effective method of satisfying all the converter requirements.
I>O 0ins
•
/DDR#%% LIN# /E BE C
The device contains -!channels. % particular channel is selected by using the address decoder line. The above table shows the input states for address lines to s elect any channel.
•
/((!ess Ltch #nble /L#
The address is latched on the +ow > High transiti on of %+6.
()
•
%T/RT
The %&3s #uccessive %pproximation 2egister ?#%2@ is reset on the positive edge i.e. +ow! High of the #tart &onversion pulse. $hereas the conversion is begun on the falling edge i.e. high > +ow of the pulse.
•
O4t54t #nble
$henever data has to be read from the %&, 'utput 6nable pin has to be pulled high thus enabling the T2"!#T%T6 outputs, allowing data to be read from the data pins !C.
•
#n( o Conve!sion @#OCA
This 4in becomes high when the conversion has ended, so the controller comes to know that the data can now be read from the data pins.
•
Clock
6xternal clock pulses are to be given to the %&A this can be given either from +0 /// in %stable mode or the controller can also be used to give the pulses. /L=ORITH$
). #tart. (. #elect the channel. 7. % +ow > High transition on %+6 to latch in the address. <. % +ow > High transition on #tart to reset the %&3s #%2. /. % High > +ow transition on %+6. ;. % High > +ow transition on start to start the conversion. C. $ait for 6nd of cycle ?6'&@ pin to become high. -. 0ake 'utput 6nable pin High.
((
. Take ata from the %&3s output ). 0ake 'utput 6nable pin +ow. )). #top The clock can also be provided through the controller thus eliminating the need of external circuit for clock. Clc4lting %te5 %ie
%& -- is an - bit %& i.e. it divides the voltage applied at F ref 9 Fref! into (- i.e. (/; steps. #tep #i*e G ?Fref ! Fref!@B(/; #uppose Fref is connected to F cc i.e. /F 9 Fref! is connected to the ground, then the step si*e will be #tep si*eG ?/ ! @B(/;G )./7 mv. Clc4lting Do4t
The data we get at the ! C depends upon the st ep si*e 9 the "nput voltage i.e. F in. out G Fin Bstep #i*e.
/DC INT#RF/CIN= 'ITH $ICROCONTROLL#R
Fig -.9: /DC inte!cing 3ith "ic!ocont!olle!
(7
The address and data pins of %& can be connected to any of the ports of -/).
-. TRI/C @T!io(e o! /lte!nting C4!!entA The triac is a three terminal semiconductor device for controlling current. "t is effectively a development of the #&2 or thyristor, but unlike the thyristor which is only able to conduct in one direction, the triac is a bidirectional device. %s such the triac is an ideal device to use for %& switching applications because it can control the current flow over both halves of an alternating cycle. % thyristor is only able to control them over one half of a cycle. uring the remaining half no conduction occurs and accordingly only half the waveform can be utili*ed . TRI/C Bsics
There are three terminal on a triac. These are the :ate and two other terminals. These other triac terminals are often referred to as an D%nodeD or D0ain TerminalD
Fig -.<: TRI/C ci!c4it s)"bol
The gate, that acts as the trigger to turn the device 'N. The current then flows between the two anodes or main terminals. These are usually designated %node ) and %node ( or 0ain Terminal ) and 0ain Terminal ( ?0T) and 0T(@. "t can be imagined from the circuit symbol that the triac consists of two thyristors back to back. The operation of the triac can be looked on in this fashion, although the actual operation at the semiconductor level is rather complicated. $hen the voltage on the 0T) is positive with regard to 0T( and a positive gate voltage is applied, one of the #&2s conducts. $hen the voltage is reversed and a negative (<
voltage is applied to the gate, the other #&2 conducts. This is provided that there is sufficient voltage across the device to enable a minimum holding current to flow. TRI/C O5e!tion
The structure of a triac may be considered as a p!n!p!n structure and the triac may be considered to consist of two conventional #&2s fabricated in an inverse parallel configuration. "n operation, when terminal %( is positive with respect to %), then a positive gate voltage will give rise to a current that will trigger the part of the triac consisting of p) n) p( n( and it will have an identical characteristic to an #&2. $hen terminal %( is negative with respect to %) a negative current will trigger the part of the triac consisting of p( n) p) n7. "n this way conduction on the triac occurs over both halves an alternating cycle.
Fig -.1: TRI/C TRI/C %t!4ct4!e
Triac do not fire symmetrically as a result of slight differences between the two halves of the device. This results in harmonics being generated and the less symmetrical the triac fires, the greater the level of harmonics produced. "t is generally undesirable to have high levels of harmonics in a power system and as a result triacs are not favoured for high power systems. "nstead two thyristors may be used as it is easier to control their firing. To help in overcoming this problem, a device known as a diac ?diode %& switch@ is often placed in series with the gate. This device helps make the switching more even for both halves of the cycle. This results from the fact that the diac switching characteristic is far more even than that of the triac. #ince the diac prevents (/
any gate current flowing until the trigger voltage has reached a certain voltage in either direction, this makes the firing point of the triac more even in both directions.
-.8 C!)stl Oscillto! @11.;<2$HA "t provide clock pulses of ))./( 0h* frequency. "t can be used as %2T clock ?;W).-<7( 0H*@. "t allows integer division to common baud rates ?;W))/( baud or ;W;W),( baud@. "t
is
a common
clock
for "ntel
-/) microprocessors. "t uses
the
mechanical resonance of a vibrating crystal of pie*oelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time, to provide a stable clock signal for digital integrated circuits, and to stabili*e frequencies for radio transmitters and receivers. The most common type of pie*oelectric resonator used is the quart* crystal, so oscillator circuits incorporating them became known as crystal oscillators.
Fig -.11: C!)stl oscillto!
The crystal oscillator circuit sustains oscillation by taking a voltage signal from the quart* resonator, amplifying it, and feeding it back to the resonator. The rate of expansion and contraction of the quart* is the resonant frequency, and is determined by the cut and si*e of the crystal. $hen the energy of the generated output frequencies matches the losses in the circuit, an oscillation can be sustained. 'ne of the most important traits of the crystal oscillator is that it exhibits very low phase noise. "n the crystal oscillator, the crystal mostly vibrates in one axis, therefore only one phase is dominant. This property of low phase noise makes them particularly useful in telecommunications where stable signals are needed and in scientific equipment where very precise time references are needed. The result is that a quart* crystal behaves like a circuit composed of an inductor,
capacitor and resistor
with (;
a
precise
resonant
frequency.
F#/TUR#%:
! The crystal oscillator circuit sustains oscillation by taking a voltage signal from the quart* resonator, amplifying it, and feeding it back to the resonator ! "t provides clock pulses of ))./( 0H* frequency. ! The popularity of the crystals is due to low cost.
-.9 O0TO Co45le! %n optical coupler, also called opto!isolator, opto coupler, opto coupler, photo coupler or optical isolator, is a passive optical component that can combine or split transmission data ?optical power@ from optical fibers. "t is an electronic device which is designed to transfer electrical signals by using light waves in order to provide coupling with electrical isolation between its input and output. The main purpose of an opto coupler is to prevent rapidly changing voltages or high voltages on one side of a circuit from distorting transmissions or damaging components on the other side of the circuit. %n opto coupler contains a light source often near an +6 which converts electrical input signal into light, a closed optical channel and a photo sensor, which detects incoming light and either modulates electric current flowing from an external power supply or generates electric energy directly. The sensor can either be a photo resistor, a silicon!controlled rectifier, a photodiode, a phototransistor or a triac.
Fig -.12: O5toco45le!
(C
The opto coupler application or function in the circuit is toE •
0onitor high voltage
•
'utput voltage sampling for regulation
•
#ystem control micro for power onBoff
•
:round isolation
-.< #lect!onic B4e! % bu**er is a mechanical, electromechanical, magnetic, electromagnetic, electro!acoustic or pie*oelectric audio signalling device. % pie*o electric bu**er can be driven by an oscillating electronic circuit or other audio signal source. % click, beep or ring can indicate that a button has been pressed.
Fig -.1-: B4e! F#/TUR#%
= The 4# series are high!performance bu**ers that employ uni morph pie*oelectric elements and are designed for easy incorporation into various circuits. =They feature extremely low power consumption in comparison to electromagnetic units. = 1ecause these bu**ers are designed for external excitation, the same part can serve as both a musical tone oscillator and a bu**er. = They can be used with automated inserters. 0oisture!resistant models are also available. = The lead wire type?4#)//+<N@ with both!sided adhesive tape installed easily is prepared.
/00LIC/TION%
6lectric ranges, washing machines, computer terminals, various devices that require speech synthesis output.
(-
-.1 LIUID CR&%T/L DI%0L/& @LCDA +iquid crystal display ?+&@ has material which combines the properties of both liquid and crystals. They have a temperature range within which the molecules are almost as mobile as they would be in a liquid, but are grouped together in an order form similar to a crystal.
Fig -.16: LCD Dis5l)
F#/TUR#% G H":H &'NT2%#T +& #462T$"#T "#4+%I G 6% "4);(!N+6E I6++'$B:266N $"TH +6 1%&J+":HT G 6% "4);(!N7+$ %N "4);(X!N7+$ $"TH $H"T6 +6 1B+.,
+'4'$62 G "N&+. H <
!'T0%T2"8 )x-,
+iquid crystal display is very important device in embedded system. "t offers high flexibility to user as he can display the required data on it. 1ut due to lack of proper approach to +& interfacing many of them fail. 0any people consider +& interfacing a complex job but according to me +& interfacing is very easy task, you (
just need to have a logical approach. This page is to help the enthusiast who wants to interface +& with through understanding. &opy and 4aste technique may not work when an embedded system engineer wants to apply +& interfacing in real world projects. Iou will be known about the booster rockets on space shuttle. $ithout these booster rockets the space shuttle would not launch in geosynchronous orbit. #imilarly to understand +& interfacing you need to have booster rockets attachedZ To get it done right you must have general idea how to approach any given +&. This page will help you develop logical approach towards +& interfacing. 0ajor task in +& interfacing is the initiali*ation sequence. "n +& initiali*ation you have to send command bytes to +&. Here you set the interface mode, display mode, address counter increment direction, set contrast of +&, hori*ontal or vertical addressing mode, color format. This sequence is given in respective +& driver datasheet. #tudying the function set of +& lets you know the definition of command bytes. "t varies from one +& to another. "f you are able to initiali*e the +& properly [ of your job is done. Next step after initiali*ation is to send data bytes to required display data 2%0 memory location. Kirstly set the address location using address set command byte and than send data bytes using the 2%0 write command. To address specific location in display data 2%0 one must have the knowledge of how the address counter is incremented. No. Inst!4ction He Deci"l
) Kunction #etE -!bit, ) +ine, /xC ots x7 <( Kunction #etE -!bit, ( +ine, /xC ots x7- /; 7 Kunction #etE
) #hift entire display left x)- (< )( #hift entire display right x)& 7 )7 0ove cursor left by one character x) ); )< 0ove cursor right by one character x)< ( )/ &lear isplay ?also clear 2%0 content@ x) ) ); #et 2%0 address or coursor position on display x-add \ )(-add\ )C #et &:2%0 address or set pointer to&:2%0 location x<add\\ ;<add LCD 5in (ig!"
% li4i( c!)stl (is5l) ? LCD@ is an electronically!modulated optical device shaped into a thin, flat panel made up of any number of color or monochrome pixels filled with liquid crystals and arrayed in front of a light source ? backlight@ or reflector. "t is often used in battery!powered electronic devices because it requires very small amounts of elect!ic 5o3e!.
Fig -.1;: LCD 0nel 5in (ig!"
%bove is the quite simple schematic. The +& panel]s 6nable and 2egister #elect is connected to the &ontrol 4ort. The &ontrol 4ort is an open collector B open drain output. $hile most 4arallel 4orts have internal pull!up resistors, there are a few which don]t. Therefore by incorporating the two )J external pull up resistors, the 7)
circuit is more portable for a wider range of computers, some of which may have no internal pull up resistors. $e make no effort to place the ata bus into reverse direction. Therefore we hard wire the 2B$ line of the +& panel, into write mode. This will cause no bus conflicts on the data lines. %s a result we cannot read back the +&]s internal 1usy Klag which tells us if the +& has accepted and finished processing the last instruction. This problem is overcome by inserting known delays into our program. The )k 4otentiometer controls the contrast of the +& panel. Nothing fancy here. %s with all the examples, "]ve left the power supply out. Iou can use a bench power supply set to /v or use a onboard / regulator. 2emember a few de!coupling capacitors, especially if you have trouble with the circuit working properly. The ( line x ); character +& modules are available from a wide range of manufacturers and should all be compatible with the H<
-.11 L#D % light!emitting diode ?+6@ is a semiconductor light source. +6s are used as indicator lamps in many devices, and are increasingly used for lighting. $hen a light!emitting diode is forward biased ?switched on@, electrons are able to recombine with holes within the device, releasing energy in the form of photons.
Fig -.1: s)"bol o L#D
This effect is called electroluminescence and the color of the light ?corresponding to the energy of the photon@ is determined by the energy gap of the semiconductor. %n +6 is often small in area ?less than ) mm (@, and integrated 7(
optical components may be used to shape its radiation pattern. +6s present many advantages over incandescent light sources including lower energy consumption, longer lifetime, improved robustness, smaller si*e, faster switching, and greater durability and reliability. +ight!emitting diodes are used in applications as diverse as replacements for aviation lighting, automotive lighting as well as in traffic signals. The compact si*e, the possibility of narrow bandwidth, switching speed, and extreme reliability of +6s has allowed new text and video displays and sensors to be developed, while their high switching rates are also useful in advanced communications technology.
-.12 1N68 iodes are used to convert %& into & these are used as half wave rectifier or full wave rectifier. Three points must he kept in mind while using any type of diode. ). 0aximum forward current capacity (. 0aximum reverse voltage capacity 7. 0aximum forward voltage capacity
Fig -.18: 1N68 (io(es
The number and voltage capacity of some of the important diodes available in the market are as followsE •
iodes of number "N<), "N<(, "N<7, "N<<, "N</, "N<; and "N<C have maximum reverse bias voltage capacity of /F and maximum forward current capacity of ) %mp.
77
•
iode of same capacities can be used in place of one another. 1esides this diode of more capacity can be used in place of diode of low capacity but diode of low capacity cannot be used in place of diode of high capacity. Kor example, in place of "N<(A "N<) or "N<C can be used but "N<) or "N<( cannot be used in place of "N<C.The diode 1I)(/made by company 16+ is equivalent of diode from "N<) to "N<7. 1I )(; is equivalent to diodes "N<< to <; and 1I )(C is equivalent to diode "N<C.
•
0N UNCTION O0#R/TION Now that you are familiar with 4! and N!type materials, how these materials are joined together to form a diode, and the function of the diode, let us continue our discussion with the operation of the 4N junction. 1ut before we can understand how the 4N junction works, we must first consider current flow in the materials that make up the junction and what happens initially within the junction when these two materials are joined together.
•
C4!!ent Flo3 in the NT)5e $te!il &onduction in the N!type semiconductor, or crystal, is similar to conduction in a copper wire. That is, with voltage applied across the material, electrons will move through the crystal just as current would flow in a copper wire. This is shown in figure )!)/. The positive potential of the battery will attract the free electrons in the crystal. These electrons will leave the crystal and flow into the positive terminal of the battery. %s an electron leaves the crystal, an electron from the negative terminal of the battery will enter the crystal, thus completing the current path. Therefore, the majority current carriers in the N!type material ?electrons@ are repelled by the negative side of the battery and move through the crystal toward the positive side of the battery.
7<
•
C4!!ent Flo3 in the 0T)5e $te!il &urrent flow through the 4!type material is illustrated. &onduction in the 4 material is by positive holes, instead of negative electrons. % hole moves from the positive terminal of the 4 material to the negative terminal. 6lectrons from the external circuit enter the negative terminal of the material and fill holes in the vicinity of this terminal. %t the positive terminal, electrons are removed from the covalent bonds, thus creating new holes. This process continues as the steady stream of holes ?hole current@ moves toward the negative terminal.
-.1- R#%I%TOR % resistor is a two!terminal electronic component designed to oppose an electric current by producing a voltage drop between its terminals in proportion to the current, that is, in accordance with 'hm]s lawE V G IR
2esistors are used as part of electrical networks and electronic circuits. They are extremely commonplace in most electronic equipment. 4ractical resistors can be made of various compounds and films, as well as resistance wire ?wire made of a high!resistivity alloy, such as nickelBchrome@.
Fig -.19: Resisto!
The primary characteristics of resistors are their resistance and the power they can dissipate. 'ther characteristics include temperature coefficient, noise, and inductance. +ess well!known is critical resistance, the value below which power dissipation limits the maximum permitted current flow, and above which the limit is
7/
applied voltage. &ritical resistance depends upon the materials constituting the resistor as well as its physical dimensionsA it]s determined by design. 2esistors can be integrated into hybrid and printed circuits, as well as integrated circuits. #i*e, and position of leads ?or terminals@ are relevant to equipment designersA resistors must be physically large enough not to overheat when dissipating their power.
% resistor is a two!terminal passive electronic component which implements electrical resistance as a circuit element. $hen a voltage F is applied across the terminals of a resistor, a current " will flow through the resistor in direct proportion to that voltage. The reciprocal of the constant of proportionality is known as the resistance 2, since, with a given voltage F, a larger value of 2 further DresistsD the flow of current " as given by 'hm]s lawE
2esistors are common elements of electrical networks and electronic circuits and are ubiquitous in most electronic equipment. 4ractical resistors can be made of various compounds and films, as well as resistance wire ?wire made of a high! resistivity alloy, such as nickel!chrome@. 2esistors are also implemented within integrated circuits, particularly analog devices, and can also be integrated into hybrid and printed circuits. The electrical functionality of a resistor is specified by its resistanceE common commercial resistors are manufactured over a range of more than orders of magnitude. $hen specifying that resistance in an electronic design, the required precision of the resistance may require attention to the manufacturing tolerance of the chosen resistor, according to its specific application. The temperature coefficient of the resistance may also be of concern in some precision applications. 4ractical resistors are also specified as having a maximum power rating which must exceed the anticipated power dissipation of that resistor in a particular circuitE this is mainly of concern in power electronics applications. 2esistors with higher power ratings are physically larger and may require heat sinking. "n a high voltage circuit, attention must sometimes be paid to the rated maximum working voltage of the resistor. 7;
The series inductance of a practical resistor causes its behaviour to depart from ohms lawA this specification can be important in some high!frequency applications for smaller values of resistance. "n a low!noise amplifier or pre!amp the noise characteristics of a resistor may be an issue. The unwanted inductance, excess noise, and temperature coefficient are mainly dependent on the technology used in manufacturing the resistor. They are not normally specified individually for a particular family of resistors manufactured using a particular technology. % family of discrete resistors is also characteri*ed according to its form factor, that is, the si*e of the device and position of its leads ?or terminals@ which is relevant in the practical manufacturing of circuits using them.
Units
The ohm ?symbolE @ is the #" unit of electrical resistance, named after :eorg #imon 'hm. %n ohm is equivalent to a volt per ampere. #ince resistors are specified and manufactured over a very large range of values, the derived units of milliohm ?) m G )S7 @, kilohm ?) k G ) 7 @, and megohm ?) 0 G ) ; @ are also in common usage. The reciprocal of resistance 2 is called conductance : G )B2 and is measured in #iemens ?#" unit@, sometimes referred to as a mho. Thus a #iemens is the reciprocal of an ohmE
S
G
S )
. %lthough the concept of conductance is often used in circuit
analysis, practical resistors are always specified in terms of their resistance ?ohms@ rather than conductance.
-.16 C/0/CITOR % capacitor or condenser is a passive electronic component consisting of a pair of conductors separated by a dielectric. $hen a voltage potential difference exists between the conductors, an electric field is present in the dielectric. This field stores
7C
energy and produces a mechanical force between the plates. The effect is greatest between wide, flat, parallel, narrowly separated conductors. %n ideal capacitor is characteri*ed by a single constant value, capacitance, which is measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them. "n practice, the dielectric between the plates passes a small amount of leakage current. The conductors and leads introduce an equivalent series resistance and the dielectric has an electric field strength limit resulting in a breakdown voltage. The properties of capacitors in a circuit may determine the resonant frequency and quality factor of a resonant circuit, power dissipation and operating frequency in a digital logic circuit, energy capacity in a high!power system, and many other important aspects.
Fig -.1<: c5cito!
% capacitor ?formerly known as condenser@ is a device for storing electric charge. The forms of practical capacitors vary widely, but all contain at least two conductors separated by a non!conductor. &apacitors used as parts of electrical systems, for example, consist of metal foils separated by a layer of insulating film. &apacitors are widely used in electronic circuits for blocking direct current while allowing alternating current to pass, in filter networks, for smoothing the output of power supplies, in the resonant circuits that tune radios to particular frequencies and for many other purposes. % capacitor is a passive electronic component consisting of a pair of conductors separated by a dielectric ?insulator@. $hen there is a potential difference ?voltage@ across the conductors, a static electric field develops in the dielectric that 7-
stores energy and produces a mechanical force between the conductors. %n ideal capacitor is characteri*ed by a single constant value, capacitance, measured in farads.
6. %OFT'/R# R#UIR#$#NT%
6.1 Int!o(4ction to eil "ic!o vision @ID#A Jeil an %20 &ompany makes & compilers, macro assemblers, real!time kernels, debuggers, simulators, integrated environments, evaluation boards, and emulators for %20CB%20B&ortex!07, 8&);xB&);xB#T), (/), and -/) 0& families. Jeil development tools for the -/) 0icrocontroller %rchitecture support every level of software developer from the professional applications engineer to the student just learning about embedded software development. $hen starting a new 7
project, simply select the microcontroller you use from the evice atabase and the ^Fision "6 sets all compiler, assembler, linker, and memory options for you. Jeil is a cross compiler. #o first we have to understand the concept of compilers and cross compilers. %fter then we shall learn how to work with keil.
6.2 CONC#0T OF CO$0IL#R &ompilers are programs used to convert a High +evel +anguage to object code. esktop compilers produce an output object code for the underlying microprocessor, but not for other microprocessors. ".6 the programs written in one of the H++ like _&3 will compile the code to run on the system for a particular processor like x-; ?underlying microprocessor in the computer@. Kor example compilers for os platform is different from the &ompilers for nix platform #o if one wants to define a compiler then compiler is a program that translates source code into object code. The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorgani*ing the instruction. #ee there is a bit little difference between compiler and an interpreter. "nterpreter just interprets whole program at a time while compiler analyses and execute each line of source code in succession, without looking at the entire program. The advantage of interpreters is that they can execute a program immediately. #econdly programs produced by compilers run much faster than the same programs executed by an interpreter. However compilers require some time before an executable program emerges. Now as compilers translate source code into object code, which is unique for each type of computer, many compilers are available for the same language.
6.- CONC#0T OF CRO%% CO$0IL#R
<
% cross compiler is similar to the compilers but we write a program for the target processor ?like -/) and its derivatives@ on the host processors ?like computer of x-;@. "t means being in one environment you are writing a code for another environment is called cross development. %nd the compiler used for cross development is called cross compiler. #o the definition of cross compiler is a compiler that runs on one computer but produces object code for a different type of computer.
6.6 #IL C CRO%% CO$0IL#R Jeil is a :erman based #oftware development company. "t provides several development tools like =
"6 ?"ntegrated evelopment environment@
=
4roject 0anager
=
#imulator
=
ebugger
=
& &ross &ompiler, &ross %ssembler, +ocatorB+inker
The Jeil %20 tool kit includes three main tools, assembler, compiler and linker. %n assembler is used to assemble the %20 assembly program. % compiler is used to compile the & source code into an object file. % linker is used to create an absolute object module suitable for our in!circuit emulator.
6.; B4il(ing n /55liction in J7ision2 To build ?compile, assemble, and link@ an application in ^Fision(, you mustE )
#elect 4roject !?forexample,);;`68%04+6#`H6++'`H6++'.F(@.
(
#elect 4roject ! 2ebuild all target files or 1uild target.^Fision( compiles, assembles, and links the files in your project.
<)
6. C!eting &o4! O3n /55liction in J7ision2 To create a new project in ^Fision(, you mustE )
#elect 4roject ! New 4roject.
(
#elect a directory and enter the name of the project file.
7
#elect 4roject ! #elect evice and select an -/), (/), or &);xB#T) device from the evice atabase.
<
&reate source files to add to the project.
/
#elect 4roject ! Targets, :roups, Kiles. %ddBKiles, select #ource :roup), and add the source files to the project.
;
#elect 4roject ! 'ptions and set the tool options. Note when you select the target device from the evice atabase all special options are set automatically. Iou typically only need to configure the memory map of your target hardware. efault memory model settings are optimal for most applications.
C
#elect 4roject ! 2ebuild all target files or 1uild target.
6.8 Deb4gging n /55liction in J7ision2 To debug an application created using ^Fision(, you mustE )
#elect ebug ! #tartB#top ebug #ession.
(
se the #tep toolbar buttons to single!step through your program. Iou may enter :, main in the 'utput $indow to execute to the main & function.
7
'pen the #erial $indow using the #erial ) button on the toolbar.
ebug your program using standard options like #tep, :o, 1reak, and so on.
6.9 %t!ting J7ision2 n( C!eting 0!oject ^Fision( is a standard $indows application and started by clicking on the program icon. To create a new project file select from the ^Fision( menu 4roject > New 4roject. This opens a standard $indows dialog that asks you for the new project file name. $e suggest that you use a separate folder for each project. Iou can simply use the icon &reate New Kolder in this dialog to get a new empty folder. Then select this folder and enter the file name for the new project, i.e. 4roject). ^Fision( creates a new project file with the name 42'X6&T).F( which contains a default target and file group name. Iou can see these names in the 4roject. <(
6.< 'in(o3 K Files. Now use from the menu 4roject > #elect evice for Target and select a &4 for your project. The #elect evice dialog box shows the ^Fision( device data base. Xust select the microcontroller you use. $e are using for our examples the 4hilips -&/)2 &4. This selection sets necessary tool 'ptions for the -&/)2 device and simplifies in this way the tool &onfiguration.
6.1 B4il(ing 0!ojects n( C!eting H#? Files Typical, the tool settings under 'ptions > Target are all you need to start a new application. Iou may translate all source files and line the application with a click on the 1uild Target toolbar icon. $hen you build an application with syntax errors, ^Fision( will display errors and warning messages in the 'utput $indow > 1uild page. % double click on a message line opens the source file on the correct location in a ^Fision( editor window. 'nce you have successfully generated your application you can start debugging.
%fter you have tested your application, it is required to create an "ntel H68 file to download the software into an 642'0 programmer or simulator. ^Fision( creates H68 files with each build process when &reate H68 files under 'ptions for Target > 'utput is enabled. Iou may start your 42'0 programming utility after the make process when you specify the program under the option 2un ser 4rogram ).
6.11 C0U %i"4ltion ^Fision( simulates up to ); 0bytes of memory from which areas can be mapped for read, write, or code execution access. The ^Fision( simulator traps and reports illegal memory accesses. "n addition to memory mapping, the simulator also provides support for the integrated peripherals of the various -/) derivatives. The on!chip peripherals of the &4 you have selected are configured from the evice.
6.12 Dtbse selection
<7
Iou have made when you create your project target. 2efer to page /- for more "nformation about selecting a device. Iou may select and display the on!chip peripheral components using the ebug menu. Iou can also change the aspects of each peripheral using the controls in the dialog boxes.
6.1- %t!t Deb4gging Iou start the debug mode of ^Fision( with the ebug > #tartB#top ebug #ession &ommand. epending on the 'ptions for Target > ebug &onfiguration, ^Fision( will load the application program and run the startup code ^Fision( saves the editor screen layout and restores the screen layout of the last debug session. "f the program execution stops, ^Fision( opens an editor window with the source text or shows &4 instructions in the disassembly window. The next executable statement is marked with a yellow arrow. uring debugging, most editor features are still available. Kor example, you can use the find command or correct program errors. 4rogram source text of your application is shown in the same windows. The ^Fision( debug mode differs from the edit mode in the following aspectsE The ebug 0enu and ebug &ommands described on page (- are available. The additional debug windows are discussed in the following. The project structure or tool parameters cannot be modified. %ll build commands are disabled.
6.16 Dissse"bl) 'in(o3 The isassembly window shows your target program as mixed source and assembly program or just assembly code. % trace history of previously executed instructions may be displayed with ebug > Fiew Trace 2ecords. To enable the trace history, set ebug > 6nableBisable Trace 2ecording. "f you select the isassembly $indow as the active window all program step commands work on &4 instruction level rather than program source lines. Iou can select a text line and set or modify code breakpoints using toolbar buttons or the context menu commands. Iou may use the dialog ebug > "nline %ssembly to modify the &4 instructions. That allows you to correct mistakes or to make temporary changes to the <<
target program you are debugging. Numerous example programs are included to help you get started with the most popular embedded -/) devices. The Jeil ^Fision ebugger accurately simulates on!chip peripherals ?"&, &%N, %2T, #4", "nterrupts, "B' 4orts, %B &onverter, B% &onverter, and 4$0 0odules@ of your -/) device. #imulation helps you understand hardware configurations and avoids time wasted on setup problems. %dditionally, with simulation, you can write and test applications before target hardware is available.
6.1; #$B#DD#D C se of embedded processors in passenger cars, mobile phones, medical equipment, aerospace systems and defense systems is widespread, and even everyday domestic appliances such as dish washers, televisions, washing machines and video recorders now include at least one such device. 1ecause most embedded projects have severe cost constraints, they tend to use low!cost processors like the -/) family of devices considered in this book. These popular chips have very limited resources available most such devices have around (/; bytes ?not megabytesZ@ of 2%0, and the available processor power is around ) times less than that of a desktop processor. %s a result, developing embedded software presents significant new challenges, even for experienced desktop programmers. "f you have some programming experience ! in &, & or Xava ! then this book and its accompanying & will help make your move to the embedded world as quick and painless as possible.
;. CODIN=
;.1 0!og!" Co(e includereg/).h includeintrins.h includelcdbusy.h includeDadc--.hD sbit ldrG47CA sbit pumpG47;A sbit lightG47/A sbit bu**G47
if?&)/@ init?x)@A message?x-,DHigh temparatureD@A bu**GA pumpGA delay?7@A if?&(<@ init?x)@A message?x-,DHigh #mokeD@A bu**GA pumpGA delay?7@A if?&)/ 99 &(7/@ init?x)@A message?x-,DNormal conditionsD@A bu**G)A pumpG)A delay?7@A if?ldrGG@
init?x)@A message?x-,D1ad lightD@A lightGA delay?7@A else lightG)A BBwhile?)@ BBmain
;.2 CO$0IL#R 0ROC#DUR#
1.
&lick on the Jeil Fision "con on esktop
2.
The following fig will appear
<-
-.
&lick on the 4roject menu from the title bar
6.
Then &lick on New 4roject
;.
#ave the 4roject by typing suitable project name with no extension in u r own folder sited in either &E` or E`
<
.
Then &lick on #ave button above.
8.
#elect the component for u r project. i.e. %tmel
9.
&lick on the #ymbol beside of %tmel
<.
#elect %T-&/) as shown below
1.
Then &lick on 'J
11.
The Kollowing fig will appear /
12.
Then &lick either I6# or N'mostly N'.
1-.
Now your project is ready to #6.
16.
Now double click on the Target), you would get another option #ource group ) as shown in next page.
1;.
&lick on the file option from menu bar and select new.
/)
1.
The next screen will be as shown in next page, and just maximi*e it by double clicking on its blue boarder.
18.
Now start writing program in either in 60166 & or %#0.
19.
Kor a program written in %ssembly, then save it with extension . asm and for 60166 & based program save it with extension .&
/(
1<.
Now right click on #ource group ) and click on %dd files to :roup #ource.
2.
Now you will get another window, on which by default 60166 & files will appear. /7
21.
Now select as per your file extension given while saving the file
22.
&lick only one time on option /DD.
2-.
Now 4ress function key KC to compile. %ny error will appear if so happen.
26.
"f the file contains no error, then press &ontrolK/ simultaneously. /<
2;.
The new window is as follows
2.
Then &lick 'J.
28.
Now click on the 4eripherals from menu bar, and check your required port as shown in fig below.
//
29.
rag the port a side and click in the program file
2<.
Now keep 4ressing function key K)) slowly and observe.
-.
Iou are running your program successfully.
/;
CONCLU%ION This project is used to develop industrial protection over smoke, temperature and +2 ?fire sensor@. "n this project, we are using a smoke sensor, temperature and +2 which can detect and send a signal as input to the micro controller. The micro controller will be continuously checking the respective pin.
pon reception of
positive signal to the microcontroller from both the sensors that continuously monitors them, a signal is sent to the bu**er that sounds alarm confirming fire, and simultaneously a signal is sent to the +& display. The sensitivity of the heat and smoke sensor can be increased and decreased manually here by making the alarm system more or less sensitive. $hen it gets a high signal at that pin it means that smoke has been detected. %t that time it first gives siren to alert any humans in that premises to vacate and then it actuates the extinguishers. They may be the water sprinklers or the &'( containers. %t the same time control appliances based on the light sensor.
/C