You are on page 1of 36

Microcontroller Based Digital Visitor Counter

PAGE INDEX
Topic ACKNOWLEDMENT ABSTRACT INTRODUCTION PROJECT DESCRIPTION 1.1 2 . BLOCK DIAGRAM EXPLAINATION Page No. 4 5 6 8

1 .

CIRCUIT DIAGRAM AND DESCRIPTION 2.1 2.2 2.3 CIRCUIT DIAGRAM POWER SUPPLY FLOW CHART 15 16 17 18

3. PROGRAM 4 . COMPONENTS DETAILS 4.1 4.2 4.3 4.4 4.5 4.6 CONCLUSION 5.1

RESISTOR CAPACITOR TRANSISTOR DIODES INTEGRATED CIRCUIT(IC555) INFRARED SENSORS

25 25 25 26 26 28

5 .

APPLICATIONS BIBLIOGRAPHY PROJECT PRINTOUTS

29 30 31 onwards

Page 2 of 36

Microcontroller Based Digital Visitor Counter

FIGURE INDEX
Figure 1.1 1.2 1.3 2.1 2.2 4.1 4.2 BLOCK DIAGRAM PIN Configuration Block Diagram Circuit diagram of Digital Visitor Counter Power Supply Diagram Pin diagram of IC555 Infrared Sensor Page No. 7 12 13 15 16 27 28

TABLE INDEX
Table 1.1 Pin Description of AT89C2051 Page No. 14

Page 3 of 36

Microcontroller Based Digital Visitor Counter

ACKNOWLEDGEMENT
We sincerely acknowledge with deep sense of gratitude to our project guide Prof. Mrs. Ameya Pethe for the guidance and encourage she gave us for the preparation of this project without her the project would have been difficult. We are highly obliged to Mr. Shrikant Velankar,H.O.D(Elecronics) for his noble spontaneous and timely help that carried out us throughout our endeavour and finally made a grand success. We also thank the staff of our electronics department for all the cooperation and friendly treatment given to us during project. We are also thankful to our colleagues and all those have extended the necessary help during the course of our work .

Page 4 of 36

Microcontroller Based Digital Visitor Counter

ABSTRACT

Digital visitor counter is a reliable circuit that takes over the task of counting number of Persons/ Visitors in the Room very accurately. When somebody enters into the Room then the Counter is Incremented by one. The total number of Persons inside the Room is displayed on the seven segment display module. The microcontroller does the above job it receives the signals from the sensors, and this signals operated under the control of software which is stored in ROM. This project we will create counter system for apply. The total number of object is displayed on the seven segment display. The system is fully controlled by the 16 bit microcontroller 8051 which has a 4Kbytes of ROM for the program memory.

Page 5 of 36

Microcontroller Based Digital Visitor Counter

INTRODUCTION
The proposed system is based on 8051 microcontroller which is in our syllabus.For doing this project we use some of the software like Eagle software is used for designing the PCB for this project. (Since PCB making is a big process and involves lot of machineries which are expensive, we are going to outsource this to the manufacturer.) IC8051 is one of the popular Microcontroller. It has only 20 pins and there are 15 input/output lines. The microcontroller has a program memory of 2 Kilobytes. The microcontroller continuously monitor the sensor feed and if somebody enters sensors will provide information to the data processing unit.This counter Sensor consist of 3 Section as follows: Detect Object (Sensor), Data Processing (CPU) and final section Display by LCD module: Detect Object (Sensor): Proximity sensor(infrared sensors) Data Processing (CPU): For this project we choose microcontroller 8051 Display: For final section Display by seven segment display Digital visitor counter is a reliable circuit that takes over the task of counting.Number of Persons/ Visitors in the Room very accurately. When somebody enters into the Room then the Counter is Incremented by one. The total number of Persons inside the Room is displayed on the seven segment display. The microcontroller does the above job it receives the signals from the sensors, and this signals operated under the control of software which is stored in ROM. You can reset the counter using switch.

Page 6 of 36

Microcontroller Based Digital Visitor Counter

PROJECT DESCRIPTION

Infrared Sensors
TSOP1736

Timer ICs

Micro Controller AT8C2051

Seven segment display

Figure 1.1: BLOCK DIAGRAM

Page 7 of 36

Microcontroller Based Digital Visitor Counter

1.1 BLOCK DIAGRAM EXPLANATION

INTELS 8051 Architecture

