CHAPTER 1 INTRODUCTION

Visitor counter is simply a measurement of the visitor traffic entering and exiting offices, malls, sports venue etceteras. Counting the visitors help to maximise the efficiency and effectiveness of employees, floor area and sales potential of an organisation. Visitor counter is not limited to the entry/exit point of accompany but has a wide range of applications that provide information to management on the volume and flow of people throughout a location. A primary method for counting the visitors involves hiring human auditors to stand and manually tally the number of visitors who pass by a certain location ,but human-based data collection comes at great expense. Here is a low cost microcontroller based visitor counter that can be used to know the number of persons at a place. Two IR transmitter-receiver pairs are used at the passage, each pair consisting of IR transmitter and photo-transistor installed at entry and exit point. In today¶s world there is a continuous need for automatic appliances with the increase in standard of living , there is a sense of urgency for developing circuits which would ease te complexity of life. Also if at all one wants to know the number of people present in room so as not to have congestion. This circuit proves to be useful.

1.1 PROJECT OVERVIEW
This Project ³microcontroller based Visitor Counter´ using Microcontroller is a reliable circuit that takes over the task counting number of persons/ visitors in the room very accurately. When somebody enters into the room then the counter is incremented by one and when any one leaves the room then the counter is decremented by one. The total number of persons inside the room is also displayed on the seven segment displays. The microcontroller does the above job. It receives the signals from the sensors, and this signal is operated under the control of software which is stored in ROM. Microcontroller AT89S52 continuously monitor the Infrared Receivers, When any object pass through the IR Receiver's then the IR Rays falling on the receiver are obstructed , this obstruction is sensed by the Microcontroller.

1

CHAPTER 2 BLOCK DIAGRAM
DESCRIPTION The basic block diagram of the bidirectional visitor counter with automatic light controller is shown in the figure 1.. Block diagram consist of the following essential blocks. 1. Power supply. 2. Enter and exit sensor circuits. 3. AT89S52 microcontroller. 4. Seven segment display.

2.1 Power Supply:We are using +5 V DC power supply. This is obtained by using a 7805 voltage regulator IC ,whch converts the 12 V dc supply into 5 V supply. 12 V is obtained by using a stepdown transformer.

2.2 Enter and exit sensor:This is the main part of the project the main intension of this block is to sense the person. To sense the person, we are using IR pair sensor circuit. By using this sensor and its related circuit we can count the number of persons.

2.3 AT89S52 microcontroller
The AT89S52 is a low-power ,high performance CMOS 8-bit microcontroller with 8K bytes of in system programmable flash memory. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer. By combining a versatile 8-bit CPU within system programmable Flash on a monolithic chip, the ATMEL 89S52 is a powerful microcontroller which provides a highly- flexible and cost-effective solution to many embedded control applications.

2

2.4 Seven segment display
We are using the LTS543 seven segment display which is common cathode configuration for displaying the count. We are using three seven segments display, so we can count upto 999 persons. ENTER Enter Sensor Signal conditioning A T 8 9 Exit Sensor Signal conditioning S 5 2 EXIT

Power supply

Seven segment display

Fig 1.Block Diagram Of Microcontroller Based Visitor Counter

3

4 . The AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. Power range : 4 V. Full duplex UART serial channel. Endurances : 1000 writes/erase cycles[1].1 FEATURES OF AT89S52 MICROCONTROLLER Following are the important features of the AT89S52 microcontroller.5. serial port and interrupt system to continue functioning.1. disabling all other chip functions until the next interrupt or hardware reset. the ATMEL 89S52 is a powerful microcontroller which provides a highly. 32 Programmable I/O lines. By combining a versatile 8-bit CPU within system programmable Flash on a monolithic chip. Interrupt recovery from power down modes. The power-down mode saves the RAM contents but freezes the oscillator. Three level program memory lock. 3.flexible and costeffective solution to many embedded control applications[1]. Fully static operation: 0Hz to 33 MHz.1 MICROCONTROLLER The AT89S52 is a low-power. timer/counters. They are as follows:y y y y y y y y y y y y y y 8 KB Reprogrammable flash. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer.CHAPTER 3 COMPONENTS USED Followings are the important electronic components used in the project ³microcontroller based visitor counter´. The idle mode stop the CPU while allowing the RAM. Pwer off Flag. 3 16-bit Timer/Counter. high performance CMOS 8-bit microcontroller with 8K bytes of in system programmable flash memory. 8 Interrupt sources. 3. Dual data pointer. 256 KB internal RAM[1].5 V. Low power idle and power down modes.

