This action might not be possible to undo. Are you sure you want to continue?
DENSITY BASED TRAFFIC CONTROL SYSTEM
DENSITY BASED TRAFFIC CONTROL SYSTEM
An adaptive traffic control system was developed where the traffic load is continuously measured by sensors connected to a microcontroller-based system which also performs all intersection control functions. Intersection controllers of an area are interconnected with a communication network through which traffic load and synchronization information is exchanged. As a result, the duration and relative phases of each traffic light cycle change dynamically. For the basic function of the system only the intersection controllers are re uired.
!"A#$%& ' ()%&)I%*
DENSITY BASED TRAFFIC CONTROL SYSTEM
receivers and led1s at the 2 way /unction. I& transmitter and receiver.&2 $ransmitters and receivers are placed at either sides of the four paths.icrocontroller based traffic control system is an application specific pro/ect.DENSITY BASED TRAFFIC CONTROL SYSTEM .&3. which is used to control the traffic. and 2 led1s at corner of the /unction *hen there is a traffic along the paths.1s $his pro/ect is implemented by placing I& transmitters. 0%. the four paths are represented as &'.value of & would be 555 which are the values of I& sensors and if there is no traffic the value is ''' . An embedded system is developed which consists of a microcontroller.&4.
and the sensor values automatically changed to '''.the value of & is 55'.traffic is cleared.DENSITY BASED TRAFFIC CONTROL SYSTEM For instance.it is recognized that traffic is heavy and the led glows which indicates that vehicles can move forward.the control goes to the next path wher the values of sensors contains more no of zeroes $his entire embedded system is placed at that /unction .and then if it reaches the last sensor that is the third one.icrocontroller is interfaced with led1s and ir sensors $he total no of I& sensors re uired are '3 and led1s 2 $herefore these are connected to any two ports of microcontroller BLOCK DIAGRAM AT !S"# MICRO CONTROLLER . when the traffic reaches the first sensor.if it reaches second sensor .let the traffic at the path &' be initially ''' ie there is no traffic .the value of & would be 5''.
DENSITY BASED TRAFFIC CONTROL SYSTEM $ IR TRANSMI TTER IR RECIE(E R LED LCD REG&LAT ED %O'ER S&%%LY BLOCK DIAGRAM DESCRII%TION .
$he transmit pin of I& receiver is connected to the receive pin of microcontroller $his embedded system is placed at the 2 way /unction which controls the traffic electronically $he system uses a compact circuitry build around flash version of A$78963 .%. In the case of our wired copper channel.I! is used for loading of programs into microcontroller.. led and I& receiver and I& transmitter which consists of an I& sensor $he I& sensors and leds are connected to any of the port pins of microcontroller. IR TRANSMITTER and receiver $he purpose of the transmitter is to transform the information we want to send into a signal that can be propagated by the channel.:%. something like the pulse train. #rograms will be developed in %. however. the .icrocontroller with a non-volatile memory. ! language. this means we want the information to be transformed into a modulated voltage level.regulated power supply is connected to the )cc pin of microcontroller which uses an voltage regulator to get 6 v of power supply. For a wireless channel. F0A9" .DENSITY BASED TRAFFIC CONTROL SYSTEM $he block diagram consists of microcontroller interfaced to regulated power supply.A.
wave that can be easily propagated. $o match the receiver fre uency the the data is modulated at 47. $his fre uency can be varied over a long range /ust by varying the preset &' and !'. which generates fre uency using the components &3 and !3 as shown in above fig.DENSITY BASED TRAFFIC CONTROL SYSTEM transmitter needs to encode the information onto an %.< ="> by configuring 666 timer at astable mode of operation.I$$%& $he I& transmitter part consists of an Infra red light emitting diode that can capable of sending modulated data within infra red band. I& $&A+9. .
It is also immune to ambient I& light.DENSITY BASED TRAFFIC CONTROL SYSTEM I& &%!%I)%& $he I& receiver consists of $9(# '<47 module which is a simple yet effective I& proximity sensor built around the $9(# '<47 module. players etc. in $)s.g. 9uch modules are available for different carrier fre uencies from 43 k"z 23k"z.. $he $9(# module is commonly found at the receiving end of an I& remote control system? e. we will be generating a constant stream of s uare wave signal using I!666 centered at 47 k"z and would use it to drive an I& led. In this particular proximity sensor. $hese modules re uire the incoming data to be modulated at a particular fre uency and would ignore any other I& signals. 9o whenever this signal bounces off the obstacles. !. so one can easily use these sensors outdoors or under heavily lit conditions. the receiver would detect it to .
:asically an ir sensor is used for detecting an obstacle.9.DENSITY BASED TRAFFIC CONTROL SYSTEM and change its output. there are some areas where valuable things are placed. processing is done according to the logic in the microcontroller and then writes onto . which will further send sms to the mobile at the user A buzzer is interfaced to microcontroller to give out a beep sound whenever an obstacle and fire is detected IR receiver )od*le TSO% . its output would normally remain high and would go low when it detects the signal @the obstacleA. an infrared path is established and if any person comes into that path the buzzer gets on which gives out a long beep 9imilarly a fire sensor is used to detect fire $he sensed data is given to the microcontroller. an I& transmitter and receiver is placed there. 9ince the $9(# '<47 module works in the active-low configuration.
the epoxy package is designed as I& filter. #I+ diode and preamplifier are assembled on lead frame.. $9(#'<. . is the standard I& remote control receiver series. supporting all ma/or transmission codes. $he demodulated output signal can directly be decoded by a microprocessor.DENSITY BASED TRAFFIC CONTROL SYSTEM De+cription $he $9(#'<.. B series are miniaturized receivers for infrared remote control systems.
fre uency Improved shielding against electrical field disturbance $$0 and !.(9 compatibility (utput active low 0ow power consumption "igh immunity against ambient light !ontinuous data transmission possible @'355 bitCsA 9uitable burst length '5 cyclesCburst .DENSITY BASED TRAFFIC CONTROL SYSTEM Feat*re+ #hoto detector and preamplifier in one package Internal filter for #!.
sometimes with real-time computing constraints. reducing the size and cost of the product.:%. In contrast. %mbedded systems have become very important today as they control many of the common devices we use. 9D9$%. or increasing the reliability and performance. design engineers can optimize it. 9ince the embedded system is dedicated to specific tasks.. benefiting from economies of scale. %. 9ome embedded systems are mass-produced..-!$I(+ $( . 9D9$%. %. such as a personal computer.%.DENSITY BASED TRAFFIC CONTROL SYSTEM !"A#$%& 3 I+$&(.%. can do many different tasks depending on programming. a general-purpose computer.I!&(!(+$&(00%& A+.:%. . An embedded system is a special-purpose computer system designed to perform one or a few dedicated functionsE'F. It is usually embedded as part of a complete device including hardware and mechanical parts.
!ertain operating systems or language platforms are tailored for the embedded market. cameras. For example. factory controllers. either fixed in capability or programmable. "andheld computers share some elements with embedded systems H such as the operating systems and microprocessors which power them H but are not truly embedded systems. such as %mbeddedIava and *indows J# %mbedded. Gembedded systemG is not an exactly defined term. because they allow different applications to be loaded and peripherals to be connected. household appliances. some lowend consumer products use very inexpensive microprocessors and limited storage. airplanes. automobiles. "owever. An embedded system is some combination of computer hardware and software. with a single microcontroller chip. %mbedded systems that are programmable are provided with a programming interface. embedded systems range from portable devices such as digital watches and .AA are among the myriad possible hosts of an embedded system.DENSITY BASED TRAFFIC CONTROL SYSTEM #hysically. that is specifically designed for a particular kind of application device. vending machines. In general. as many systems have some element of programmability. and toys @as well as the more obvious cellular phone and #.#4 players. medical e uipment. $he program is written permanently into the systemKs memory in this case. with the application and operating system both part of a single program. and embedded systems programming is a specialized occupation. Industrial machines. or the systems controlling nuclear power plants. to large stationary installations like traffic lights. peripherals and networks mounted inside a large chassis or enclosure. to very high with multiple units. rather than . !omplexity varies from low.
icrowave (ven in your kitchen. INTROD&CTION TO EMBEDDED SYSTEM *e are living in the %mbedded *orld. &adio. new devices.achine or . many controllers embedded in your car take care of car operations between the bumpers and most of the times you tend to ignore all these controllers. fast applications which make you believe that your basic survival is controlled by these embedded products. @random access memoryA. you are showered with variety of information about these embedded controllers in many places. as programs on a personal computer are. Apart from all these. *hat is this %mbedded 9ystemL . Dou are surrounded with many embedded products and your daily life largely depends on the proper functioning of these gadgets. In recent days. !ard readers. All kinds of magazines and /ournals regularly dish out details about latest technologies. +ow you can agree to the fact that these embedded products have successfully invaded into our world. Access !ontrollers. !. #alm devices of your work space enable you to do many of your tasks very effectively. $elevision. Dou must be wondering about these embedded controllers or systems.DENSITY BASED TRAFFIC CONTROL SYSTEM being loaded into &A. *ashing . player of your living room.
9o. semiconductor manufacturers still come out with some kind of device using this 754' core. $heoretically. these desktop computers can do many things. 9o these controllers cannot be used in any other place. . . $hese desktop computers are manufactured to serve many purposes and applications. the available variety really may overwhelm even an experienced designer.arket acceptance of this particular family has driven many semiconductor manufacturers to develop something new based on this particular architecture. %ven after 36 years of existence. In contrast. embedded controllers carryout a specific work for which they are designed. .DENSITY BASED TRAFFIC CONTROL SYSTEM $he computer you use to compose your mails. Dou need to install the relevant software to get the re uired processing facility. the most popular and used architecture is IntelKs 754'. engineers design these embedded controllers with a specific goal in mind. $hese days designers have many choices in microprocessorsCmicrocontrollers. In the 7 bit segment. 9electing a right microprocessor may turn out as a most difficult first step and it is getting complicated as new devices continue to pop-up very often. or create a document or analyze the database is known as the standard desktop computer. in 7 bit and 43 bit. an embedded controller is a combination of a piece of microprocessor based hardware and the suitable software to undertake a specific task. %specially.ost of the time.
and reduces the labor re uired to assemble and test the circuit board. having fewer chips typically allows a smaller and cheaper circuit board. microcontrollers may not implement an external address or data bus as they integrate &A. commonly with the following featuresN • central processing unit .M external peripherals. and non-volatile memory on the same chip as the !#-.. and watchdog volatile memory @&A. #*. %ven if the cost of a !#. -sing fewer pins. allowing control or detection of the logic state of an individual package pin serial inputCoutput such as serial ports @-A&$sA other serial communications interfaces like IP!.DENSITY BASED TRAFFIC CONTROL SYSTEM MICROCONTROLLER In contrast to general-purpose !#-s.that has integrated peripherals is slightly more than the cost of a !#.F or Flash memory for program and operating parameter storage • • • • • • . A microcontroller is a single integrated circuit. cheaper package. 9erial #eripheral Interface and !ontroller Area +etwork for system interconnect peripherals such as timers.. Integrating the memory and other peripherals on a single chip and testing them as a unit increases the cost of that chip.or O2-bit processors discrete input and output bits.A for data storage &(. E%%#&(. the chip can be placed in a much smaller. but often results in decreased net cost of the embedded system as a whole. %#&(.ranging from small and simple 2-bit processors to complex 43. generators. event counters.
9ome designs include general-purpose microprocessor cores.often an oscillator for a uartz timing crystal. . Furthermore. each pin may interface to several internal peripherals.anufacturers have to balance the need to minimize the chip size against additional functionality. or IC( functions integrated onto the package. *here a "arvard architecture is used. A . $his allows a part to be used in a wider variety of applications than if pins had dedicated functions. . $he decision of which peripheral to integrate is often difficult.icrocontroller architectures vary widely.icrocontrollers have proved to be highly popular in embedded systems since their introduction in the '8<5s. $he microcontroller vendors often trade operating fre uencies and system design flexibility against time-to-market re uirements from their customers and overall lower system cost. with the pin function selected by software. resonator or &! circuit many include analog-to-digital converters in-circuit programming and debugging support • • $his integration drastically reduces the number of chips and the amount of wiring and #!: space that would be needed to produce e uivalent systems using separate chips. . &A. allowing accesses to take place concurrently.. 9ome microcontrollers use a "arvard architectureN separate memory buses for instructions and data. and on low pin count devices in particular. instruction words for the processor may be a different bit size than the length of internal memory and registers? for exampleN '3-bit instructions used with 7-bit data registers. (ther designs are purpose built for control applications..DENSITY BASED TRAFFIC CONTROL SYSTEM • clock generator . with one or more &(.
Microcontroller A )icrocontroller @also MC& or . appliances. power tools. the microcontroller typically integrates additional elements such as read-write memory for data storage. and power consumption compared to a design using a separate microprocessor. microcontrollers often operate at very low speed compared to modern day microprocessors. $hey consume relatively little power @milliwattsA."z or even lower. low power consumption. selfsufficiency and cost-effectiveness. such as automobile engine control systems. It is a type of microprocessor emphasizing high integration. and toys. At clock speeds of as little as a few . %%#&(. read-only memory.icrocontrollers are fre uently used in automatically controlled products and devices.DENSITY BASED TRAFFIC CONTROL SYSTEM microcontroller instruction set usually has many instructions intended for bit-wise operations to make control programs more compact. remote controls. in contrast to a general-purpose microprocessor @the kind used in a #!A. and inputCoutput interfaces. where a microcontroller could have a single instruction that would provide that commonly-re uired function. For example. office machines. peripheral devices. In addition to the usual arithmetic and logic elements of a general purpose microprocessor. :y reducing the size. making them ideal for low power and long lasting battery applications. for permanent data storage. and . memory. cost.CA is a computer-on-a-chip. but this is ade uate for typical applications. a general purpose processor might re uire several instructions to test a bit in a register and branch if the bit is set. such as flash for code storage. and will generally have the ability to sleep while waiting for an interesting peripheral event such as a button press to wake them up again to do something. . #ower consumption while sleeping may be /ust nano watts.
MICROCONTROLLER (ERS&S MICRO%ROCESSOR *hat is the difference between a . and the #entiumA or . 7547O. etcA. 7527O. O7545. O7525. 7537O.icrocontrollerL :y microprocessor is meant the general purpose . microcontrollers make it economical to electronically control many more processes. O7535.DENSITY BASED TRAFFIC CONTROL SYSTEM inputCoutput devices. $hese microprocessors contain no .icroprocessor and .otorolaKs O75J5 family @O7555.icroprocessors such as IntelKs J7O family @757O. O75'5.
.. and IC( ports makes these systems bulkier and much more expensive... and timers externally to make them functional.@a microprocessorA in addition to a fixed amount of &A. In other words.. &(.. &(. &(.icrocontrollers makes them ideal for many applications in which cost and space are critical.. there is no need for the computing power of a 27O or even an 757O microprocessor. $his is not the case with . . An embedded system product uses a microprocessor @or . IC( ports.DENSITY BASED TRAFFIC CONTROL SYSTEM &A. IC( ports. for example a $) remote control. MICROCONTROLLERS FOR EMBEDDED SYSTEMS In the 0iterature discussing microprocessors. and number of IC( ports in . $hese applications most often re uire some IC( operations to read signals and turn on and off certain bits. In many applications.icroprocessors and . the &A. they are commonly referred to as general-purpose .. IC( ports and the timer are all embedded together on one chip? therefore.icroprocessors. and no IC( ports on the chip itself. A system designer using a general-purpose microprocessor such as the #entium or the O7525 must add &A. $he fixed amount of on-chip &(.. Although the addition of external &A. and IC( ports needed to fit the task at hand. For this reason. and a timer all on a single chip. &A.icrocontrollers. the designer cannot add any external memory. A printer is an example of embedded system .icrocontrollers are widely used in embedded system products... no &(.icrocontrollerA to do one task only. they have the advantage of versatility such that the designer can decide on the amount of &A. or timer to it. IC( ports. &(. &(. we often see the term %mbedded 9ystem.. A . the processor..icrocontroller has a !#.
An x7O #! contains or is connected to various embedded products such as keyboard. sound card. memory and lets the !#. which contains two separate buses for both program and data. %ach one of these peripherals has a . or Internet terminal.icrocontroller inside it that performs only one task.. modem. memory and an operating system that loads the application software into &A. it has two distinctive memory spaces of O2= J 7 size for both program and data. disk controller. bank teller terminal. mouse. )ideo game. print-server.DENSITY BASED TRAFFIC CONTROL SYSTEM since the processor inside it performs one task only? namely getting the data and printing it. Intel-+ . For example. network server. (ther portions of the architecture include few 7 bit and 'O bit registers and 7 bit memory locations. $his area is used for stack operations and temporary storage of data. there is only one application software that is typically burned into &(. inside every mouse there is a . drives. !. !ontrast this with a #entium based #!. In an %mbedded system. of course the reason a pc can perform myriad tasks is that it has &A. .icrocontroller to perform the task of finding the mouse position and sending it to the #!. 9oftware for a variety of applications can be loaded and run.run it. 9o. and so on. A #! can be used for any number of applications such as word processor. It is based on an 7 bit central processing unit with an 7 bit Accumulator and another 7 bit : register as main processing blocks./0 Arc1itect*re$he generic 754' architecture sports a "arvard architecture. $able '-' lists some embedded products. built in the device for internal processing. printer.-&(. %ach 754' device has some amount of data &A.
ata . 43 :i-directional and individually addressable IC( lines. '37 bytes of onchip .DENSITY BASED TRAFFIC CONTROL SYSTEM $his base architecture is supported with onchip peripheral functions like IC( ports.ata . O2= #rogram . (nchip clock oscillator. Kone time programmableK version of #rogram .uplex -A&$.emory address space.emory of size 2= J 7. timersCcounters. %xtensive :oolean processing capabilities.emory address space.emory. O-source C 6-vector interrupt structure with priority levels. O2= . (riginally this 754' architecture was introduced with onchip. $he following list gives the features of the 754' architectureN • • • • • • • • • • (ptimized 7 bit !#. the most important part of any embedded controller. +ow you may be wondering about the non mentioning of memory space meant for the program storage. Full .for control applications. $wo 'O bit timerCcounters. 9o it is clear that this 754' architecture was designed to cater many real time embedded needs. versatile serial communication port. Intel delivered all these microcontrollers @756'A with userKs program fused inside the device. .
!A+ :us. First ma/or manufacturer was the #hilips who brought out more than 25-65 derivatives with a variety of IC( options. additional timerCcounter. :ecause of the rush.. 9o #hilips clearly established itself as the market leader in 754' derivatives and still caters to this segment. $o beat the competition. #hilips developed many consumer devices meant for telecom. and peripheral functions. . . .erivativesK. its patented I3! interface bus. #hilips ported high capacity #rogram . Almost every decent manufacturer boasted of having an 754' based microcontroller in the line card. Apart from all these. facilities and etc. electronic community started getting a variety of 754' based devices with range of options.. packages. . !apture and !ompare registers. computer and $) applications.DENSITY BASED TRAFFIC CONTROL SYSTEM .ore IC( ports @as many as eight portsA. $hese parts are popularly known as K754' . #*. A smart card controller was also developed by incorporating a cryptographic engine.any semiconductor manufacturers started either manufacturing the 754' devices as such @Intel was liberal in giving away license to whoever askedA or developing a new kind of microcontrollers based on 754' core architecture. 7C'5 bit Analog to . *atch dog timer.I# and 9.evices became available in regular . manufacturers developed different microcontrollers with many uni ue features. second serial port was also made available in #hilips devices.igital !onverters. *ith the basic 754' core. this 754' architecture gained enviable market acceptance. memory combinations.anufacturers modified the basic 754' architecture and added many new peripheral functions to make them attractive to the designers."0 DERI(ATI(ES Along the way.emory @upto 43=CO2=A.
and lithium cell in a single pack. 9&A. . you can find . . . .illion Instructions #er 9econdA.allas semiconductor.onitor in the 754' devices. space and more interrupt lines were also made available. #recision &eset !ircuitry. &eal $ime !lock.allas has combined this microcontroller.allas redesigned the 754' architecture and eliminated waste clock cycles of original core and made all instructions executed in less clock cycles @maximum of 2A which has traditionally taken upto '3 clock cycles. As you can agree.og $imer. came the birth of "igh speed 754' . security lock and the facility to hide interrupt vector table.DENSITY BASED TRAFFIC CONTROL SYSTEM $hen came . . $his 754' also boasts the tamper proof security features like &eal $ime . :ecause of this &A. $his device guarantees '5M years of data retention in the &A.emory %ncryption.allas semiconductor also has got a range of secure microcontrollers based on 754' core. more onchip &A.allas devices giving upto 65 . memory contents. 9o. 9o.allas introduced additional 9erial port. area. this particular 754' device has found a niche market in banking and security related applications. to keep both program and data. user selected 27 bit %ncryption key. Apart from this. existing compiled code started running faster without any modification. Also a second data pointer. $hese days. #ower Fail . $his microcontroller family uses non volatile &A.erivatives.allas also maintained the same device pin out configurations to enable the user get upto 4J performance by replacing slower parts with a ..allas device. *atch . . the controller gives the In 9ystem &eprogrammability.I#9 @.
$hese devices sport 'O bit architecture using 754' core and unfortunately these devices have not become as popular as 754'. If this programming facility is embedded in the system software.DENSITY BASED TRAFFIC CONTROL SYSTEM Atmel !orporation is the another ma/or semiconductor manufacturer who introduced many flash memory based 754' derivatives at a competitive cost. Atmel used its expertise in flash memory technology into the basic 754' core and brought out microcontrollers with a variety of flash memory options and few devices also carry In 9ystem &eprogramming facility. . onsite system upgradation become as easy as sending your dataCprogram in a floppy disk or by internet.eantime. Intel itself tried to cash in the popularity of this 754' architecture and introduced improved versions of microcontrollersN 75'6' and 7536' families. Atmel devices sport security lock to its flash memory to protect the contents from the prying eyes.%ven after many years of introduction. %IN DIAGRAM OF GENERAL %&R%OSE MICROCONTROLLER . Dou can programCreprogram this microcontroller after soldering the device in the target board. 754' core is still going strong in 7 bit arena. then the tasks like remote calibration.
ata .A during %#&(. for external timing or clocking purposes. even when there are no accesses to external memory.DENSITY BASED TRAFFIC CONTROL SYSTEM ALE/PROG: Address 0atch %nable output pulse for latching the low byte of the address during accesses to external memory. *hen the device is executing out of external #rogram . PSEN: #rogram 9tore %nable is the read strobe to external #rogram .A $his pin is also the program pulse input @#&(. @"owever.emory.emory. A0% is emitted at a constant rate of 'CO of the oscillator fre uency.emory. one A0% pulse is skipped during each access to external . #9%+ is activated twice each machine cycle @except that two #9%+ activations are skipped during . programming.
and in that state will function as high impedance inputs. #ort 5 emits code bytes during program verification.to execute out of external memory regardless of the #rogram !ounter value. programming.emoryA. it uses the strong internal pullups when emitting 's. XTAL2: (utput from the inverting oscillator amplifier. #ort 5 is also the multiplexed low-order address and data bus during accesses to external memory. Port 1: #ort ' is an 7-bit bidirectional IC( port with internal pullups. As an open drain output port. "olding %A low forces the !#. port ' pins that are externally being pulled low will source current because of the internal pullups. In the %#&(. Port 2: #ort 3 is an 7-bit bidirectional IC( port with internal pullups. #ort 3 emits the high-order address byte during accesses to external memory that use 'O-bit addresses. #9%+ is not activated when the device is executing out of internal #rogram . %A must be externally wired low. it can sink eight 09 $$0 loads. . this pin also receives the programming supply voltage @)##A during %#&(. and in that state can be used as inputs.executes out of internal #rogram . Port 0: #ort 5 is an 7-bit open drain bidirectional port. In this application.emory.DENSITY BASED TRAFFIC CONTROL SYSTEM accesses to external . #ort ' pins that have 's written to them are pulled high by the internal pullups. In this application. In the 75!4'. devices. #ort 5 pins that have 's written to them float. EA/VPP: *hen %A is held high the !#. In this application it uses strong internal pullups when emitting 's. external pullups are re uired. XTAL1: Input to the inverting oscillator amplifier.emory @unless the #rogram !ounter exceeds 5FFF" in the 75!6'A.ata . As inputs.
%ach consists of a latch @9pecial Function &egisters #5 through #4A. an output driver. time-multiplexed with the byte being written or read. #ort 5 outputs the low byte of the external memory address.O -*& @external data memory write strobeA #4.4. @serial input portA #4. @external data memory read strobeA )!!N -9upply voltage )99N -!ircuit ground potential All four ports in the 75!6' are bidirectional.< -&. It also serves the functions of various special features of the 75!6' Family as followsN #ort #in Alternate Function #4.3 -I+$5 @external interrupt 5A #4.2 -$5 @timer 5 external inputA #4.&x.5. $he output drivers of #orts 5 and 3. and an input buffer. #ort 4 is an 7-bit bidirectional IC( port with internal pullups.' -$x.I+$' @external interrupt 'A #4. the #ort 3 pins continue to emit the #3 9F& content. (therwise. and the input buffers of #ort 5. are used in accesses to external memory.6 -$' @timer ' external inputA #4.DENSITY BASED TRAFFIC CONTROL SYSTEM Port 3: . In this application. . #ort 3 outputs the high byte of the external memory address when the address is 'O bits wide. @serial output portA #4.
'O-bit data memory addresses can also be generated through the . @external . as shown in Figures ' and 3. which can be uickly stored and manipulated by an 7-bit !#-. +evertheless. .2 $5 @$imerC!ounter 5 external inputA #4.< &.' $x.3 I+$5 @external interruptA #4. but also serve the functions of various special features as listed belowN #ort #in Alternate Function #4.emory write strobeA #4.DENSITY BASED TRAFFIC CONTROL SYSTEM All the #ort 4 pins are multifunctional.5 &x.ata .emory read strobeA MEMORY ORGANISATION $he alternate functions can only be activated if the corresponding bit latch in the port 9F& contains a '.#$& register.ata . $hey are not only port pins.4 I+$' @external interruptA #4. @serial output portA #4.6 $' @$imerC!ounter ' external inputA #4. $he logical separation of program and data memory allows the data memory to be accessed by 7-bit addresses.All 75!6' devices have separate address spaces for program and data memory.O *& @external . @serial input portA #4. (therwise the port pin remains at 5.
In the 75!6'. as its name suggests. -p to O2k bytes of external &A. all program memory is external.emory space.ata memory. &. is used as a general register to accumulate the results of a large number of instructions.ata . The Accumulator If youKve worked with any other assembly language you will be familiar with the concept of an accumulator register. . and *&. the lowest '37 bytes are on-chip. .generates read and write signals.less version. In the &(.ata .emory may be combined if desired by applying the &.emory accesses. if you want to add .A occupies a separate address space from #rogram .emory. can be addressed in the external .emory @&A.I9$%&9 A number of 7563 registers can be considered Gbasic. It can hold an 7-bit @'-byteA value and is the most versatile register the 7563 has due to the sheer number of instructions that make use of the accumulator. the lowest 2k bytes of program are on-chip. the lowest '37 bytes of data memory are on-chip. %#&(.ata .G )ery little can be done without them and a detailed explanation of each one is warranted to make sure the reader understands these registers before getting into more complicated areas of development. gate and using the output of the gate as the read strobe to the external #rogramC.DENSITY BASED TRAFFIC CONTROL SYSTEM #rogram memory @&(..emory and external . $he read strobe for external program memory is the #9%+ @program store enableA. $he !#.A can only be read. not written to.ore than half of the 7563Ks 366 instructions manipulate or use the Accumulator in some way. In the 75!6'. In the &(. $he Accumulator. $here can be up to O2k bytes of program memory.less versions. and #9%+ signals to the inputs of an A+. For example. %xternal #rogram . as needed during external . :A9I! &%.ata .
Dou may think of the G&G registers as very important auxiliary.() &6. The "R" Re !"ter" $he G&G registers are sets of eight registers that are named &5.&' ?. through &<. $o continue with the above example. perhaps you are adding '5 and 35. say. (nce you have a value in the Accumulator you may continue processing the value or you may store it in another register or in memory.&2 After executing this instruction the Accumulator will contain the value 45. $o process the addition you would execute the commandN A. $hese registers are used as auxiliary registers in many operations. register &2. registers..DENSITY BASED TRAFFIC CONTROL SYSTEM the number '5 and 35.&2 .() A.ove the value of &4 to accumulator ?Add the value of &2 ?9tore the result in &6 ?. For example. $he G&G registers are also used to store values temporarily. (ne way to do this would beN .ove the value of &' to Acc .A . the resulting 45 will be stored in the Accumulator. A. $he original number '5 may be stored in the Accumulator whereas the value 35 may be stored in.. A.&4 A. $he Accumulator alone would not be very useful if it were not for these G&G registers. or GhelperG. letQs say you want to add the values in &' and &3 together and then subtract the values of &4 and &2.() A. &'.
. register banks '. if you want to uickly and easily multiply or divide A by another number. A. address 52h.. your program may instruct the 7563 to use one of the alternate register banks? i..I) A:. &2 will no longer be the same as Internal &A. As mentioned earlier. 3. &2 is synonymous with '2h. we used &6 to temporarily hold the sum of &4 and &2. and 4.@&4 M&2A but it does illustrate the use of the G&G registers as a way to store values temporarily. 3. (f course. $he concept of register banks adds a great level of flexibility to the 7563. $hus. there are four sets of G&G registers-register bank 5.&6 ?Add the value of &3 with A ?9ubtract the &6 @which has &4M&2A As you can see. address 52h.. this isnKt the most efficient way to calculate @&'M&3A . "owever. *hen the 7563 is first powered up. for example. especially when dealing with interrupts @weKll talk about interrupts laterA. In this case. For example. or 4. The # Re !"ter $he G:G register is very similar to the Accumulator in the sense that it may hold an 7-bit @'-byteA value.-0 A: and . &2 is the same as Internal &A. address 5!h. "owever. register &2 will now be synonymous with Internal &A. '. $he G:G register is only used implicitly by two 7563 instructionsN . If you select register bank 3. always remember that the register banks really reside in the first 43 bytes of Internal &A. if your program instructs the 7563 to use register bank '. and if you select register bank 4 it is synonymous with address '!h. register bank 5 @addresses 55h through 5<hA is used by default. In this case.e.DENSITY BASED TRAFFIC CONTROL SYSTEM A. you may store the other number in G:G and make use of these two instructions.&3 9-:: A.
$hat is to say. The &ata Po!%ter $he . . It is also interesting to note that while you may change the value of #! @by executing a /ump instruction. $he #! /ust described is a 'O-bit value but isnKt directly user-accessible as a working register. and G:G register are all '-byte values.ata #ointer @. 9ince some instructions are 3 or 4 bytes in length the #! will be incremented by 3 or 4 in these cases. etc. *hen the 7563 is initialized #! always starts at 5555h and is incremented each time an instruction is executed. you canKt do something like #!R3245h.I) instructions. $he Accumulator.#$&A is the 7563Qs only user-accessible 'Obit @3-byteA register. $he #rogram !ounter is special in that there is no way to directly modify its value. $his trick will be covered in a later chapter. this is not completely trueN $here is one trick that may be used to determine the current value of #!. (n the other hand. It is important to note that #! isnKt always incremented by one.# 3245h youKve effectively accomplished the same thing. The Pro ram $ou%ter $he #rogram !ounter @#!A is a 3-byte address that tells the 7563 where the next instruction to execute is found in memory. $hat is to say.A there is no way to read the value of #!. G&G registers.-0 and . if you execute 0I.DENSITY BASED TRAFFIC CONTROL SYSTEM Aside from the . the G:G register are often used as yet another temporary storage register much like a ninth G&G register. there is no way to ask the 7563 G*hat address are you about to executeLG As it turns out.
is used to point to data. many developers take advantage of the fact that itKs the only true 'O-bit register available. may hold an 7-bit @'-byteA value.#$&.#$&. $his order of operation is important. *hen the 7563 accesses external memory it accesses the memory at the address indicated by . address 57h. *hile . like all registers except . the value will be stored in Internal &A. It is used by a number of commands that allow the 7563 to access external memory. *hen the 7563 is initialized 9# will be initialized to 5<h. the 7563 returns the value from the memory location indicated by 9#. $he 9tack #ointer is used to indicate where the next value to be removed from the stack should be taken from. It is often used to store 3-byte values that have nothing to do with memory locations.#$& and #!. *hen you pop a value off the stack.DENSITY BASED TRAFFIC CONTROL SYSTEM . *hen you push a value onto the stack. as the name suggests. If you immediately push a value onto the stack. The Stac' Po!%ter $he 9tack #ointer. ADDRESSING MODES $he addressing modes in the 75!6' instruction set are as followsN . the 7563 first increments the value of 9# and then stores the value at the resulting memory location. and then decrements the value of 9#. $his makes sense taking into account what was mentioned two paragraphs aboveN First the 756' will increment the value of 9# @from 5<h to 57hA and then will store the pushed value at that memory address @57hA.#$& is most often used to point to data in external memory or code memory.
containing registers &5 through &<. some instructions always operate on the Accumulator.DENSITY BASED TRAFFIC CONTROL SYSTEM &!rect A((re""!% In direct addressing the operand is specified by an 7-bit address field in the instruction. :oth internal and external &A. etc. . *hen the instruction is executed. . (ne of four banks is selected at execution time by the two bank select bits in the #9*. $he address register for 7-bit addresses can be &5 or &' of the selected bank.emory. Instructions that access the registers this way are code efficient.!c )%"truct!o%" 9ome instructions are specific to a certain register. since this mode eliminates an address byte.#$&.. Immediate !onstants $he value of a constant can follow the opcode in #rogram . so no address byte is needed to point to it. and 9F&s can be directly addressed.() A.ata &A. can be accessed by certain instructions which carry a 4-bit register specification within the opcode of the instruction. For example. $he address register for 'O-bit addresses can only be the 'O-bit Sdata pointerT register. one of the eight registers in the selected bank is accessed. U For example.ata #ointer. V'55 . )%(!rect A((re""!% In indirect addressing the instruction specifies a register which contains the address of the operand. Instructions that refer to the Accumulator as A assemble as accumulator specific opcodes. Re !"ter*S+ec!. (nly internal . Re2i+ter In+tr*ction+ $he register banks. or . $he opcode itself does that. can be indirectly addressed. or the 9tack #ointer.
and the Accumulator is set up with the table entry number. $he address of the table entry in #rogram . )%(e-e( A((re""!% (nly program . Another type of indexed addressing is used in the Scase /umpT instruction.DENSITY BASED TRAFFIC CONTROL SYSTEM loads the Accumulator with the decimal number '55. In this case the destination address of a /ump instruction is computed as the sum of the base pointer and the Accumulator dataW C3A%TER / . $his addressing mode is intended for reading look-up tables in #rogram . $he same number could be specified in hex digits as O2".#$& or the #rogram !ounterA points to the base of the table. and it can only be read.emory A 'O-bit base register @either .emory can be accessed with indexed addressing.emory is formed by adding the Accumulator data to the base pointer.
DENSITY BASED TRAFFIC CONTROL SYSTEM
AT !S"# MICROCONTROLLER
DENSITY BASED TRAFFIC CONTROL SYSTEM
$he A$78963 is a low-power, high-performance !.(9 7-bit microcontroller with 7= bytes of in system programmable Flash memory. $he device is manufactured using Atmel1s high-density nonvolatile memory technology and is compatible with the industry- standard 75!6' instruction set and pinout. $he on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. :y combining a versatile 7-bit !#- with insystem programmable Flash on a monolithic chip, the Atmel A$78963 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications.$he A$78963 provides the following standard featuresN 7= bytes of Flash, 36O bytes of &A., 43 IC( lines, *atchdog timer, two data pointers, three 'O-bit timerCcounters, a six-vector twolevel interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the A$78963 is designed with static logic for operation down to zero fre uency and supports two software selectable power saving modes. $he Idle .ode stops the !#- while allowing the &A., timerCcounters, serial port, and interrupt system to continue functioning. $he #ower-down mode saves the &A. contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset.
Features X !ompatible with .!9-6'Y #roducts X 7= :ytes of In-9ystem #rogrammable @I9#A Flash .emory B %nduranceN '555 *riteC%rase !ycles
DENSITY BASED TRAFFIC CONTROL SYSTEM
X 2.5) to 6.6) (perating &ange X Fully 9tatic (perationN 5 "z to 44 ."z X $hree-level #rogram .emory 0ock X 36O x 7-bit Internal &A. X 43 #rogrammable IC( 0ines X $hree 'O-bit $imerC!ounters X %ight Interrupt 9ources X Full ,uplex -A&$ 9erial !hannel X 0ow-power Idle and #ower-down .odes X Interrupt &ecovery from #ower-down .ode X *atchdog $imer X ,ual ,ata #ointer X #ower-off Flag X Fast #rogramming $ime X Flexible I9# #rogramming @:yte and #age .odeA
DENSITY BASED TRAFFIC CONTROL SYSTEM .
DENSITY BASED TRAFFIC CONTROL SYSTEM .
DENSITY BASED TRAFFIC CONTROL SYSTEM #in .escription )!! 9upply voltage. .+. . .round.
*hen 's are written to #ort 3 pins. *hen 's are written to port 5 pins. As an output port. %xternal pull-ups are re uired during program verification. Port 2 #ort 3 is an 7-bit bidirectional IC( port with internal pull-ups.5 and #'. . As inputs. #'. In this mode. the pins can be used as highimpedance inputs.DENSITY BASED TRAFFIC CONTROL SYSTEM Port 0 #ort 5 is an 7-bit open drain bidirectional IC( port. #ort ' also receives the low-order address bytes during Flash programming and verification. In addition.' can be configured to be the timerCcounter 3 external count input @#'.5C$3A and the timerCcounter 3 trigger input @#'. #ort ' pins that are externally being pulled low will source current @II0A because of the internal pull-ups. #ort 5 also receives the code bytes during Flash programming and outputs the code bytes during program verification. #5 has internal pull-ups. they are pulled high by the internal pull-ups and can be used as inputs.#ort 5 can also be configured to be the multiplexed low-order addressCdata bus during accesses to external program and data memory. as shown in the following table. each pin can sinkeight $$0 inputs. *hen 's are written to #ort ' pins.'C$3%JA. #ort ' #ort ' is an 7-bit bidirectional IC( port with internal pull-ups. $he #ort 3 output buffers can sinkCsource four $$0 inputs. respectively. $he #ort ' output buffers can sinkCsource four $$0 inputs.
as shown in the following table. . As inputs. *hen 's are written to #ort 4 pins.#$&A. #ort 3 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 'O-bit addresses @. #ort 4 receives some control signals for Flash programming and verification. #ort 3 uses strong internal pull-ups when emitting 's. #ort 4 also serves the functions of various special features of the A$78963. As inputs.uring accesses to external data memory that use 7-bit addresses @. #ort 3 also receives the high-order address bits and some control signals during Flash programming and verification.DENSITY BASED TRAFFIC CONTROL SYSTEM they are pulled high by the internal pull-ups and can be used as inputs. #ort 4 pins that are externally being pulled low will source current @II0A because of the pull-ups. they are pulled high by the internal pull-ups and can be used as inputs. In this application. . Port 3 #ort 4 is an 7-bit bidirectional IC( port with internal pull-ups. #ort 3 pins that are externally being pulled low will source current @II0A because of the internal pull-ups. #ort 3 emits the contents of the #3 9pecial Function &egister.()J Z . $he #ort 4 output buffers can sinkCsource four $$0 inputs.()J Z &IA.
()! instruction. In normal operation. *ith the bit set. that one A0% pulse is skipped during each access to external data memory.()J or .DENSITY BASED TRAFFIC CONTROL SYSTEM &9$ &eset input." out feature is enabled. If desired. the pin is weakly pulled . the &%9%$ "I. $his pin drives high for 87 oscillator periods after the *atchdog times out. $he .I9&$( bit in 9F& A-J& @address 7%"A can be used to disable this feature. A0% is active only during a . +ote. A high on this pin for two machine cycles while the oscillator is running resets the device. A0% is emitted at a constant rate of 'CO the oscillator fre uency and may be used for external timing or clocking purposes. however. In the default state of bit . $his pin is also the program pulse input @#&(. Address 0atch %nable @A0%A is an output pulse for latching the low byte of the address during accesses to external memory.A during Flash programming. A0%C#&(.I9&$(. (therwise. A0% operation can be disabled by setting bit 5 of 9F& location 7%".
$his pin also receives the '3-volt programming enable voltage @)##A during Flash programming. %A must be strapped to .+ote. EA/VPP %xternal Access %nable. in order to enable the device to fetch code from external program memory locations starting at 5555" up to FFFF".*hen the A$78963 is executing code from external program memory.+. PSEN #rogram 9tore %nable @#9%+A is the read strobe to external program memory. 9etting the A0%-disable bit has no effect if the microcontroller is in external execution mode. %A should be strapped to )!! for internal program executions. #9%+ is activated twice each machine cycle. S+ec!al . that if lock bit ' is programmed.DENSITY BASED TRAFFIC CONTROL SYSTEM high. however. J$A03 (utput from the inverting oscillator amplifier. except that two #9%+ activations are skipped during each access to external data memory. %A will be internally latched on reset. J$A0' Input to the inverting oscillator amplifier and input to the internal clock operating circuit.u%ct!o% Re !"ter" A map of the on-chip memory area called the 9pecial Function &egister @9F&A space is .
DENSITY BASED TRAFFIC CONTROL SYSTEM shown in $able '. @shown in $able OA for $imer 3.-ser software should not write 's to these unlisted locations. and write accesses will have an indeterminate effect.(. and unoccupied addresses may not be implemented on the chip. since they may be used in Future products to invoke new features. &ead accesses to these addresses will in general return random data. T!mer 2 Re !"ter"N !ontrol and status bits are contained in registers $3!(+ @shown in $able 3A and $3.&!A#30A are the !aptureC&eload registers for $imer 3 in 'O-bit capture mode or 'O-bit auto-reload mode. +ote that not all of the addresses are occupied. . )%terru+t Re !"ter"N $he individual interrupt enable bits are in the I% register. In that case. $wo priorities can be set for each of the six interrupt sources in the I# register. $he register pair @&!A#3". the reset or inactive values of the new bits will always be 5.
DENSITY BASED TRAFFIC CONTROL SYSTEM .
DENSITY BASED TRAFFIC CONTROL SYSTEM .
#5 and .#' at 72"-76".ual . .ata #ointer &egisters are providedN . It can be set and rest under software control and is not affected by reset.#9 R 5 in 9F& A-J&' selects .ata #ointer &egister.#9 R ' selects .ata #ointer &egistersN $o facilitate accessing both internal and external data memory. $he user should A0*AD9 initialize the . :it .#5 at 9F& address locations 73"-74" and .2A in the #!(+ 9F&.DENSITY BASED TRAFFIC CONTROL SYSTEM . two banks of 'O-bit . #(F is set to S'T during power up.#'.#9 bit to the appropriate value before accessing the respective . #ower (ff FlagN $he #ower (ff Flag @#(FA is located at bit 2 @#!(+.
emory.. *hen an instruction accesses an internal location above address <F". -p to O2= bytes each of external #rogram and .!9-6' devices have a separate address space for #rogram and . accesses the data byte at address 5A5".+.emory (rganization . if %A is connected to )!!. . the address mode used in the instruction specifies whether the !#. Vdata Instructions that use indirect addressing access the upper '37 bytes of &A.() Z&5.ata .ata .emory $he A$78963 implements 36O bytes of on-chip &A. . the following indirect addressing instruction. Instructions which use direct addressing access the 9F& space. Vdata .() 5A5".emory If the %A pin is connected to . where &5 contains 5A5". For example.emory can be addressed. (n the A$78963.DENSITY BASED TRAFFIC CONTROL SYSTEM . rather than #3 @whose address is 5A5"A. $he upper '37 bytes occupy a parallel address space to the 9pecial Function &egisters. program fetches to addresses 5555" through 'FFF" are directed to internal memory and fetches to addresses 3555" through FFFF" are to external memory...ata . 8 '8'8:B.accesses the upper '37 bytes of &A. or the 9F& space. . $his means that the upper '37 bytes have the same addresses as the 9F& space but are physically separate from 9F& space. #rogram .I!&(B''C54 For example. the following direct addressing instruction accesses the 9F& at location 5A5" @which is #3A. all program fetches are directed to external memory.
$ timeout period is dependent on the external clock fre uency. it will drive an output &%9%$ "I.$ consists of a '2-bit counter and the *atchdog $imer &eset @*.$ is defaulted to disable from exiting reset.$ the user must write 5'%" and 5%'" to *. $he *.DENSITY BASED TRAFFIC CONTROL SYSTEM +ote that stack operations are examples of indirect addressing. $he *. *hen *.$ is intended as a recovery method in situations where the !#. *hen the *. it will increment every machine cycle while the oscillator is running.$&9$ register @9F& location 5AO"A. *hen *.$&9$A 9F&. it should be . $o enable the *. it will increment every machine cycle while the oscillator is running.$ except through reset @either hardware reset or *. *hen the *.may be sub/ected to software upsets.$ $o enable the *.$.$.$ overflows.$&9$ is a write-only register." pulse at the &9$ pin.$ overflows. $here is no way to disable the *. *hen the *.$ is enabled.$ is enabled.$&9$ register @9F& location 5AO"A. and this will reset the device. $o reset the *. $he &%9%$ pulse duration is 87x$(9!. *. so the upper '37 bytes of data &A.$. are available as stack space.$&9$. it will generate an output &%9%$ pulse at the &9$ pin. the user needs to service it by writing 5'%" and 5%'" to *. a user must write 5'%" and 5%'" in se uence to the *. *atchdog $imer@(ne-time %nabled with &eset-outA $he *. $he *.$&9$ to avoid a *. where $(9! R 'CF(9!. $he '2-bit counter overflows when it reaches 'O474 @4FFF"A.$ overflow.$ overflow resetA.$ at least every 'O474 machine cycles. -sing the *. $he *.$ counter cannot be read or written. a user must write 5'%" and 5%'" in se uence to the *. $o make the best use of the *. $his means the user must reset the *.$ is enabled.
$o prevent the *.I.$ continues to count if enabled. servicing the *. %xiting #ower-down with an interrupt is significantly different.0% bit in 9F& A-J& is used to determine whether the *.0%.$ be reset during the interrupt service for the interrupt used to exit #ower-down mode. and reenter I. . $here are two methods of exiting #ower-down modeN by a hardware reset or via a level-activated external interrupt which is enabled prior to entering #ower-down mode.$.DENSITY BASED TRAFFIC CONTROL SYSTEM serviced in those sections of code that will periodically be executed within the time re uired to prevent a *.$ from resetting the A$78963 while in I. *hen #ower-down is exited with hardware reset.$ reset. *hen the interrupt is brought high. the interrupt is serviced.0% mode.$ keeps counting during I.$ also stops. *hile in #ower-down mode. $o prevent the *.$ /ust before entering #ower-down mode. which means the *. the *.$ does not overflow within a few states of exiting #ower-down.0% mode. :efore going into the I.$ is not started until the interrupt is pulled high. $he *.0% mode.$ from resetting the device while the interrupt pin is held low. It is suggested that the *. service the *.$. the user does not need to service the *.0% @*. it is best to reset the *.$ should occur as it normally does whenever the A$78963 is reset.0% bit R 5A as the default state. $he interrupt is held low long enough for the oscillator to stabilize. the *. /&T &ur!% Po0er(o0% a%( )(le In #ower-down mode the oscillator stops. the user should always set up a timer that will periodically exit I. $o ensure that the *.I.
refer to the A$. 9ince a machine cycle consists of '3 oscillator periods. For further information on the -A&$ operation. $imer 3 consists of two 7-bit registers. and baud rate generator. then S#roduct (verviewT. -A&$ $he -A&$ in the A$78963 operates the same way as the -A&$ in the A$78!6' and A$78!63. auto-reload @up or down countingA. In the !ounter function. then S#roduct (verviewT. For further information on the timersT operation. the *.0% bit enabled.$ will stop to count in I.I. select S#roductsT. then S756'Architecture Flash .icrocontrollerT.DENSITY BASED TRAFFIC CONTROL SYSTEM *ith *.comA.0% mode and resumes the count upon exit from I. then S756'-Architecture Flash . the external input is sampled .0%. $3. $imer 3 has three operating modesN capture. select S#roductsT. In this function. $"3 and $03. the count rate is 'C'3 of the oscillator fre uency. $imer 5 and ' $imer 5 and $imer ' in the A$78963 operate the same way as $imer 5 and $imer ' in the A$78!6' and A$78!63.comA. $he modes are selected by bits in $3!(+. From the home page. In the $imer function. $imer 3 $imer 3 is a 'O-bit $imerC!ounter that can operate as either a timer or an event counter.%0 *eb site @httpNCCwww. refer to the A$. as shown in $able 6.%0 *eb site @httpNCCwww. $he type of operation is selected by bit !C$3 in the 9F& $3!(+ @shown in $able 3A. From the home page. the $03 register is incremented every machine cycle. the register is incremented in response to a '-to-5 transition at its corresponding external input pin.icrocontrollerT.atmel.atmel.
$he capture mode is illustrated in Figure '.DENSITY BASED TRAFFIC CONTROL SYSTEM during 96#3 of every machine cycle. $his bit can then be used to generate an interrupt. . $he %JF3 bit. the maximum count rate is 'C32 of the oscillator fre uency. Auto-reload @-p or . depending on the value of the $3%J pin. like $F3. can generate an interrupt.own !ounterA $imer 3 can be programmed to count up or down when configured in its 'O-bit autoreload mode. the level should be held for at least one full machine cycle. respectively. the transition at $3%J causes bit %JF3 in $3!(+ to be set.!%+ bit is set to 5 so that timer 3 will default to count up. $imer 3 can count up or down. $imer 3 performs the same operation. If %J%+3 R 5.!%+ @. $his feature is invoked by the . $he new count value appears in the register during 94#' of the cycle following the one in which the transition was detected. In addition. $o ensure that a given level is sampled at least once before it changes. but a '-to-5 transition at external input $3%J also causes the current value in $"3 and $03 to be captured into &!A#3" and &!A#30.!%+ is set. *hen the samples show a high in one cycle and a low in the next cycle. *hen . -pon reset. 9ince two machine cycles @32 oscillator periodsA are re uired to recognize a '-to-5 transition. two options are selected by bit %J%+3 in $3!(+. $imer 3 is a 'O-bit timer or counter which upon overflow sets bit $F3 in $3!(+.ode In the capture mode.own !ounter %nableA bit located in the 9F& $3. If %J%+3 R '. @see $able OA. the . !apture .(. the count is incremented.
!%+ R 5. $he overflow also causes the timer registers to be reloaded with the 'O-bit value in &!A#3" and &!A#30. $imer 3 counts up to 5FFFF" and then sets the $F3 bit upon overflow. $his transition also sets the %JF3 bit. If %J%+3 R 5. If %J%+3 R '.DENSITY BASED TRAFFIC CONTROL SYSTEM Figure 3 shows $imer 3 automatically counting up when . a 'O-bit reload can be triggered either by an overflow or by a '-to-5 transition at external input $3%J. In this mode. . :oth the $F3 and %JF3 bits can generate an interrupt if enabled.ode&!A#3" and &!A#30 are preset by software. $he values in $imer in !apture . two options are selected by bit %J%+3 in $3!(+.
In this operating mode. the $3%J pin controls the direction of the count.!%+ bit enables $imer 3 to count up or down.R . In this mode. %JF3 does not flag an interrupt. respectively. as shown in Figure 3. $he timer underflows when $"3 and $03 e ual the values stored in &!A#3" and &!A#30. $he underflow sets the $F3 bit and causes 5FFFF" to be reloaded into the timer registers. $his overflow also causes the 'O-bit value in &!A#3" and &!A#30 to be reloaded into the timer registers. $he %JF3 bit toggles whenever $imer 3 overflows or underflows and can be used as a '<th bit of resolution. ----------------------------------------------------------. A logic 5 at $3%J makes $imer 3 count down. $"3 and $03.DENSITY BASED TRAFFIC CONTROL SYSTEM 9etting the . A logic ' at $3%J makes $imer 3 count up. $he timer will overflow at 5FFFF" and set the $F3 bit.
$he baud rate generator mode is similar to the auto-reload mode.DENSITY BASED TRAFFIC CONTROL SYSTEM :aud &ate . in that a rollover in . +ote that the baud rates for transmit and receive can be different if $imer 3 is used for the receiver or transmitter and $imer ' is used for the other function.enerator $imer 3 is selected as the baud rate generator by setting $!0= andCor &!0= in $3!(+ @$able 3A. as shown in Figure 2. 9etting &!0= andCor $!0= puts $imer 3 into its baud rate generator mode.
&!A#30A is the content of &!A#3" and &!A#30 taken as a 'O-bit unsigned integer. +ormally. it is configured for timer operation @!#C$3 R 5A. $he baud rate formula is given below. where @&!A#3". which are preset by software. As a baud rate generator. +ote that a rollover in $"3 does not set $F3 and . it increments every machine cycle @at 'C'3 the oscillator fre uencyA. $his figure is valid only if &!0= or $!0= R ' in $3!(+.DENSITY BASED TRAFFIC CONTROL SYSTEM $"3 causes the $imer 3 registers to be reloaded with the 'O-bit value in registers &!A#3" and &!A#30. $he timer operation is different for $imer 3 when it is used as a baud rate generator.odes ' and 4 are determined by $imer 31s overflow rate according to the following e uation. $he baud rates in . however. it increments every state time @at 'C3 the oscillator fre uencyA. $he $imer can be configured for either timer or counter operation. as a timer. In most applications. $imer 3 as a baud rate generator is shown in Figure 2.
it is configured for timer operation @!#C$3 R 5A. that if %J%+3 is set. $"3 or $03 should not be read from or written to. &!A#30A to @$"3. +ormally. $he timer should be turned off @clear $&3A before accessing the $imer 3 or &!A#3 registers. it increments every state time @at 'C3 the oscillator fre uencyA. $hus. $he baud rate formula is given below. and the results of a read or write may not be accurate. $3%J can be used as an extra external interrupt. -nder these conditions. +ote too. $he &!A#3 registers may be read but should not be written to. In most applications. +ote that when $imer 3 is running @$&3 R 'A as a timer in the baud rate generator mode. it increments every machine cycle @at 'C'3 the oscillator fre uencyA. however. as a timer. because a write might overlap a reload and cause write andCor reload errors. As a baud rate generator. $he timer operation is different for $imer 3 when it is used as a baud rate generator. $03A.odes ' and 4 :aud &atesR $imer 3 (verflowrateC'O [ [ $he $imer can be configured for either timer or counter operation. the $imer is incremented every state time. when $imer 3 is in use as a baud rate generator.DENSITY BASED TRAFFIC CONTROL SYSTEM will not generate an interrupt. a '-to-5 transition in $3%J will set %JF3 but will not cause a reload from @&!A#3". . .
+ote too. &!A#30A to @$"3. -nder these conditions. a '-to-5 transition in $3%J will set %JF3 but will not cause a reload from @&!A#3". $he timer should be turned off @clear $&3A before accessing the $imer 3 or &!A#3 registers. $03A. $3%J can be used as an extra external interrupt. +ote that when $imer 3 is running @$&3 R 'A as a timer in the baud rate generator mode. +ote that a rollover in $"3 does not set $F3 and will not generate an interrupt. because a write might overlap a reload and cause write andCor reload errors. $imer 3 as a baud rate generator is shown in Figure 2. when $imer 3is in use as a baud rate generator. and the results of a read or write may not be accurate. $"3 or $03 should not be read from or written to. . $he &!A#3 registers may be read but should not be written to. $his figure is valid only if &!0= or $!0= R ' in $3!(+.DENSITY BASED TRAFFIC CONTROL SYSTEM where @&!A#3". that if %J%+3 is set. &!A#30A is the content of &!A#3" and &!A#30 taken as a 'O-bit unsigned integer. $hus. the $imer is incremented every state time.
"z @for a 'O-.DENSITY BASED TRAFFIC CONTROL SYSTEM #rogrammable !lock (ut A 65\ duty cycle clock can be programmed to come out on #'.(. $his pin. $he clock-out fre uency depends on the oscillator fre uency and the reload value of .'A must be cleared and bit $3(% @$3. :it $&3 @$3!(+. besides being a regular IC( pin.3A starts and stops the timer.'A must be set. has two alternate functions. $o configure the $imerC!ounter 3 as a clock generator.. bit !C$3 @$3!(+. It can be programmed to input the external clock for $imerC!ounter 3 or to output a 65\ duty cycle clock ranging from O' "z to 2 . as shown in Figure 6."z operating fre uencyA.5.
. however.DENSITY BASED TRAFFIC CONTROL SYSTEM $imer 3 capture registers @&!A#3". It is possible to use $imer 3 as a baud-rate generator and a clock generator simultaneously. $imer 3 roll-overs will not generate an interrupt. that the baud-rate and clock-out fre uencies cannot be determined independently from one another since they both use &!A#3" and &!A#30. +ote. &!A#30A. In the clock-out mode. as shown in the following e uation. $his behavior is similar to when $imer 3 is used as a baud-rate generator.
the service routine may have to determine whether it was $F3 or %JF3 that generated the interrupt. $F5 and $F'. and that bit will have to be cleared in software. In fact. %A. $F3. '. is set at 93#3 and is polled in the same cycle in which the timer overflows. I% also contains a global disable bit.O is unimplemented. . three timer interrupts @$imers 5. are set at 96#3 of the cycle in which the timers overflow. $he $imer 5 and $imer ' flags. $he values are then polled by the circuitry in the next cycle. $imer 3 interrupt is generated by the logical (& of bits $F3 and %JF3 in register $3!(+. and 3A. which disables all interrupts at once.DENSITY BASED TRAFFIC CONTROL SYSTEM Interrupts $he A$78963 has a total of six interrupt vectorsN two external interrupts @I+$5 and I+$'A. $hese interrupts are all shown in Figure O. "owever. +ote that $able 6 shows that bit position I%. since it may be used in future A$78 products. the $imer 3 flag. +either of these flags is cleared by hardware when the service routine is vectored to. -ser software should not write a ' to this bit position. and the serial port interrupt. %ach of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in 9pecial Function &egister I%.
DENSITY BASED TRAFFIC CONTROL SYSTEM (scillator !haracteristics .
of an inverting amplifier that can be configured for use as an on-chip oscillator. but access to the port pins is not inhibited. since the input to the internal clocking circuitry is through a divide-by-two flip-flop. as shown in Figure 7.ode In idle mode. and all the special functions registers remain unchanged during this mode. the device normally resumes program execution from where it left off. #ower-down . up to two machine cycles before the internal reset algorithm takes control. %ither a uartz crystal or ceramic resonator may be used. respectively.puts itself to sleep while all the on-chip peripherals remain active. the instruction following the one that invokes idle mode should not write to a port pin or to external memory. +ote that when idle mode is terminated by a hardware reset. $he on-chip &A. $o eliminate the possibility of an unexpected write to a port pin when idle mode is terminated by a reset. and 9pecial Function &egisters retain their values until the #ower-down . $he idle mode can be terminated by any enabled interrupt or by a hardware reset. in this event.ode In the #ower-down mode. the !#.DENSITY BASED TRAFFIC CONTROL SYSTEM J$A0' and J$A03 are the input and output. $he content of the onchip &A. (n-chip hardware inhibits access to internal &A. $o drive the device from an external clock source. the oscillator is stopped. as shown in Figure <. Idle . $here are no re uirements on the duty cycle of the external clock signal. but minimum and maximum voltage high and low time specifications must be observed. and the instruction that invokes #ower-down is the last instruction executed. $he mode is invoked by software. J$A03 should be left unconnected while J$A0' is driven.
. &eset redefines the 9F&s but does not change the on-chip &A. %xit from #owerdown mode can be initiated either by a hardware reset or by an enabled external interrupt. $he reset should not be activated before )!! is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize.DENSITY BASED TRAFFIC CONTROL SYSTEM mode is terminated. .
DENSITY BASED TRAFFIC CONTROL SYSTEM .
DENSITY BASED TRAFFIC CONTROL SYSTEM
#rogram .emory 0ock :its $he A$78963 has three lock bits that can be left unprogrammed @-A or can be programmed @#A to obtain the additional features listed in the following table.
*hen lock bit ' is programmed, the logic level at the %A pin is sampled and latched during reset. If the device is powered up without a reset, the latch
DENSITY BASED TRAFFIC CONTROL SYSTEM
initializes to a random value and holds that value until reset is activated. $he latched value of %A must agree with the current logic level at that pin in order for the device to function properly. Pro ramm!% the .la"h 1 Parallel 2o(e $he A$78963 is shipped with the on-chip Flash memory array ready to be programmed. $he programming interface needs a high-voltage @'3-voltA program enable signal and is compatible with conventional third-party Flash or %#&(. programmers. $he A$78963 code memory array is programmed byte-by-byte. #rogramming AlgorithmN :efore programming the A$78963, the address, data, and control signals should be set up according to the Flash programming mode table and Figures '4 and '2. $o program the A$78963, take the following stepsN '. Input the desired memory location on the address lines. 3. Input the appropriate data byte on the data lines. 4. Activate the correct combination of control signals. 2. &aise %AC)## to '3). 6. #ulse A0%C#&(; once to program a byte in the Flash array or the lock bits. $he byte-write cycle is self-timed and typically takes no more than 65 ]s. &epeat steps ' through 6, changing the address and data for the entire array or until the end of the ob/ect file is reached.
DENSITY BASED TRAFFIC CONTROL SYSTEM
,ata #ollingN $he A$78963 features ,ata #olling to indicate the end of a byte write cycle. ,uring a write cycle, an attempted read of the last byte written will result in the complement of the written data on #5.<. (nce the write cycle has been completed, true data is valid on all outputs, and the next cycle may begin. ,ata #olling may begin any time after a write cycle has been initiated. Rea(3/#u"3N $he progress of byte programming can also be monitored by the &,DC:9D output signal. #4.5 is pulled low after A0% goes high during programming to indicate :-9D. #4.5 is pulled high again when programming is done to indicate &%A,D. Pro ram Ver!,3N If lock bits 0:' and 0:3 have not been programmed, the programmed code data can be read back via the address and data lines for verification. $he status of the individual lock bits can be verified directly by reading them back. Rea(!% the S! %ature #3te"N $he signature bytes are read by the same procedure as a normal verification of locations 555", '55", and 355", except that #4.O and #4.< must be pulled to a logic low. $he values returned are as follows. @555"A R '%" indicates manufactured by Atmel @'55"A R 63" indicates A$78963 @355"A R 5O" !hip %raseN In the parallel programming mode, a chip erase operation is initiated by using the proper combination of control signals and by pulsing A0%C#&(; low
I9( @outputA. . $he serial interface consists of pins 9!=.(9I @inputA and . $he !hip %rase operation turns the content of every memory location in the !ode array into FF". $he maximum serial clock @9!=A fre uency should be less than 'C'O of the crystal fre uency."z oscillator clock.uring chip erase. pins. chip erase is self-timed and takes about 655 ms. a chip erase operation is initiated by issuing the !hip %rase instruction. In this mode. *ith a 44 . Pro ramm!% the . the maximum 9!= fre uency is 3 . a serial read from any address location will return 55" at the data output. In the serial programming mode."z. %ither an external system clock can be supplied at pin J$A0' or a crystal needs to be connected across pins J$A0' and J$A03. After &9$ is set high.+.655 ns. the #rogramming %nable instruction needs to be executed first before other operations can be executed. .la"h 1 Ser!al 2o(e $he !ode memory array can be programmed using the serial I9# interface while &9$ is pulled to )!!. the following se uence is recommendedN '. a !hip %rase operation is re uired.DENSITY BASED TRAFFIC CONTROL SYSTEM for a duration of 355 ns . Ser!al Pro ramm!% Algorithm $o program and verify the A$78963 in the serial programming mode. :efore a reprogramming se uence can occur. #ower-up se uenceN Apply power between )!! and . .
&ata Poll!% N $he .6 ms at 6). &9$ can be set low to commence normal device operation.O."z clock to J$A0' pin and wait for at least '5 milliseconds. $he !ode array is programmed one byte at a time in either the :yte or #age mode.6.< needs to be less than the !#.(9IC#'. %nable serial programming by sending the #rogramming %nable serial instruction to pin . 9et &9$ to S0T.clock at J$A0' divided by 'O. 6.DENSITY BASED TRAFFIC CONTROL SYSTEM 9et &9$ pin to S"T. Any memory location can be verified by using the &ead instruction which returns the content at the selected address at serial output . 2."z to44 . 4. $he write cycle is self-timed and typically takes less than 5.9: of the serial output byte on . At the end of a programming session. $he fre uency of the shift clock supplied at pin 9!=C#'. 3. . In this mode.If a crystal is not connected across pins J$A0' and J$A03.during a write cycle an attempted read of the last byte written will result in the complement of the . $urn )!! power off.I9(. apply a 4 .ata #olling feature is also available in the serial mode.I9(C#'. #ower-off se uence @if neededAN 9et J$A0' to S0T @if a crystal is not usedA.
DENSITY BASED TRAFFIC CONTROL SYSTEM .
DENSITY BASED TRAFFIC CONTROL SYSTEM .
DENSITY BASED TRAFFIC CONTROL SYSTEM .
DENSITY BASED TRAFFIC CONTROL SYSTEM .
ode Figure '4. 9erial #rogramming *aveforms .DENSITY BASED TRAFFIC CONTROL SYSTEM Flash #rogramming and )erification *aveforms B 9erial .
DENSITY BASED TRAFFIC CONTROL SYSTEM .
DENSITY BASED TRAFFIC CONTROL SYSTEM .
DENSITY BASED TRAFFIC CONTROL SYSTEM C3A%TER 4 INTERFACING DE(ICES RS#/# 5+erial port67 .
$he &9343 is the communication line which enables the data transmission by only using three wire links. respectively. &9343 is the most known serial port used in transmitting the data in communication and interface. %ven though serial port is harder to program than the parallel port. ..e.. Dou need .$D#% 8 pin connector. $he ^transmit1 and ^receive1 line on this connecter send and receive data between the computers. ^receive1 and common ground.9&. we have chosen the new &9-343. this is the most effective method in which the data transmission re uires less wires that yields to the less cost. he electrical characteristics of the serial port as per the %IA @%lectronics Industry AssociationA &9343! 9tandard specifies a maximum baud rate of 35.$% @data terminal e uipmentA and . 9tandard.!% @data communications e uipmentA? for example.343A is a telecommunications standard for binary serial communications between devices. and &$9. has existed in two types. $he ^'1 and ^51 are the data which defines a voltage level of 4) to 36) and -4) to -36) respectively. which are male connectors on the back of the #!. $he three links provides ^transmit1.. $he devices are commonly referred to as a . _ &J.. . !$9.555bps. which is slow compared to today1s standard speed. It supplies the roadmap for the way devices speak to each other using serial ports. &I. i. which was recently released. the data is transmitted serially. $here are other lines on this port as &$9. For this reason. a computer and modem.-$D#% 36 pin connector and . $he &9-343.DENSITY BASED TRAFFIC CONTROL SYSTEM &9-343 @&ecommended 9tandard . .$&. $he two pins are $J. As the name indicates.
.ata @9erial data outputA ready to exchange data !lear to send @i. $he pin outs of both .$& &I Function &eceive . &$9 !$9 .-8 _ . 4 3 < 7 O 6 ' 2 8 no.-$ype-8 pin . .-36 are show below .? modem is ready to exchange dataA .!.9& 9.ata !arrier detect @$his line is active when modem detects a carrier . 3 4 2 6 O < 7 35 33 #in outs &. &ing Indicator @:ecomes active when modem detects ringing signal from #9$+ &e uest to send @acknowledge to modem that -A&$ is .DENSITY BASED TRAFFIC CONTROL SYSTEM a female connector on your communication from "ost to .ata @9erial data inputA $ransmit . $.-$ype-36 pin no.ata $erminal &eady.ata ready state @-A&$ establishes a linkA 9ignal ground .e.uest computer.
7) Lo2ic "igh 0ow .DENSITY BASED TRAFFIC CONTROL SYSTEM R+#/# *hen communicating with various micro processors one needs to convert the &9343 levels down to lower levels. Serial RS8#/# @).5 ) olt+7 "ere is a cheap and simple way to do that. TTL logic operates between 5) and M6) .4) or even lower. RS8#/# TTL -'6) W -4) M3) W M6) M4) W M'6) 5) W M5. .32A communication works with voltages -'6) to M'6) for high and low. (n the other hand. typically 4.4 or 6.odern low power consumption logic operates in the range of 5) and M4.
#/# . $he max343 is uite cheap @less than 6 dollarsA or if youre lucky you can get a free sample from Ma:i)7$he .IA.'6 4 -`!'. .8 M--------M RS#/# INTERFACED TO MA.DENSITY BASED TRAFFIC CONTROL SYSTEM $hus the &9-343 signal levels are far too high TTL electronic+9 and the negative &9-343 voltage for high can1t be handled at all by computer logic. M---UC---M ' -`!'M )cc`.4)A and generates the necessary &9-343 voltage levels. It became popular.&A.&'(`. $o receive serial data from an &9-343 interface the voltage has to be reduced.'' < -`$3( $3I`.'3 O -`).'2 2 -`!3M &'I`.'O 3 -`)M gnd`.'5 7 -`&3I &3(`. because it /ust needs one voltage @M6) or M4.$'I`. Also the low and high voltage level has to be inverted.AJ343 from Ma:i) was the first I! which in one package contains the necessary drivers and receivers to adapt the &9-343 signal voltage levels to $$0 logic.AJ 343 #I+ . $his level converter uses a Ma:#/# and five capacitor+.'4 6 -`!3.$'(`.
1 u f C7 0 .0 R X D T1O U T V+ V- &s343 is 8 pin db connector.6 the transmit pin of rs343 is connected to rx pin of microcontroller Ma:#/# interfaced to )icrocontroller .1 C4 5V C 0 .4.1 u f 0 .DENSITY BASED TRAFFIC CONTROL SYSTEM J2 9 8 7 6 5 4 3 2 1 16 U3 T1O U T T XD P 3 .only three pins of this are used ie 3. VCC .1 u f M A X32 32 15 2 6 13 8 10 11 1 3 4 5 R 1 IN R 2 IN T2 IN T1 IN C C C C 1+ 12+ 2GND C1 1uf R 1O U T R 2O U T T1O U T T2O U T 12 9 14 7 P 3 . 51 u f C6 0 .
material used. @light emitting diodeA color is characterized by the wavelength it emits. '3 pin are connected to the '5 and '' pin ie transmit and receive pin microcontroller of LED<S $ Fi2$0! LED<+ interfacin2 0%.DENSITY BASED TRAFFIC CONTROL SYSTEM . . $his energy differs according to the 0%.AJ343 is connected to the microcontroller as shown in the figure above ''. $he peak emission wavelength differs according to the energy released during recombination.
*hile a dedicated supply is uite handy e.A current limiting resistor is mandatory to protect both the microcontroller _ 0%. (hms law can be used to calculate the value of the current limiting resistor .. we use a 0. different luminous colors from red to yellow are obtained. )arying the output of the power supply is the recommended way to test a pro/ect after having double checked parts placement against circuit drawings and the parts placement guide.a# _ .A +#+ or a #+# transistor may be used.s can typically draw up to 45mA. $he I! is shown below. $o use these parts we need to build a regulated 6 volt source. .ost digital logic circuits and processors need a 6 volt power supply. %ven connecting a led through a resistor is not advisable in case of 756'.e IR)C&. :y varying the mixing ratio SJT.g. $his type of regulation is ideal for having a simple variable bench power supply. i. 6) or '3). 0%. . REG&LATED %O'ER S&%%LY A variable regulated power supply. also called a variable bench power supply.ixed crystals of .<756 voltage regulator I! @Integrated !ircuitA. $his way even higher currents can be used. Actually this is uite important because one of the first pro/ects a hobbyist should undertake is the construction of a variable regulated power supply. is one where you can continuously ad/ust the output voltage to your re uirements. -sually you start with an unregulated power $o make a 6 volt power supply. itKs much handier to have a variable supply on hand.DENSITY BASED TRAFFIC CONTROL SYSTEM . especially for testing.aAs are used.
output current capability of '55 mA • • !ircuit protectionN :uilt-in overheating protection shuts down output when regulator I! gets too hot !ircuit complexityN )ery simple and easy to build !ircuit performanceN )ery stable M6) output voltage. reliable operation Availability of componentsN %asy to get.!A to the Input pin.ives out well regulated M6) output.DENSITY BASED TRAFFIC CONTROL SYSTEM $he 0. you get a 6 volt supply from the (utput pin. Dou simply connect the positive lead of your unregulated .<756 is simple to use. connect the negative lead to the !ommon pin and then when you turn on the power. CIRC&IT FEAT&RES :rief description of operationN .! to 32).! power supply @anything from 8). uses only very common basic components • • • .
DENSITY BASED TRAFFIC CONTROL SYSTEM • .AM%LE CIRC&IT DIAGRAM$ .! 7-'7) power supply #ower supply currentN +eeded output current M 6 mA !omponent costsN Few dollars for the electronics components M the input transformer cost • • • • BLOCK DIAGRAM E.esign testingN :ased on datasheet example circuit. I have used this circuit succesfully as part of many electronics pro/ects ApplicationsN #art of electronics devices. small laboratory power supply #ower supply voltageN -nreglated .
$his is often called as power-on reset. the .DENSITY BASED TRAFFIC CONTROL SYSTEM RESET $he pin 8 of the microcontroller 756' is the &%9%$ pin. Activating a power-on reset will cause all the values in the registers to be lost. the micro controller will reset and terminate all activities. -pon applying a high pulse to this pin. It will set program counter to all 51s.
Re+et val*e+ ta=le %O'ER S&%%LY #ower supply is an important part of operation of the ."0 re2i+ter+$ Re2i+ter #! . . .icrocontroller.DENSITY BASED TRAFFIC CONTROL SYSTEM reset can be given by either power-on reset circuit or by using a momentary switch.#$& A!! #9* 9# : #5-#4 Re+et val*e 51e:6 5555 5555 55 55 5< 55 FF Ta=le$0.icrocontroller operates at M6v .! and also for other I!s and displays. RESET val*e of +o)e .
esign 9ystems. product line includes affordable.DENSITY BASED TRAFFIC CONTROL SYSTEM INTROD&CTION TO ORCAD5SC3EMATIC DESIGN TOOL6 OrCAD is a software tool suite used primarily for electronic design automation. and for their simulation. such as Analog . $he software is used mainly to create electronic prints for manufacturing of printed circuit boards. by electronic design engineers and electronic technicians to manufacture electronic schematics and diagrams. $he (r!A.evices or $exas Instruments. product line is fully owned by !adence . $his database may be updated by the user by downloading packages from component manufacturers. reflecting the softwareKs originsN Oregon M !A. $he !adence (r!A. is a portmanteau. $he latest iteration has the ability to maintain a database of available integrated circuits. $he name (r!A.. high-performance #!: .
and optional analog and mixed-signal simulator. high-performance (r!A. $o stay competitive in todayKs market. and training in uiries please visit the global !adence !hannel #artner listing to find a partner in your region. product line is easily scalable with the full complement of !adenceY AllegroY #!: solutions. engineers must take a design from engineering through manufacturing with shorter design cycles and faster time to market. (r!A. #!: design suites grow with your needs and technology challenges. !adenceY (r!A.Y personal productivity tools @including !adenceY #9piceYA have a long history of addressing these demands. $he powerful. $he (r!A. .DENSITY BASED TRAFFIC CONTROL SYSTEM design tools that boost productivity for smaller design teams and individual #!: designers. $he affordable. technical support. . $o be successful. product line is supported by a worldwide network of !adence !hannel #artners. and integrated tools that work seamlessly across the entire design flow. a #!: editor. you need a set of powerful. intuitive.esigned to boost productivity for smaller design teams and individual #!: designers. tightly integrated #!: design suites include design capture. librarian tools. For sales. an autoCinteractive router.
A 13 P 2.7 .VC C VCC C 45 P 2.7.A 9 P 2.1 1 .5 .1 .0 0 1 u 0 .0.# 2 0 0 8 ) =336 1 &f 1 R 3! 1R 3! C &432 .7 ) D A 5V 4.5 P 1 .7 P 1 .7 D D D D D D D D 0 1 2 3 4 5 6 7 21 22 23 24 25 26 27 28 10 11 12 13 14 15 16 17 29 30 AL 2$ 2 1 3 AT89C 51 10" 3 GND 2 1 )PDT 2 U 25 5V 20 )PD T P P P P P P P P P P P P P P P P 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 .0 .7 $ 5V 4 7 P 0 .3 .R X D P 3 .0 0 1 u 0 .5 1 .6 .4 1 .2 P 0 .7 $ 5V 4 100 1$ 33 C V U51 2 2 C 86 C 1 3 470 2 ( 12 +C 547 2 1738 1 M C T2 10" D 35 L D 1 3 1 U 50 6 5 4 1 10$ P 2 .0 0 1 u 5V 5V 4 .TO 3 GN D VO UT 3 5V C 55 10uf C 56 1uf 1 2 JP4 4 .5 P 0 .3 D 54 D 53 L D 1 L D 2 3 8 2 D I) R 8 100 ( 3 1$ 33 U 51 2 2 C 86 C 3 470 2 1 ( 12 +C 547 2 M C T2 3 1 U 50 10$ 6 5 4 P 2 .DENSITY BASED TRAFFIC CONTROL SYSTEM C3A%TER " %RO>ECT CIRC&ITRY 5V R 47 3 .0 .4 .0 .1 2 3 7 8 R ( 3 2 6 TR T* R 1 3 R 7 D I) D I) ( 2 6 TR T* R CV 1 3 33 100 1$ U 51 2 2 C 86 C 3 470 2 1 ( 12 +C 547 2 1738 1 M C T2 330 1 3 1 U 50 6 5 4 10$ P 2 .6.TO P 3 .0 0 1 u 1 10" D35 L D 1 330 0 .2 1 .4.2 D 52 L D P 0.3 " R 4 6 LC D .3 .4 P 0 . A 0 .2 P 1 .1 C 49 C .A 15 P 3 .6.0 0 1 u 1 0 . A 0 . A 0 . A 0 .0 0 1 u 0 .6 P 1 .7 $ 5V 4 8 4 .0 0 1 u 0 .4 P 0 .1 .7$ 4 R 7 3 8 D I) 3 33 C V 100 1$ U 51 2 2 C 86 C 3 470 2 1 ( 12 +C 547 2 1738 1 10" D 35 L D M C T2 2 1 3 1 U 50 6 5 4 3 10$ P 2 .P R O G D 13 L D J7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 U 22 16 %&'16 9 8 7 6 5 4 3 2 1 U 23 T2O U T 5V T X D P 3 .6 .0 P 0 .3 P 0 .1 P 0 .0 0 1 u 1 3 JU MP R 3 3 SC3EMATIC C O N N #J A C $ U 26 1 V IN L 7 8 0 5 .2 . A 1 .4.A 8 P 2.4 .6 P 0 .3 P 1 . I N T 1 P 3.0 .2 $ 4 7 3 8 D I) 100 ( 2 6 TR T* R CV 1 3 33 C 86 C 3 470 2 1 (12 +C 547 2 1738 10" D35 L D 1 330 M C T2 1 3 1$ U 51 2 2 1 U 50 10$ 6 5 4 P 2 .R D P) N A L .7 .6 P 0 .2 .0 0 1 u 4 .5 VR1 10K 2 6 TR T* R CV 1 U 49 N 555 D 34 L D 1738 1 5 3 1 10" 5V D 35 L D 1 330 0 .3 1 .0 R X D C 48 T2O U T 27-f 5V R 57 0 5 27-f C 47 2 VR1 10K 1 R 8 U 49 N 555 D34 L D 5 3 VC C 5V R)T XTA L1 XTA L2 R )T A .5 .0 1 .0 0 1 u 0 .7$ R 49 2 .5.2.7 $ 5V 4.TXD P 3 .IN T O P 3 .1 P 0 .1 u f 0 .2 0 R55 5V 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 R -P A C $ 3 .A 12 P 2.5 P 0 .3 . A 0 .5 .3.0 0 1 u T 56 73 1 T 56 73 2 D E N S IT Y B A S E D T R A F F IC C O N T R O L ) 5> 3 A2 D 963A D & % u ? 3 ' 6#N u ? @ 3 < 1D &%2 / 3 4 ' 3 8 4 9 : .A 10 P 2. 51 1u f 0 C 50 10uf R 58 10" C 52 0 .A 11 P 2.1 u f R )T )/ 4 1 2 5V J8 3 2 1 1 D 14 1N 4001 C 54 1000uf G ND 2 12! M A X3232 15 R 1 IN R 2 IN T2IN T1IN C 1+ C 1C 2+ C 2V+ VC 46 1uf R 1O U T R 2O U T T1O U T T2O U T 12 9 14 7 P 3 .4 P 1 .2 .V P P GND R 56 U 24 0 .2 . #M 9 <% = #0 5 .1 u f 13 8 10 11 1 3 4 5 2 6 C 53 0 .0 8 5V ( 2 6 TR T* R 1 5V 4 7 8 2 VR1 10K 1 D I) R 8 100 ( 3 1$ 33 U 51 2 2 C 86 C 3 470 2 1 ( 12 +C 547 2 M C T2 3 1 U 50 10$ 6 5 4 P 2 .1.5 . A 0 ./ R P 3 .0 0 1 u 1 0 .4 .1 P 1 .4 5V 5V GN D 100'f P 0 .7 R 50 R 51 R 52 R 53 300 300 300 300 P 0 .7 .3 " R 5 4 2 1 5V R 48 2 3 4 5 6 7 8 9 P 0 . T 1 P 3.2 U 49 N 555 D 34 L D 5 3 VR1 10K 1 2 6 TR T* R CV 1 1 330 U49 N 555 D34 L D 1738 1 5 3 0 .4 P 0 .1 .3 8 2 VR1 10K 1 VR1 10K U 49 N 555 D 34 L D 5 8 3 U 49 N 555 D 34 L D 5 3 1 10" D 35 L D 330 0 .0 LC D .7 40 U 21 3 3 3 3 3 3 3 3 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 19 18 9 31 P P P P P P P P P P P P P P P P 0 .6 ) C L . A 0 .VC C C 43 10uf C44 10'f 3 POT 1 P 0 .3 .1 .6 1 .A 14 P 2.0 P 1 .
As micro controller works on the program inside the memory.icro controller section contains only micro controller A$78963 and a crystal of ''.!. #ower to the I! supplied is M6v . $he !ircuit shows the complete diagram of the .. As the controller keeps all the memory and IC( ports inside it. As a program generates the login therefore it does not re uire any logic circuits."z for oscillator. and . it contains very less components in its outer configuration. regulated power supply section. power supply section.DENSITY BASED TRAFFIC CONTROL SYSTEM SC3EMATIC DESCRI%TION *e can break the pro/ect into three parts like micro controller section.ensity based traffic control system .! .5683 .
icrocontroller operates at M6v . .DENSITY BASED TRAFFIC CONTROL SYSTEM $he I& sensors are interfaced port 3 pins of microcontroller and 0%. .1s to the port 5 pins of microcontroller .! and also for other I!s and displays.lcd connected to the remaining port pins of microcontroller #ower supply is an important part of operation of the .icrocontroller.
DENSITY BASED TRAFFIC CONTROL SYSTEM C3A%TER ? SDCC COM%ILATION TOOL .
. optimizing A+9I .!! is a retargettable. 9.+. *ork is in progress on supporting the Microchip PIC16 and PIC18 series.! compiler that targets the Intel 8051.DENSITY BASED TRAFFIC CONTROL SYSTEM SMALL DE(ICE C COM%ILER 9. . Zilog Z80 and the Motorola 68HC08 based . distributed under . Maxim 80DS390.!-s.eneral #ublic 0icense @.!! is Free (pen 9ource 9oftware.#0A.
a good selection of automated regression tests. using the current version of .!. • • • • • • • • 9.:.anielKs s6' simulator.#0 license.specific language extensions. !trength re&"ction o' in&"ction %aria le! an& loop re%er!ing (. &ea& co&e elimination an& *"mp ta le! 'or +!. . 9. the ability to report on the complexity of a function to help decide what should be re-written in assembler. the ability to add inline assembler code anywhere in a function. the code was moved to 9ourceForge where all the Gusers turned developersG can access the same source tree.ecember '888. including a global register allocator.DENSITY BASED TRAFFIC CONTROL SYSTEM F%A$-&%9 • • A9JJJJ and A90I+=. adaptable . extensive .!. loop optimi#ation! $loop in%ariant. con!tant 'ol&ing and propagation.specific optimizations. As of .specific backend that should be well suited for other 7 bit . a host of standard optimizations such as glo al !" expre!!ion elimination. retargettable assembler and linker. allowing effective use of the underlying hardware.utta and released under a . int @16 bits.!-s independent rule based peep hole optimizer. long @3.!. 2 bytesA and float @/ byte I%%%A. 3 bytesA.!. cop) propagation. short @16 bits. 9ince its initial release there have been numerous bug fixes and improvements. ' byteA. a Freeware. a full range of data typesN char @8 bits.!! was written by 9andeep . 9.!! also comes with the !o"rce le%el &e "gger 9.itch+ !tatement!. bit.!! is constantly being updated with all the usersK and developersK input. 3 bytesA.
9nippets must compile and must include any re uired header files.DENSITY BASED TRAFFIC CONTROL SYSTEM 012 and g #80 ports are no longer maintained.icrosoft *indows .!! 9-##(&$9 F(00(*I+.ac (9 J using using gcc. 4.!!. *indows release and snapshot builds are made by cross compiling to mingw43 on a 0inux host. 9pecify the 9.x7O.!!. 9.x7O and . "ere is a short check list of tips to greatly improve your chances of obtaining a helpful response.9 0inux . or attach your . Attach the code you are compiling with 9.!! and the included support packages come with fair amounts of documentation and examples.ppc are the primary. you can find help in the places listed below. '. etc.!! compiles natively on 0inux and . 9.ac (9 x . so called Gofficially supportedG platforms. It should compile Gout of the boxG.akefile. . 9-##(&$ (F 9. 3. *hen they arenKt enough. 9pecify the exact command you use to run 9.!! 9. Incomplete information will hamper your chance of a timely response.redhat. *indows 8xC+$C3555CJ# users are recommended to use !ygwin @httpNCCsources. .!! version @type Gsdcc -vGA. #0A$F(&. your platform and operating system.icrosoft )isual !MM build scripts.comCcygwinCA or may try the unsupported :orland ! compiler or .
!!. as applicable.!! from httpNCCsdcc. $hough this will make your message lengthy.ownload 9.netC • If you are developing on a *indows platform I strongly recommend youget httpNCCprdownloads. #rovide an exact copy of any error message or incorrect output.!! developers are frustrated by bug reports without code provided that they can use to reproduce and ultimately fix the problem.etting 9tartedN .sourceforge.!! . in all re uests for support or when reporting any problems or bugs with 9.exe @orwhatever is the latest revisionA because it has an install wizard which will . so please be sure to provide sample code if you are reporting a buga -9I+.DENSITY BASED TRAFFIC CONTROL SYSTEM 2. #lease attempt to include these 2 important parts. it will greatly improve your chance that 9.5-setup.6.netCsdccCsdcc-3.!! users and developers will be able to help you. 9ome 9.sourceforge. 9.
make from httpNCCece.DENSITY BASED TRAFFIC CONTROL SYSTEM copy the files and will ask you if you want 9.emory .ownload .6.sourceforge. G If you are developing on *indows J#N X &ight click on S. so make sure you are using rev 3.!! to your pathaA • $he most up-to-date documentation is at httpNCCsdcc.eduCbmcclurelCmake.!!.5 and rev3.htmlUindex. . X Add the location of make.htmlC.colorado.5 or newer.!! .html by default.exe to the S)ariable )alueT G If you are developing on another version of *indows you will need to investigate further because the %nvironment variables maynot be in the same location.!! added to your path@"I+$N I recommend you add 9.!!UdocUsdccman. o Dou can add make to your path as well. For example. 9.2.4. • 9tudents have reported experiencing problems with rev 3. (therwise click S+ewT and create a #A$" variable.+.5 of 9. 9.odels .!! also comes with anolder revision of the same documentation which is installed in !NU#rogram FilesU9.y !omputerT X 9elect the SAdvancedT tab X !lick on S%nvironment )ariablesT X 9elect S#A$"T and S%ditT if it already exists.netCdocCsdccman. in *indows +$ look in 9tartC9ettingsC!ontrol #anelC9ystem and select the %nvironment tab to modify the #A$" variable.exe.
I think it is safer to use the large memory model. by . by default G )ariables stored in external &A. regardless of the memory model you choose. if you do not explicitly declare a pointer as dataCnear or xdataCfar it will be 4 bytesa 9. "owever. must be declared with the SxdataT or SfarT keyword a 9.%FA-0$ G )ariables stored in internal &A. you can use the following syntax for your header filesN Vinclude cstdio.!! recommends the use of the small memory model for more efficient code.!! is defined in your path. for this class. a :e aware that.!! basically has two memory modelsN 9mall and 0arge • $he large memory model will allocate all variables in external &A. directlyaddressable &A. since we are using combined program and data memory spaces.DENSITY BASED TRAFFIC CONTROL SYSTEM 9.hd .!! :asics Assuming that the location of 9. must be declared with the SdataT or SnearT keyword • $he small memory model will allocate all variables in internal.
sym B 9ymbol listing created by the assembler file. a .rst B Assembler listing file updated by the linkage editor file. Dou must remember to use the --code-loc and --xram-loc directives because this tells the linker where to place things in memorya Dou can examine the file.!! will generate the following output filesN file.asm B Assembler file created by the compiler file.rst and file.emory map for the load module created by the linker file.mem B 9ummary of the memory usage file.lst B Assembler listing file created by the assembler file.area directives instead of(&. use a command line syntax similar to the following @noteN a more complete list of flags is shown in the example makefile laterAN sdcc --code-loc 5xO555 --xram-loc 5x:555 file.c 9.rel B (b/ect file created by the assembler.map B .DENSITY BASED TRAFFIC CONTROL SYSTEM $o use 9.!! uses the small memory model $he assembler is given the memory locations as .!! on the command line. statements. Input to the linkage editor file.map output files to verify that your code and data are assigned to the correct location.ihx B $his is the load module in Intel hex format :y default 9.
etcWA "oweverN G printf depends on putchar@A which is not implemented. X Dou must implement putchar@A X $his allows you to decide where printf is displayed @on a terminal via serial port.DENSITY BASED TRAFFIC CONTROL SYSTEM 9.!! does notautomatically create heap space for your program.%..%& . on an 0!.ost standard routines are present @printf. X Dou must provide heap space for malloc to allocate memory from."%A. etcWA X $he putchar@A function must have the following formatN void putchar@char cA? X If you need a getchar@A function.!! standard library routines . malloc.hd Vdefine "%A#e9I>% 2555 unsigned char xdata heapE"%A#e9I>%F? void main@A f initedynamicememory@@. X $his can be done byN Vinclude cmalloc. the format isN char getchar@A? malloc depends on having heap space created but 9.
DENSITY BASED TRAFFIC CONTROL SYSTEM xdata gAheap.!! takes a conservative view and will save registers on the stack before executing any of your code in the I9& and it will restore those registers before executing the &%$I instruction. G Dou can use the keyword SenakedT to make your interrupt faster. X *A&+I+. $his keyword will prevent 9.!! to generate a &%$I instruction instead of a &%$instruction to return from a call to isrefoo@A. "%A#e9I>%A? h 9. 9.! I+$%&&-#$ 9-##(&$ $o write an I9& in !. G It also tells 9.!! to generate an interrupt vector @at offset5x5: from the --code-loc addressA that calls isrefoo in response tointerrupt '. X I would only recommend using the enaked keyword if your I9& only contains inline assembly in which case you know explicitly which registers are used or you are setting a . o $he standard code generated for the interrupt is not very efficient.N If you use the enaked keyword you must save and restore any registers that are modified by your I9& or you must guarantee that no registers are used by your I9&.!! from generating any entryCexit code to save registers for your I9&. create a function similar to the following formatN void isrefoo@A interrupt ' f h G $his format tells 9.
In non-I9& routines you must be aware of the calling convention used and saveCrestore the registers you used within your function as appropriate. . X Dou can use the enaked keyword on any function. a 9.DENSITY BASED TRAFFIC CONTROL SYSTEM single bit @such as a port pinA in which case no registers are used.!! serial port initialization o $here is no support routine built into 9. you will have to initialize the hardware first. not /ust for I9&s.!! to initialize the serial port o If you want to use the serial port with your ! program that you burn into%#&(.
DENSITY BASED TRAFFIC CONTROL SYSTEM C3A%TER ? FLAS3 MAGIC .
It utilises a feature of the microcontrollers called I9#.DENSITY BASED TRAFFIC CONTROL SYSTEM FLAS3 MAGIC Flash . control over &9343 signals to place devices into I9# mode. Additional advanced features of Flash .A flash microcontrollers from +J#.agic can erase devices.agic is a #! tool for programming flash based microcontrollers from +J# using a serial protocol while in the target hardware Flash . so Flash magic implements methods to protect this code from being erased. 'O-bit @JAA and 43-bit @A&.agic include the automatic programming of checksums. Flash .agic has been available for free for over six years and supports all current 7-bit @756'A. blocks. For example. . entering I9# mode via a serial command. the hex file to be programmed or the entire device.agic adds additional features and intelligence. execution of Iust In $ime modules allowing endless flexibility in the data programmed. Flash . and control over the timing of such signals. allowing complex operations to be performed. program them. Flash . read data and read and set various configuration information. which allows the transfer of data serially between a #! and the device.agic is a feature-rich *indows based tool for the downloading of code into +J# flash microcontrollers. &ather than providing the basic features of I9#. erasing can be any collection of pages pages. 9ome devices store the I9# bootloader in flash memory.
Adverts for new products could be displayed to the user.ain window .00 will automatically add new devices • • • . for example production line programming where it is essential the user interface is simplified as much as possible %nd user I9# tool for updating the firmware of products.agic . Invoke multiple instances of the Flash . 9creenshots .ang programming tool. -se one tool for all your products involving potentially multiple +J# microcontrollers.agic platformN • !ustom I9# tool for in-house use.00 in seperate threads. Dou can build the hex file into the application or allow it to be fetched over the internet. port to allow parallel I9# programming Future-proofing products. &ather than write your own I9# tool and have to keep updating it for new +J# devices. each using a different !(.DENSITY BASED TRAFFIC CONTROL SYSTEM 7 %o++i=le &+e+ 9ome ideas for applications built on the Flash . . updates to the .
isplay flash memory . or Flash @0#!3xxxA .evice signature 9tart bootloader .DENSITY BASED TRAFFIC CONTROL SYSTEM "ex file information %xecute from &A.
eature" • 9traightforward and intuitive user interface • Five simple steps to erasing and programming a device and setting any options desired #rograms Intel "ex Files Automatic verifying after programming Fills unused Flash to increase firmware security • • • .timeouts Advanced options B hardware %xecuting a script .DENSITY BASED TRAFFIC CONTROL SYSTEM :lank check Advanced options .
isplay the contents of Flash in A9!II and "exadecimal formats 9ingle-click access to the manual.anual in #. ensuring no unauthorized or corrupted code can ever be executed #rogram security bits !heck which Flash blocks are blank or in use with the ability to easily erase all blocks in use &ead the device signature &ead any section of Flash and save as an Intel "ex File &eprogram the :oot )ector and 9tatus :yte with the help of confirmation features that prevent accidentally programming incorrect values .%s and :atch Files . • • • • • • • • • • • • • • • .$& and &$9 &9343 signals when connected to &9$ and C#9%+ to place the device into :oot&(. %ssential for I9# with target hardware that is hard to access.agic to be used in I.agic calculates the highest baudrate that both the device and your #! can use and switches to that baudrate transparently !ommand 0ine interface allowing Flash .agic home page and +J# . Flash . An example circuit diagram is included in the . -sing the supplied checksum calculation routine your firmware can easily verify the integrity of a Flash block.anual.icrocontrollers home page Ability to use high-speed serial communications on devices that support it. and %xecute modes automatically. Flash .DENSITY BASED TRAFFIC CONTROL SYSTEM • Ability to automatically program checksums. or higherA Able to control the .F format 9upports half-duplex communications )erify "ex Files previously programmed 9ave and open settings Able to reset &x3 and OOx devices @revision .
including the creation and modification dates. $he installation includes an example pro/ect for the =eil and &aisonance 756' compilers that show how to build support for this feature into applications. utilities and code examples.manufacture date 9toring program operator and location 0ookup table generation 0anguage tables or language selection !entralized record keeping (btaining latest firmware from the !orporate *eb site or pro/ect intranet • • 9ponsored by +J# 9emiconductors Features automatically updating Internet links including links to related technical documents. using %mbedded"ints technology . #owerful. :uilt in automated version checker . Able to play any *ave file when finished programming. flexible Iust In $ime !ode feature.DENSITY BASED TRAFFIC CONTROL SYSTEM • Able to send commands to place the device in :oot&(. -ses includeN o o o o o o o o • • • 9erial number generation !opy protection and copy authorization 9toring program date and time . software updates. mode. with support for command line interfaces.helps ensure you always have the latest version.odules to generate last minute code for programming. percentage of the current device used !ompletely freea • • . *rite your own II$ .isplays information about the selected "ex File. flash memory used.
'5. except *indows 86.b of disk space is re uired .DENSITY BASED TRAFFIC CONTROL SYSTEM • Flash .agic works on any versions of *indows.
DENSITY BASED TRAFFIC CONTROL SYSTEM 9chematic .
DENSITY BASED TRAFFIC CONTROL SYSTEM .