The generic 8051 architecture sports a Harvard architecture, which contains two separate buses for both program and data. So, it has two distinctive memory spaces of 64K X 8 size for both program and data. It is based on an 8 bit central processing unit with an 8 bit Accumulator and another 8 bit B register as main processing blocks. Other portions of the architecture include few 8 bit and 16 bit registers and 8 bit memory locations. Each 8051 device has some amount of data RAM built in the device for internal processing. This area is used for stack operations and temporary storage of data. This base architecture is supported with on chip peripheral functions like I/O ports, timers/counters, versatile serial communication port. So it is clear that this 8051 architecture was designed to cater many real time The following list gives the features of the 8051 architecture: Optimized 8 bit CPU for control applications. Extensive Boolean processing capabilities. 64K Program Memory address space. 64K Data Memory address space.

128 bytes of on chip Data Memory.

32 Bi directional and individually addressable I/O lines. Two 16 bit timer/counters. Full Duplex UART. 6 source / 5 vector interrupt structure with priority levels.

On chip clock oscillator.

Page 8 of 36

Microcontroller Based Digital Visitor Counter

Now you may be wondering about the nonmentioning of memory space meant for the program storage, the most important part of any embedded controller. Originally this 8051 architecture was introduced with on chip, `one time programmable' version of Program Memory of size 4K X 8. Intel delivered all these microcontrollers (8051) with user's program fused inside the device. The memory portion was mapped at the lower end of the Program Memory area. But, after getting devices, customers couldn't change anything in their program code, which was already made available inside during device fabrication.

Central Processing Unit


The CPU is the brain of the microcontrollers reading user's programs and executing the expected task as per instructions stored there in. Its primary elements are an 8 bit Arithmetic Logic Unit (ALU), Accumulator (Acc), few more 8 bit registers, B register, Stack Pointer (SP), Program Status Word (PSW) and 16 bit registers, Program Counter (PC) and Data Pointer Register (DPTR). The ALU (Acc) performs arithmetic and logic functions on 8 bit input variables. Arithmetic operations include basic addition, subtraction, multiplication and division. Logical operations are AND, OR, Exclusive OR as well as rotate, clear, complement and etc. Apart from all the above, ALU is responsible in conditional branching decisions, and provides a temporary place in data transfer operations within the device. B register is mainly used in multiply and divide operations. During execution, B register either keeps one of the two inputs or retains a portion of the result. For other instructions, it can be used as another general purpose register.

Timers/Counters
8051 has two 16 bit Timers/Counters capable of working in different modes. Each consists of a `High' byte and a `Low' byte which can be accessed under software. There is a mode control register and a control register to configure these timers/counters in number of ways. These timers can be used to measure time intervals, determine pulse widths or initiate events with one microsecond resolution upto a maximum of 65 millisecond (corresponding to 65, 536 counts). Use software to get longer delays. Working as counter, they can accumulate occurrences of external events (from DC to 500KHz) with 16 bit precision. In our project we are using 16 bit microcontroller 8051, it is the advanced 16 bit microcontroller from ATMEL, which incorporates Flash Rom, and Timer etc.

Page 9 of 36

Microcontroller Based Digital Visitor Counter

Features of 8051 microcontroller are: RAM 128 Bytes (Data memory) ROM 4Kbytes (ROM signify the on chip program space) Serial Port Using UART makes it simpler to interface for serial communication Two 16 bit Timer/ Counter Input/output Pins 4 Ports of 8 bits each on a single chip. 6 Interrupt Sources 8 bit ALU (Arithmetic Logic Unit) Harvard Memory Architecture It has 16 bit Address bus (each of RAM and ROM) and 8 bit Data bus 8051 can execute 1 million one-cycle instructions per second with a clock frequency of 12MHz. This microcontroller is also called as System on a chip because it has all the features on a single chip.

Description The AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with 2 Kbytes of Flash Programmable and erasable read only memory (PEROM). The device is manufactured using Atmels high density nonvolatile memory technology and is compatible with theindustry Standard MCS-51 instruction set and pinout. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a powerful microcomputer which provides a highly flexible and cost effective solution to many

embedded control application

Page 10 of 36

Microcontroller Based Digital Visitor Counter

Figure1.2: PIN CONFIGURATION

PIN DESCRIPTION OF 8051: The diagram above shows the 8051 pinout. The chip is a 40-pin package. Port 0 : Pins 32 to 39 make up the 8-bit I/O port 0. However, if external memory is used, these lines are used as a multiplexed address and data bus.
Page 11 of 36

Microcontroller Based Digital Visitor Counter