As an output port.ground.supply voltage. The following figure shows the pin-diagram of it. pin diagram of AT89S52[2].1. PIN DESCRIPTION: 1. When 1s are written to Port 1 pins. each pin can sink eight TTL inputs. 2. 3. P0 has internal pull-ups. the pins can be used as high-impedance inputs. they are pulled high by the inter-nal pull-ups and can be used as inputs. 4. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. GND. As inputs. In this mode. PORT 0Port 0 is an 8-bit open drain bidirectional I/O port. The Port 1 output buffers can sink/source four TTL inputs.3. Port 0 also receives the code bytes during Flash programming and outputs the code bytes dur-ing program verification. PORT 1Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. Fig 2. External pullups are required during program verification. Port 1 pins 5 . When 1s are written to port 0 pins.2 PIN DIAGRAM OF AT89S52 AT89S52 is a 40 pin microcontroller. Vcc.

ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes.0 and P1. the RESET HIGH out feature is enabled. Port 2 emits the contents of the P2 Special Function Register. however. Note. 6 . Port 2 emits the high-order address byte during fetches from external program memory and dur-ing accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). Port 1 also receives the low-order address bytes during Flash programming and verification.1 can be configured to be the timer/counter 2 external count input (P1. As inputs. PSEN is activated twice each machine cycle. This pin is also the program pulse input (PROG) during Flash programming. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. 9. When 1s are written to Port 2 pins. The Port 2 output buffers can sink/source four TTL inputs. 8. During accesses to external data memory that use 8-bit addresses (MOVX @ RI). When the AT89S52 is executing code from external program memory. Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. 5. When 1s are written to Port 3 pins. The Port 3 output buffers can sink/source four TTL inputs. In addition. PORT 2Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. 6. Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. In normal operation. as shown in the follow-ing table. ALE/PROGAddress Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin drives high for 98 oscillator periods after the Watchdog times out.1/T2EX). As inputs.0/T2) and the timer/counter 2 trigger input (P1. RST. they are pulled high by the inter-nal pull-ups and can be used as inputs. A high on this pin for two machine cycles while the oscillator is running resets the device. respectively.that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 also receives the high-order address bits and some control signals during Flash program-ming and verification. 10. EA/VPPExternal Access Enable. In this application. 7. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. PSENProgram Store Enable (PSEN) is the read strobe to external program memory. In the default state of bit DISRTO.Reset input. that one ALE pulse is skipped dur-ing each access to external data memory. PORT 3Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. Port 3 receives some control signals for Flash programming and verification. except that two PSEN activations are skipped during each access to external data memory. they are pulled high by the inter-nal pull-ups and can be used as inputs. P1. Port 2 uses strong internal pull-ups when emitting 1s.

12. EA should be strapped to VCC for internal program executions. XTAL 1Input to the inverting oscillator amplifier and input to the internal clock operating circuit. 11. 7 .Note. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. that if lock bit 1 is programmed. EA will be internally latched on reset. however. XTAL 2Output from the inverting oscillator amplifier.

8 .Fig 3. block diagram of AT89S52 microcontroller[2].

Following diagram shows the pin diagram of LM324 IC. Four internally compensated op-amps in a single package. Operation from split power supplies is also possible and the low power supply current drain is independent of the magnitude of the power supply voltage. Power drain suitable for battery operation. Allows directly sensing near GND and VOUT also goes toGND. Fig 4 pin diagram of LM324[3] 9 . ADVANTAGES: y y y y y Eliminates need for dual supplies. DC gain blocks and all the conventional op-amp circuits which now can be more easily implemented in single power supply systems. Compatible with all forms of logic.2 LM 324 IC It consists of four independent . 3. Application areas include transducer amplifiers. high-gain internally frequency compensated operational amplifiers which were designed specifically to operate from a single power supply over a wide range of voltages.3.1 PIN DIAGRAM LM324 is a 14 pin IC.2.

PIN description pin. Low input offset voltage of 2 mV. 10 .2. Low input biasing current of 45 nA . Very low supply drain current (700 µA) essentially independent of supply voltage.5 V(upto 32 V) Non-inverting input of second comparator Inverting input of seond comparator Output of second comparator Output of third comparator Inverting input of third comparator Non-inverting input of third comparator Ground 0V Non-inverting input of fourth comparator Inverting input of fourth comparator Output of fourth comparator 3. Wide power supply range varies from 3V to 32 V.no 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Name of the pin Output 1 Input 1Input 1+ Vcc Input 2+ Input 2Output 2 Output 3 Input 3Input 3 + GND Input 4+ Input 4Output 4 Function of the pin Output of first comparator Inverting input of first comparator Non-inverting input of first comparator Supply voltage. Large DC voltage gain of 100dB.2 FEATURES Following are the important features of the LM324 IC y y y y y y y y Internally frequency compensated for unity gain. Low input offset current of 5 nA. Wide bandwidth (unity gain ) of 1MHz.

It has 16 pins. Fig 5 pin diagram of 74LS76[3] 11 . 3. On the negative transition of the clock. The J and K data is processed by the flip-flop after a complete clock pulse.3. The data is transferred to the outputs on the falling edge of the clock pulse. the data from the J and K inputs is transferred to master while the clock is high.3. The logic state of J and K inputs must not be allowed to change while the clock is high. This device contains two independent positive pulse triggered J-K flip-flop with complementary outputs. On the positive transition of the clock.1 Pin diagram Following diagram discusses the pin-diagram of the 74LS76 IC. A low logic level on the preset or clear inputs will set or reset the outputs regardless of the logic levels of other inputs. the J and K inputs are disabled. While the clock is low the slave is isolated from the master.3 IC 74LS76 This is a dual master slave J-K flip flop IC. the data from the master is transferred to the slave.

2 Function table the J-K flip flop Where. L= Low logic level. Low operating voltage range. 3. Outputs directly interface to CMOS.3. Q0= the output logic level before the indicated input conditions were established. Low input current.NMOS and TTL.3 Features y y y y y y y Output drive capability 10 LSTTL loads. H= high logic level.3. 12 . Toggle = each output changes to the complementof its previous level on each complete active high level clock pulse.3. Input voltage. High noise immunity. X= either low or high logic level.5 V Operating free air temperature ± 0 0 c to + 70 0 c.

and has a red face and red segment.Pin description Pin number 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Name Clock 1 input Preset 1 input Clear 1 input J 1 input Vcc Clock 2 input Preset 2 input Clear 2 input J 2 input Complement Q 2 output Q 2 output K 2 input Ground Complement Q 1 output Q 1 output K 1 input 3. 3.1 Features 13 . these displays are ideal for most applications. The low current displays are ideal for portable applications.52 inch digit height single digit seven-segment display.4. They are designed for viewing distances up to 7 m. Pin for pin equivalent displays are also available in low current design. This device utilizes high efficiency red LED chips . which are made from GaAsP on GaP substrate .4 LTS 543 SEVEN SEGMENT DISPLAY Fig 6 seven segment display The LTS 543 is a 0.

52 inch digit height. y y y y y y Common cathode configuration. Wide viewing angle.Following are the important features of the LTS543 seven segment display. 0. Excellent characters appearance. High brightness and high contrast. Low power requirements. 14 .

Seven segment display truth table 15 .

making it essentially indestructible. 18. 6. they can deliver over 1A output current[4].5.3. thermal shut down and safe operating area protection. these devices can be used with external components to obtain adjustable voltages and currents. Fig 7 LM7805 regulator IC 16 . 10.5 LM7805 VOLTAGE REGULATOR LM7805 (MC78XX/LM78XX/MC78XXA 3-Terminal 1A Positive Voltage Regulator) 3. 8. 12.1 Features ‡ Output Current up to 1A ‡ Output Voltages of 5. Although designed primarily as fixed voltage regulators. 9. 24V ‡ Thermal Overload Protection ‡ Short Circuit Protection ‡ Output Transistor Safe Operating Area Protection Description The MC78XX/LM78XX/MC78XXA series of three terminal positive regulators are available in the TO-220/D-PAK package and with several fixed output voltages. 15. Each type employs internal current limiting. making them useful in a wide range of applications. If adequate heat sinking is provided.

Internal Block Digram:- Fig 8 block diagram of 7805[4]. Absolute Maximum Ratings. 17 .

Variable Resistors Fig 10 variable resistor Variable resistors are also common components. Resistors are used to control voltages and currents.) A low resistance allows a large amount of current to flow. Volume controls are variable resistors. This is very useful for many situations. This keeps the wires from coming in contact with other wires and creating short circuits. Current almost never flows through air. They have a dial or a knob that allows you to change the resistance. High voltage power lines are covered with thick layers of plastic to make them safe. Each resistor is marked with colored stripes to indicate its resistance.6 Resistors Fig 9 different types of resistors Resistors are components that have a predetermined resistance. Resistance determines how much current will flow through a component. Air has very high resistance. The light is created as the current burns parts of the air. (Sparks and lightning are brief displays of current flow through air.3. but they become very dangerous when the line breaks and the wire is exposed and is no longer separated from other things by insulation. (Ohms are named after Mho Ohms who played with electricity as a young boy in Germany. Resistance is given in units of ohms. A very high resistance allows very little current to flow.) Common resistor values are from 100 ohms to 100. Metals have very low resistance. They allow current to flow from one point to another point without any resistance. 18 .000 ohms. When you change the volume you are changing the resistance which changes the current. That is why wires are made of metal. Making the resistance higher will let less current flow so the volume goes down. Wires are usually covered with rubber or plastic.

19 . a 500 ohm variable resistor can have a resistance of anywhere between 0 ohms and 500 ohms. A variable resistor may also be called a potentiometer.Making the resistance lower will let more current flow so the volume goes up. When the switch is OFF there is no connection. For a light switch.8 Switches Switches are devices that create a short circuit or an open circuit depending on the position of the switch. If your circuit is running low. 3. 3. think of this as a water tank with water always flowing in. that means there is an open circuit (no current flows. lights go out. assume the longer lead must always connect to positive. some capacitors are polarized. If a capacitor has a lead that is longer than the other. ON means short circuit (current flows through the switch. meaning current can only flow one direction through them. For example.When the switch is ON it looks and acts like a wire. Quick note. they can also be used for timing circuits. Now why would you? Well radio signals require very fast current changes. but with drainage valves opening and closing. Fig 12 electrolytic capacitor Capacitors are like electron storage banks. Since capacitors take time to charge. and lights light up. In our water analogy. Robot motors cause current fluctuations in your circuit which you need to control. Timing circuits can be used to generate signals such as PWM or be used to turn on/off motors in solar powered BEAM robots. The value of a variable resistor is given as its highest resistance value.) When the switch is OFF.7 Capacitors Fig 11 capacitor symbol Now suppose you want to control how the current in your circuit changes (or not changes) over time. it will deliver electrons to your circuit. and time to discharge. What do you do when batteries cannot supply current as fast as you circuit drains them? How do you prevent sudden current spikes that could fry your robot circuitry? The solution to this is capacitors.

transistors are almost the only components used to build a Pentium processor. Most bipolar transistors used today are NPN. then no current can flow from the Collector to the Emitter. NPN transistors consist of a layer of P-doped semiconductor (the "base") between two N-doped layers. If a current is flowing to the Base.) If there is no current flowing to the Base. the Collector (C). and the Emitter leg is on the right. the Base leg is in the middle.5 million transistors. they are the most important electrical component. They are just simple switches that we can use to turn things on and off. because electron mobility is higher than hole mobility in semiconductors. Transistors always have one round side and one flat side. 20 . allowing greater currents and faster operation. The arrow in the NPN transistor symbol is on the emitter leg and points in the direction of the conventional current flow when the device is in forward active mode. an NPN transistor is "on" when its base is pulled high relative to the emitter. If the round side is facing you. in which the letters "N" and "P" refer to the majority charge carriers inside the different regions of the transistor. Even though they are simple. In other terms. A small current entering the base in common-emitter mode is amplified in the collector output. A single Pentium chip has about 3. For example. the Collector leg is on the left. (The Switch is off. Sometimes they are labeled on the flat side of the transistor. Transistors that we will use in projects look like this: Fig 13 transistor The transistor has three legs.3. there will be a path from the Collector (C) to the Emitter (E) where current can flow (The Switch is On. and Emitter (E).9 The Transistor Transistors are basic components in all of today's electronics. Base (B). Basic Circuit The Base (B) is the On/Off switch for the transistor. The ones in the Pentium are smaller than the ones we will use but they work the same way.) Transistor ± BC 547 The BC547 transistor is an NPN bipolar transistor.

BC547 is used in common emitter configuration for amplifiers. Its equivalent transistors are BC548 and BC549. the emitter base junction is forward biased and the base collector junction is reverse biased. 21 ." An NPN transistor can be considered as two diodes with a shared anode region.One mnemonic device for identifying the symbol for the NPN transistor is "not pointing in. when a positive voltage is applied to the base emitter junction. allowing thermally excited electrons to inject into the base region. The electrons in the base are called minority carriers because the base is doped p-type which would make holes the majority carrier in the base. Features      BC547 is an NPN bi-polar junction transistor. BC547 is mainly used for amplification and switching purposes. the equilibrium between thermally generated carriers and the repelling electric field of the depletion region becomes unbalanced. for example. In typical operation. These electrons wander (or "diffuse") through the base from the region of high concentration near the emitter towards the region of low concentration near the collector. It has a maximum current gain of 800. In an NPN transistor.

the greater the intensity of IR light hitting IR receiver. IR receiver can be imagined as a transistor with its base current determined by the intensity of IR light received.10 IR SENSOR Fig 14 IR sensor [6] The basic principle of IR sensor is based on an IR emitter and an IR receiver. IR emitter will emit infrared continuously when power is supplied to it. This change of resistance will further change the voltage at the output of voltage divider. Usually the IR emitter and IR receiver will be mounted side by side. The further distance away between emitter and receiver decrease the amount of infrared light hitting the receiver if the distance between the sensor and a reflective surface is fixed. the IR receiver will be connected and perform the task of a voltage divider. and limiting current from collector to emitter. The lower the intensity of IR light cause higher resistance between collector-emitter terminals of transistor. On the other hand. pointing to a reflective surface. In others word. the lower the resistance of IR receiver and hence the output voltage of voltage divider will decreased. Fig 14 IR sensor [6] 22 .3.

Features SDP8475-201 SDP8476-201        Package style Angular response Light current (min.) Light current (max.020 in sq leads 23 .) Light current slope Mounting configuration Termination style T-1 20° 4 mA 14 mA 4 mA/mW/cm² to 14 mA/mW/cm² through-hole 0.

Electrically connections are established from one side to the other and to the layer circuitry by drilled holes. Next is to drill tooling holes. which are used to manufacture a PCB.This consists of initial preparation of a copper clad laminate ready for subsequent processing. which increase the manufacturing complexity. copper tracks are on one side of the board. two or more pieces of dielectric substrate material with circuitry formed upon them are stacked up and bonded together. These processes are as follows  Pre processing: .Flexible circuit is basically a highly flexible variant of the conventional rigid printed circuit board theme. hole plating is done.In this.In this. 4. 2) Wave soldering or vapour phase reflow soldering can mechanize component wiring and assembly. 3) Mass production can be achieved at lower cost. Thus PCB provides sufficient mechanical support and necessary electrical connections for an electronic circuit. These are simplest to manufacture thus have low production cost.In this. The printed circuit boards (PCBs) consist of an insulating substrate material with metallic circuitry photo chemically formed upon that substrate. 4) Flexible PCB: . from a copper clad base material. Advantages of printed circuit boards: 1) Circuit characteristics can be maintained without introducing variations inter circuit capacitance. 4.CHAPTER 4 PRINTED CIRCUIT BOARD The use of miniaturization and sub miniaturization in electronic equipment design has been responsible for the introduction of a new technique in inters component wiring and assembly that is popularly known as printed circuit. 4) The size of component assembly can be reduced with corresponding decrease in weight.2 PCB Manufacturing Process There are a number of different processes. and are the simplest form of PCB. Passing a board through rollers performs cleaning operation. 2) Double sided PCB:. 24 . To achieve the connections between the boards. which are subsequently plated through copper. 5) Inspection time is reduced as probability of error is eliminated. 3) Multilayered PCB: .1 Types of PCB¶s There are four major types of PCB¶s: 1) Single sided PCB: . copper tracks are provided on both sides of the substrate. which is ready for component assembly.