Port 1 : Pins 1 to 8 make up the 8-bit I/O port 1. Port 2 : Pins 21 to 28 make up the 8-bit I/O port 2. However, if external memory is used, these lines make up the high-byte of the external address (A8 to A15). Port 3 : Pins 10 to 17 make up the 8-bit I/O port 3. However, each of these eight pins also has an alternate function, as detailed in the table below. Pin P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 RST: The reset input is on pin 9. This pin is used for resetting the 8051 (ie; loading the PC with the correct startup value). EA-bar : The external access, on pin 31, is used for enabling or disabling the on-chip ROM. When tied high (5V), the 8051 executes instructions in internal ROM when executing in the lower 4K (8K for the 8052) of memory. If tied low the 8051 will always execute instructions in external memory. The 8031 and 8032 should always have pin 31 tied low as there is no internal code memory ALE : The address latch enable is on pin 30. The ALE is used for latching the low byte of the address into an external register. We will deal with this at a later date. PSEN: The program store enable is an output signal on pin 29. This signal is used for fetching instructions from external code memory. Name RXD TXD INT0-bar INT1-bar T0 T1 WR-bar RD-bar Bit Address B0H B1H B2H B3H B4H B5H B6H B7H Function Receive data for serial port Transmit data for serial port External interrupt 0 External interrupt 1 Timer/counter 0 external input Timer/counter 1 external input External data memory write strobe External data memory read strobe

Page 12 of 36

Microcontroller Based Digital Visitor Counter

BLOCK DIAGRAM OF 8051:

Figure: BLOCK DIAGRAM OF 8051

Page 13 of 36

Microcontroller Based Digital Visitor Counter

Applications of 8051 microcontroller: The 8051 has been in use in a wide number of devices, mainly because it is easy to integrate into a project or build a device around. The following are the main areas of focus: Energy Management: Efficient metering systems help in controlling energy usage in homes and industrial applications. These metering systems are made capable by incorporating microcontrollers Touch screens: A high number of microcontroller providers incorporate touch-sensing capabilities in their designs. Portable electronics such as cell phones, media players and gaming devices are examples of microcontroller-based touch screens. Automobiles: The 8051 finds wide acceptance in providing automobile solutions. They are widely used in hybrid vehicles to manage engine variants. Additionally, functions such as cruise control and anti-brake system have been made more efficient with the use of microcontrollers. Medical Devices: Portable medical devices such as blood pressure and glucose monitors use microcontrollers will to display data, thus providing higher reliability in providing medical results.

Page 14 of 36

Microcontroller Based Digital Visitor Counter

CIRCUIT DIAGRAM OF 8051:

Figure 2.1: Circuit diagram of Digital visitor counter

Page 15 of 36

Microcontroller Based Digital Visitor Counter

2.2 Power Supply


Figure 2.2. Power Supply Diagram
+12V IC1 D1 230/ 9V AC 230V AC D4 D3 D2 D(1-4)=1N4007 C1 1 LM7805 2 1000uF/25V 47uF/25V Gnd 3 C2 +5V

The microcontroller and other devices get power supply from AC to Dc adapter through 7805, 5 volts regulator. The adapter output voltage will be 12V DC unregulated. The 7805/7812 voltage regulators are used to convert 12 V to 5V/12V DC. Vital role of power supply. The adapter output voltage will be 12V DC unregulated. The 7805/7812 voltage regulators are used to convert 12 V to 5V/12V DC.

Page 16 of 36

Microcontroller Based Digital Visitor Counter

2.3. Flowchart

Page 17 of 36

Microcontroller Based Digital Visitor Counter

3.PROGRAM
$MOD52 DIS_A EQU DIS_B EQU DIS_C EQU DIS_D EQU DIS_E EQU DIS_F EQU DIS_G EQU DIS1 EQU DIS2 EQU DIS3 EQU LDR1 EQU LDR2 EQU BUZZER DSEG memory P1.5 P1.4 P1.3 P1.1 P1.2 P1.6 P1.7 P3.3 P3.4 P3.5 P3.0 P3.1 EQU P1.0 ; This is internal data ORG 00H JMP ; Reset MAIN ;Timer

ORG 000BH Interrupt0 JMP REFRESH

ORG 20H ; Bit adressable memory BITS: DS 1 UP BIT BITS.0 DWN BIT BITS.1 COUNT: DS 1 SPEED: DS 1 VALUE_1: DS 1 VALUE_2: DS 1 VALUE_3: DS 1 COUNTER: DS 1 STACK: DS 1 Stack begins here CSEG ; Code begins here

; &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&& ; MAIN PROGRAM ; &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&& MAIN: CLR BUZZER MOV SPEED,#00H MOV COUNT,#00H MOV VALUE_1,#00H MOV VALUE_2,#00H MOV VALUE_3,#00H MOV COUNTER,#00H CLR DIS1 CLR DIS2 CLR DIS3 ; MOV TMOD,#01H timer0 for scanning MOV TL0,#00H MOV TH0,#0FDH SETB ET0 SETB EA SETB TR0 AJMP ZAZA ASSA: AJMP ASAA ;enable

;---------==========---------==========---------=========--------; PROCESSOR INTERRUPT AND RESET VECTORS ;---------==========---------==========---------=========---------

Page 18 of 36

Microcontroller Based Digital Visitor Counter

ZAZA: SETB LDR1 JNB LDR1,ASSA ZX3: MOV A,#40 CLR C SUBB A,R5 JC ZX4 ; JZ AQ4 &&&&&&&&&&&&&&&&&&&&&&& INC VALUE_1 &&&&&&&&&&&&&&&&&&&&& AJMP CVC ; UP COUNTER AQ4: MOV VALUE_2,#04H ; MOV VALUE_1,#00H &&&&&&&&&&&&&&&&&&&&&&& AJMP CVC &&&&&&&&&&&&&&&&&&&&& SETB BUZZER ZX4: MOV A,#50 INC COUNTER CLR C MOV R5,COUNTER SUBB A,R5 DOIT: MOV A,#10 JC ZX5 CLR C JZ AQ5 SUBB A,R5 INC VALUE_1 JC ZX1 AJMP CVC JZ AQ1 AQ5: MOV VALUE_2,#05H INC VALUE_1 MOV VALUE_1,#00H AJMP CVC AJMP CVC AQ1: MOV VALUE_2,#01H MOV VALUE_1,#00H ZX5: MOV A,#60 AJMP CVC CLR C ZX1: MOV A,#20 SUBB A,R5 CLR C JC ZX6 SUBB A,R5 JZ AQ6 JC ZX2 INC VALUE_1 JZ AQ2 AJMP CVC INC VALUE_1 AQ6: MOV VALUE_2,#06H AJMP CVC MOV VALUE_1,#00H AQ2: MOV VALUE_2,#02H AJMP CVC MOV VALUE_1,#00H AJMP CVC ZX6: MOV A,#70 CLR C ZX2: MOV A,#30 SUBB A,R5 CLR C JC ZX7 SUBB A,R5 JZ AQ7 JC ZX3 INC VALUE_1 JZ AQ3 AJMP CVC INC VALUE_1 AJMP CVC AQ7: MOV VALUE_2,#07H AQ3: MOV VALUE_2,#03H MOV VALUE_1,#00H
Page 19 of 36

CALL DELAY SETB LDR2 JNB LDR2,$

Microcontroller Based Digital Visitor Counter

MOV VALUE_1,#00H AJMP CVC ZX7: MOV A,#80 CLR C SUBB A,R5 JC ZX8 JZ AQ8 INC VALUE_1 AJMP CVC AQ8: MOV VALUE_2,#08H MOV VALUE_1,#00H AJMP CVC ZX8: MOV A,#90 CLR C SUBB A,R5 JC ZX9 JZ AQ9 INC VALUE_1 AJMP CVC AQ9: MOV VALUE_2,#09H MOV VALUE_1,#00H AJMP CVC ZX9: MOV A,#100 CLR C SUBB A,R5 JC ZX10 JZ AQ10 INC VALUE_1 AJMP CVC AQ10: MOV VALUE_3,#01H MOV VALUE_2,#00H MOV VALUE_1,#00H AJMP CVC ZX10: MOV A,COUNTER CLR C SUBB A,#100 JZ AQQ1 JC ZXX1 MOV R5,A AJMP DOIT AQQ1: MOV VALUE_3,#02H MOV VALUE_2,#00H

AJMP CVC ZXX1: MOV VALUE_1,#00H MOV VALUE_2,#00H MOV VALUE_3,#00H CVC: ; &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&& CALL DELAY CLR BUZZER JB LDR2,$ AJMP ZAZA ZAZAA: JMP ZAZA ASAA:SETB LDR2 JNB LDR2,ZAZAA CALL DELAY SETB LDR1 JNB LDR1,$ ; &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&& ; DOWN COUNTER ; &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&& SETB BUZZER DEC COUNTER MOV R5,COUNTER MOV A,R5 INC A CJNE A,#00H,DOIT1 MOV VALUE_1,#00H MOV VALUE_2,#00H MOV VALUE_3,#00H MOV COUNTER,#00H AJMP CVCV DOIT1: MOV A,#10 CLR C SUBB A,R5 JC AZX1 JZ AAQ1
Page 20 of 36