The different solutions used are: FeCl.  Etching: . CuCl. Photolithography: .The testing usually consists of visual inspection and continuity testing. etc.The plating is done to ensure protection of the copper tracks and establish connection between different layers of multiplayer boards.This process for PCBs involves the exposure of a photo resist material to light through a mask.The solder mask is applied by screenprinting.  Metal Plating: .Each board needs to ensure that the required connections exist.The PCB should retain its solder ability.  Drilling: . PCBs are stacked before being taken for final assembly of components .  Bare-Board Testing: . This is used for defining copper track and land patterns.Drilling is used to create the component lead holes and through holes in a PCB .The drilling can be done before or after the track areas have been defined. that there are no short circuits and holes are properly placed .  Solder Masking: . 25 .It is the process of applying organic coatings selectively to those areas where no solder wettings is needed .The etching process is performed by exposing the surface of the board to an etchant solution which dissolves away the exposed copper areas .

Fig 16: power supply circuit 26 . Fig 15: circuit diagram of bidirectional visitor counter.Chapter 5 CIRCUIT DIAGRAM AND DESCRIPTION The circuit diagram of the ³microcontroller based bidirectional visitor counter´ is shown in fig 15.

It conducts and high voltages at its emitter drives the transistor into saturation. The value of the counter increments by 1¶ when the interrupt service routine for INT0 is executed. at this moment. Port 0 pin is externally pulled ±up with 10 K ohm resistor network because it is an open drain port.5. IR beam continuously falls on phototransistor.2 Flow-chart The logic behind the microcontroller based visitor counter is explained by following flow chart. 5.1 are configured to provide set pulse to J-K flip flop respectively. when external interrupt INT1 is executed. Start Infrared signal /beam transmission Interrupt from sensor number 1 Interrupt from sensor number 2 Increment counter by 1 Decrement counter by 1 Fig 17 flow chart of the program 27 . which makes pin 3 of comparator low and finally output pin of comparator is high. the output of the corresponding J-K flip-flop is set to high again by making its set input pin low through the microcontroller. The low output of comparator provides negative trigger pulse to pin 1 of J-K flip flop . The microcontroller controls counting and displays the number of persons present inside the hall. The output of corresponding J-K flipflop is set to high again by making its input pin low through the microcontroller. Port 0. When nobody is passing through the entry/exit point.1 and 2 are configured for seven segment displays. the value of the counter decrements by 1¶ . Externally interrupts INT0 and INT1 receive the interrupt pulse whe the person interrupts the IR beam.1 Circuit working Two similar sections detect interrupt of the IR beam and generate clock pulse for the microcontroller. the high input at J¶ and K¶ pins of flip-flop toggles its output to low. Similarly.0 and 3. Port pins 3.