Microcontroller Based Digital Visitor Counter

MOV VALUE_1,#00H AJMP CVC GHG: DEC VALUE_1 AJMP CVCV AAQ1: MOV VALUE_2,#01H MOV VALUE_1,#00H AJMP CVCV AZX1: MOV A,#20 CLR C SUBB A,R5 JC AZX2 JZ AAQ2 MOV R6,VALUE_1 CJNE R6,#00H,GHG1 MOV VALUE_2,#01H MOV VALUE_1,#09H AJMP CVCV GHG1: DEC VALUE_1 AJMP CVCV AAQ2: MOV VALUE_2,#02H MOV VALUE_1,#00H AJMP CVCV AZX2: MOV A,#30 CLR C SUBB A,R5 JC AZX3 JZ AAQ3 MOV R6,VALUE_1 CJNE R6,#00H,GHG2 MOV VALUE_2,#02H MOV VALUE_1,#09H AJMP CVCV GHG2: DEC VALUE_1 AJMP CVCV AAQ3: MOV VALUE_2,#03H MOV VALUE_1,#00H AJMP CVCV AZX3: MOV A,#40 CLR C SUBB A,R5

MOV R6,VALUE_1 CJNE R6,#00H,GHG MOV VALUE_2,#00H MOV VALUE_1,#09H AJMP CVCV MOV R6,VALUE_1 CJNE R6,#00H,GHG3 MOV VALUE_2,#03H MOV VALUE_1,#09H AJMP CVCV GHG3: DEC VALUE_1 AJMP CVCV AAQ4: MOV VALUE_2,#04H MOV VALUE_1,#00H AJMP CVCV AZX4: MOV A,#50 CLR C SUBB A,R5 JC AZX5 JZ AAQ5 MOV R6,VALUE_1 CJNE R6,#00H,GHG4 MOV VALUE_2,#04H MOV VALUE_1,#09H AJMP CVCV GHG4: DEC VALUE_1 AJMP CVCV AAQ5: MOV VALUE_2,#05H MOV VALUE_1,#00H AJMP CVCV AZX5: MOV A,#60 CLR C SUBB A,R5 JC AZX6 JZ AAQ6 MOV R6,VALUE_1 CJNE R6,#00H,GHG5 MOV VALUE_2,#05H MOV VALUE_1,#09H AJMP CVCV GHG5:
Page 21 of 36

Microcontroller Based Digital Visitor Counter

JC AZX4 JZ AAQ4 AZX6: MOV A,#70 CLR C SUBB A,R5 JC AZX7 JZ AAQ7 MOV R6,VALUE_1 CJNE R6,#00H,GHG6 MOV VALUE_2,#06H MOV VALUE_1,#09H AJMP CVCV GHG6: DEC VALUE_1 AJMP CVCV AAQ7: MOV VALUE_2,#07H MOV VALUE_1,#00H AJMP CVCV AZX7: MOV A,#80 CLR C SUBB A,R5 JC AZX8 JZ AAQ8 MOV R6,VALUE_1 CJNE R6,#00H,GHG7 MOV VALUE_2,#07H MOV VALUE_1,#09H AJMP CVCV GHG7: DEC VALUE_1 AJMP CVCV AAQ8: MOV VALUE_2,#08H MOV VALUE_1,#00H AJMP CVCV AZX8: MOV A,#90 CLR C SUBB A,R5 JC AZX9 JZ AAQ9 MOV R6,VALUE_1 CJNE R6,#00H,GHG8 MOV VALUE_2,#08H

DEC VALUE_1 AJMP CVCV AAQ6: MOV VALUE_2,#06H MOV VALUE_1,#00H AJMP CVCV GHG8: DEC VALUE_1 AJMP CVCV AAQ9: MOV VALUE_2,#09H MOV VALUE_1,#00H AJMP CVCV AZX9: MOV A,#100 CLR C SUBB A,R5 JC AZX10 JZ AAQ10 MOV R6,VALUE_1 CJNE R6,#00H,GHG9 MOV VALUE_3,#00H MOV VALUE_2,#09H MOV VALUE_1,#09H AJMP CVCV GHG9: DEC VALUE_1 AJMP CVCV AAQ10: MOV VALUE_3,#01H MOV VALUE_2,#00H MOV VALUE_1,#00H AJMP CVCV AZX10: MOV A,COUNTER CLR C SUBB A,#100 JZ AAQQ1 JC AZXX1 MOV R5,A MOV A,COUNTER CJNE A,#199,JKJK MOV VALUE_3,#01H JKJK: AJMP DOIT1 AAQQ1: MOV VALUE_3,#02H MOV VALUE_2,#00H MOV VALUE_1,#00H
Page 22 of 36

Microcontroller Based Digital Visitor Counter

MOV VALUE_1,#09H AJMP CVCV CVCV:

AJMP CVCV AZXX1: MOV VALUE_1,#00H MOV VALUE_2,#00H MOV VALUE_3,#00H CJNE R2,#03H,AS4 CLR DIS_A CLR DIS_B CLR DIS_C CLR DIS_D CLR DIS_G SETB DIS_E SETB DIS_F RET CJNE R2,#04H,AS5 CLR DIS_B CLR DIS_C CLR DIS_F CLR DIS_G SETB DIS_A SETB DIS_D SETB DIS_E RET CJNE R2,#05H,AS6 CLR DIS_A CLR DIS_C CLR DIS_D CLR DIS_F CLR DIS_G SETB DIS_B SETB DIS_E RET CJNE R2,#06H,AS7 CLR DIS_A CLR DIS_C CLR DIS_D CLR DIS_E CLR DIS_F CLR DIS_G SETB DIS_B RET CJNE R2,#07H,AS8 CLR DIS_A CLR DIS_B

; &&&&&&&&&&&&&&&&&&&&&&& RET &&&&&&&&&&&&&&&&&&&&& AS3: CALL DELAY CLR BUZZER JB LDR1,$ AJMP ZAZA ; &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&& ; 7 SEGMENT DISPLAY ; &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&& DISP: MOV R2,SPEED CJNE R2,#00H,AAS1 CLR DIS_A CLR DIS_B CLR DIS_C CLR DIS_D CLR DIS_E CLR DIS_F SETB DIS_G RET AAS1: CJNE R2,#01H,AS2 CLR DIS_B CLR DIS_C SETB DIS_A SETB DIS_D SETB DIS_E SETB DIS_F SETB DIS_G RET AS2: CJNE R2,#02H,AS3 CLR DIS_A CLR DIS_B

AS4:

AS5:

AS6:

AS7:

Page 23 of 36

Microcontroller Based Digital Visitor Counter

CLR DIS_D CLR DIS_E CLR DIS_G SETB DIS_C SETB DIS_F RET AS8: CJNE R2,#08H,AS9 CLR DIS_A CLR DIS_B CLR DIS_C CLR DIS_D CLR DIS_E CLR DIS_F CLR DIS_G RET AS9: CJNE R2,#09H,AS10 CLR DIS_A CLR DIS_B CLR DIS_C CLR DIS_D CLR DIS_F CLR DIS_G SETB DIS_E RET AS10: MOV SPEED,#00H AJMP DISP

CLR DIS_C SETB DIS_D SETB DIS_E SETB DIS_F SETB DIS_G SETB DIS3 CALL DISP AJMP DOWN QA4: MOV COUNT,#01H MOV R4,COUNT AJMP QA1 DOWN: MOV TL0,#0FFH ;reload the timer for scanning MOV TH0,#0F2H RETI ; &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&

DELAY: MOV R1,#0FFH RE1: MOV R2,#5FH RE: NOP DJNZ R2,RE DJNZ R1,RE1 ; RET &&&&&&&&&&&&&&&&&&&&&&& END &&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&& REFRESH: INC COUNT MOV R4,COUNT QA1: CJNE R4,#01H,QA2 MOV SPEED,VALUE_1 SETB DIS1 CLR DIS2 CLR DIS3 CALL DISP AJMP DOWN QA2: CJNE R4,#02H,QA3 MOV SPEED,VALUE_2 CLR DIS1 SETB DIS2 CLR DIS3
Page 24 of 36

Microcontroller Based Digital Visitor Counter

CALL DISP AJMP DOWN QA3: CJNE R4,#03H,QA4 MOV SPEED,VALUE_3 CLR DIS1 CLR DIS2