6. } void exit (void) interrupt 2 { i--.m. void enter(void) interrupt 0 { i++. P3_1=1. P3_0=0. P3_0=1.91.k. if(i<0) i=0. #include<AT89x52.m++).m<=1000.m<=1000. for(m=0.111}.79.h> int i=0.109.127.a[ ]={63. } void main() { IE=133.m++).125.102.Chapter 6 CODING Following program is the coding for the software of the project ´microcontroller based visitor counter ³ written in C¶ language. 28 .j. for(m=0. P3_1=0.7.l. if(i>999) i=999.

} } 29 . while(1) { j=i%10. P3_0=1. l=i/100. k=i/10. P2=a[j]. P0=a[k].TCON=5. k=k-l*10. P1=a[l]. P3_1=1. i=0.

no extra person can board as the door will close. implementation and days of toil in front of the computer. The project was finally running with a few glitches here and there which were sorted in the later versions of the firmware. ports and all other functional blocks was achieved. If two person passes simultaneously. a deeper and clearer view of the architecture . The major disadvantages is that it count only one person at a time. The project still has a few shortcomings but achieves most of the objectives. A lot of effort was put into the design. then it will not count both of them individually. I earned a lot of knowledge on micro-controller. learning is a continuous never ending process but is definitely fun. It can also have expansion of adding relay circuits to open and close the door of the hall when nobody is in the hall.Chapter 7 CONCLUSION THE ³MICROCONTROLLER BASED VISITOR COUNTER´ was finally completed. it counts only one. I must be honest and admit that there were various practical issues which one would learn only during a project. the door can remain open till the hall is completely packed the other application lie in the public transport system that the crowdness can be controlled when the system has achieved its full capacity. 30 . There¶s a lot of learning and yet not the end. this can also be used at public parking systems to avoid conjestion in the traffic. writing and debugging the code. The project can be further enhanced to let the user decide whether it can also control the lights of the hall.

PDF 3.wikipedia. www.atmel.152. pg no . Janice Gillispe Mazidi and Rolin D.´The 8051 Microcontroller and Embedded Systems using Assembly and C´. Mckinlay.com 4.EFYMAG. www. www.189. Ali Muhammad Mazidi.org/IR sensor 31 .datasheetcatalog. Pearson Prentice Hall Publication.com/January 2007/info_/id_76.com 5.com/dyn/resources/prod_documents/DOC4316.REFERENCES 1. www.datasheets4u. Fourth impression-2009 2. www. 6.