COMPONENTS DETAILS
4.1. Resistor Resistor is a component that resists the flow of direct or alternating electric circuit. Resistors used in electric circuits are cylindrical. They are often color coded by three or four color bands that indicate the specific value of resistance. Resistors obey ohms law, which states that the current density is directly proportional to the electric field when the temperature is constant 4.2. Capacitor Capacitor or electric condenser is a device for storing an electric charge. When one plate is charged with electricity from a direct current or electrostatic source, the other plate have induced in it a charge of the opposite sign; that is, positive if the original charge is negative and negative if the original charge is positive. Capacitors are produced in a wide variety of forms. Air, Mica, Ceramics, Paper, Oil, and Vacuums are used as dielectrics depending on the purpose for which the device is intended. 4.3. Transistor Transistor is a device which transforms current flow from low resistance path to high resistance path. It is capable of performing many functions of the vacuum tube in electronic circuits, the transistor is the solid state device consisting of a tiny piece of semi conducting material, usually germanium or silicon, to which three or more electrical connections are made. 4.4 Diode Diode is a electronic device that allows the passage of current in only one direction. The diodes commonly used in electronic circuits are semiconductor diodes. There are different diodes used in electronic circuits such as Junction diode, Zener diode, Photo diodes, and tunnel diode. Junction diodes consist of junction of two different kinds of semiconductor material. The Zener diode is a special junction type diode, using silicon, in which the voltage across the junction is independent of the current through the junction.

4.5. Integrated Circuits

Page 25 of 36

Microcontroller Based Digital Visitor Counter

Timer IC (555) It is a highly stable device for generating accurate time delays or oscillation. Additional terminals are provided for triggering or resetting if desired. In the time delay mode of operation, the time is precisely controlled by one external resistor and capacitor. For astable operation as an oscillator, the free running frequency and duty cycle are accurately controlled with two external resistors and one capacitor. The circuit may be triggered and reset on falling waveforms, and the output circuit can source or sink up to 200mA or drive TTL circuits. Features: Direct replacement for SE555/NE555 Timing from microseconds through hours Operates in both astable and monostable modes Adjustable duty cycle Output can source or sink 200 mA Output and supply TTL compatible Temperature stability better than 0.005% per C Normally on and normally off output Applications: Precision timing Pulse generation Sequential timing Time delay generation Pulse width modulation Pulse position modulation Linear ramp generator

Page 26 of 36

Microcontroller Based Digital Visitor Counter

Fig 4.1: PIN DIAGRAM OF TIMER 555 IC:

Fig: PIN DIAGRAM OF TIMER 555 IC

MONOSTABLE MULTIVIBRATOR: Monostable multivibrator often called a one shot multivibrator is a pulse generating circuit in which the duration of this pulse is determined by the RC network connected externally to the 555 timer. In a stable or standby state, the output of the circuit is approximately zero or a logic-low level. When external trigger pulse is applied output is forced to go high ( VCC). The time for which output remains high is determined by the external RC network connected to the timer. At the end of the timing interval, the output automatically reverts back to its logic-low stable state. The output stays low until trigger pulse is again

Page 27 of 36

Microcontroller Based Digital Visitor Counter

applied. Then the cycle repeats. The monostable circuit has only one stable state (output low) hence the name monostable.

PIN DIAGRAM OF MONOSTABLE:

Page 28 of 36

Microcontroller Based Digital Visitor Counter

Pin1: Ground. All voltages are measured with respect to this terminal. Pin2: Trigger. The output of the timer depends on the amplitude of the external trigger pulse applied to this pin. The output is low if the voltage at this pin is greater than 2/3 VCC. When a negative going pulse of amplitude greater than 1/3 VCC is applied to this pin, comparator 2 output goes low, which inturn switches the output of the timer high. The output remains high as long as the trigger terminal is held at a low voltage. Pin3: Output. There are two ways by which a load can be connected to the output terminal: either between pin 3 and ground or between pin3 and supply voltage +VCC. When the output is low the load current flows through the load connected between pin3 and +VCC into the output terminal and is called sink current. The current through the grounded load is zero when the output is low. For this reason the load connected between pin 3 and +VCC is called the normally on load and that connected between pin 3 and ground is called normally off-load. On the other hand, when the output is high the current through the load connected between pin 3 and +VCC is zero. The output terminal supplies current to the normally off load. This current is called source current. The maximum value of sink or source current is 200mA. Pin4: Reset. The 555 timer can be reset (disabled) by applying a negative pulse to this pin. When the reset function is not in use, the reset terminal should be connected to +VCC to avoid any possibility of false triggering. Pin5: Control Voltage. An external voltage applied to this terminal changes the threshold as well as trigger voltage. Thus by imposing a voltage on this pin or by connecting a pot between this pin and ground, the pulse width of the output waveform can be varied. When not used, the control pin should be bypassed to ground with a 0.01F Capacitor to prevent any noise problems. Pin6: Threshold. This is the non-inverting input of comparator 1, which monitors the voltage across the external capacitor. When the voltage at this pin is greater than or equal to the threshold voltage 2/3 VCC, the output of comparator 1 goes high, which inturn switches the output of the timer low. Pin7: Discharge. This pin is connected internally to the collector of transistor Q1. When the output is high Q1 is OFF and acts as an open circuit to external capacitor C connected across it. On the other hand, when the output is low, Q1 is saturated and acts as a short circuit, shorting out the external capacitor C to ground. Pin8: +VCC. The supply voltage of +5V to + 18V is applied to this pin with respect to ground.

Page 29 of 36

Microcontroller Based Digital Visitor Counter

ASTABLE MULTIVIBRATOR: Astable Multivibrator is a two stage switching circuit in which the output of the first stage is fed to the input of the second stage and vice versa. The outputs of both the stages are complementary. This free running multivibrator generates square wave without any external triggering pulse. The circuit has two stable states and switches back and forth from one state to another, remaining in each state for a time depending upon the discharging of the capacitive circuit. The multivibrator is one form of relaxation oscillator, the frequency of which may be controlled by external synchronizing pulses. 4.5. Infrared sensors The TSOP17 series are miniaturized receivers for infrared remote control systems. PIN diode and preamplifier are assembled on lead frame, the epoxy package is designed as IR filter. The demodulated output signal can directly be decoded by a microprocessor. TSOP17.. is the standard IR remote control receiver series, supporting all major transmission codes. Features: Photo detector and preamplifier in one package Internal filter for PCM frequency Improved shielding against electrical field disturbance TTL and CMOS compatibility Output active low Low power consumption High immunity against ambient light Continuous data transmission possible (up to 2400 bps) Suitable burst length 10 cycles/burst

4.6 crystal oscillator:


A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and receivers. The

Page 30 of 36

Microcontroller Based Digital Visitor Counter

most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits designed around them became known as "crystal oscillators." Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of megahertz. More than two billion (2109) crystals are manufactured annually. Most are small devices for consumer devices such as wristwatches, clocks, radios, computers, and cell phones. Quartz crystals are also found inside test and measurement equipment, such as counters, signal generators, and oscilloscopes.

4.7 SEVEN SEGMENT DISPLAY


One common requirement for many different digital devices is a visual numeric display. Individual LEDs can of course display the binary states of a set of latches or flip-flops. However, we're far more used to thinking and dealing with decimal numbers. To this end, we want a display of some kind that can clearly represent decimal numbers without any requirement of translating binary to decimal or any other format. One possibility is a matrix of 28 LEDs in a 74 array. We can then light up selected LEDs in the pattern required for whatever character we want. Indeed, an expanded version of this is used in many ways, for fancy displays. However, if all we want to display is numbers, this becomes a bit expensive. A much better way is to arrange the minimum possible number of LEDs in such a way as to represent only numbers in a simple fashion. This requires just seven LEDs (plus an eighth one for the decimal point, if that is needed). A common technique is to use a shaped piece of translucent plastic to operate as a specialized optical fiber, to distribute the light from the LED evenly over a fixed bar shape. The seven bars are laid out as a squared-off figure "8". The result is known as a seven-segment LED.

Page 31 of 36

Microcontroller Based Digital Visitor Counter

We've all seen seven-segment displays in a wide range of applications. Clocks, watches, digital instruments, and many household appliances already have such displays. In this experiment, we'll look at what they are and how they can display any of the ten decimal digits 0-9 on demand.

Page 32 of 36

Microcontroller Based Digital Visitor Counter

Page 33 of 36

Microcontroller Based Digital Visitor Counter

CONCLUSION
5.1 Application
Visitor counter. The counter sensor majority apply in industry or factory. Vehicle parking (Counting commodity or counting a car in/out of parking)

Page 34 of 36

Microcontroller Based Digital Visitor Counter

BIBLIOGRAPHY

[1] D. Neamen, Electronic Circuit Analysis and Design. New Mexico: Times Mirror Higher Education Group Inc., 1996, pp. 69. [2]Microchip, AT89C2051 Data Sheet, Microchip Technology Inc., 2003 [3] Help for The 555 Timer Chip, http://www2.ebtech.net/~pais/555_Timer_Help.html. [4] FREE Microcontroller projects, http://www.8051projects.info/proj.asp?ID=36 [5]eHow.com,How to Write a Bibliography, http://www.ehow.com/how_2859_write-bibliography.html

Page 35 of 36

Microcontroller Based Digital Visitor Counter

Page 36 of 36

You might also like