38534531 micro controller based digital visitor counter
TRANSCRIPT
PAGE INDEX
Topic Page No.ACKNOWLEDMENT ABSTRACTINTRODUCTION
4 5 6
1. PROJECT DESCRIPTION1.1 BLOCK DIAGRAM
EXPLAINATION 8
2. CIRCUIT DIAGRAM AND DESCRIPTION2.1 CIRCUIT DIAGRAM 152.2 POWER SUPPLY 162.3 FLOW CHART 17
3.
4.
PROGRAM
COMPONENTS DETAILS4.1 4.24.34.44.54.6
RESISTOR CAPACITORTRANSISTORDIODESINTEGRATED CIRCUIT(IC555)INFRARED SENSORS
18
25 25 25 26 26 28
Microcontroller Based Digital Visitor Counter
5. CONCLUSION5.1 APPLICATIONS 29
BIBLIOGRAPHY 30
PROJECT PRINTOUTS 31 onwards
FIGURE INDEX
Figure Page No.
1.1 BLOCK DIAGRAM 71.21.3
PIN ConfigurationBlock Diagram
12 13
2.1 Circuit diagram of Digital Visitor Counter 152.2 Power Supply Diagram 16
4.14.2
Pin diagram of IC555Infrared Sensor
27 28
Page 2 of 35
Microcontroller Based Digital Visitor Counter
TABLE INDEX
Table Page No.
1.1 Pin Description of AT89C2051 14
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 3 of 35
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 4 of 35
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
Page 5 of 35
Microcontroller Based Digital Visitor Counter
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 35
Microcontroller Based Digital Visitor Counter
1. PROJECT DESCRIPTION
Figure 1.1: BLOCK DIAGRAM
Page 7 of 35
Microcontroller Based Digital Visitor Counter
1.1 BLOCK DIAGRAM EXPLANATION
INTEL’S 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 35
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.
Page 9 of 35
Microcontroller Based Digital Visitor Counter
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.
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 Atmel’s 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 35
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 :
Page 11 of 35
Microcontroller Based Digital Visitor Counter
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.
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 Name Bit Address Function
P3.0 RXD B0H Receive data for serial port
P3.1 TXD B1H Transmit data for serial port
P3.2 INT0-bar B2H External interrupt 0
P3.3 INT1-bar B3H External interrupt 1
P3.4 T0 B4H Timer/counter 0 external input
P3.5 T1 B5H Timer/counter 1 external input
P3.6 WR-bar B6H External data memory write strobe
P3.7 RD-bar B7H External data memory read strobe
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 memoryALE : 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.
Page 12 of 35
Microcontroller Based Digital Visitor Counter
BLOCK DIAGRAM OF 8051:
Page 13 of 35
Microcontroller Based Digital Visitor Counter
Figure: BLOCK DIAGRAM OF 8051
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 35
Microcontroller Based Digital Visitor Counter
CIRCUIT DIAGRAM OF 8051:
Figure 2.1: Circuit diagram of Digital visitor counter
Page 15 of 35
Microcontroller Based Digital Visitor Counter
2.2 Power Supply
Figure 2.2. Power Supply Diagram
AC230V
D1
D2
1000uF/25V
C1D4
D(1-4)=1N4007
D3
230/ 9V AC+5V1
2
3LM7805
IC1
Gnd
47uF/25V
C2
+12V
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 35
Microcontroller Based Digital Visitor Counter
2.3. Flowchart
Page 17 of 35
Microcontroller Based Digital Visitor Counter
3.PROGRAM
$MOD52
DIS_A EQU P1.5DIS_B EQU P1.4DIS_C EQU P1.3DIS_D EQU P1.1DIS_E EQU P1.2DIS_F EQU P1.6DIS_G EQU P1.7DIS1 EQU P3.3DIS2 EQU P3.4 DIS3 EQU P3.5LDR1 EQU P3.0LDR2 EQU P3.1BUZZER EQU P1.0
DSEG ; This is internal data memory
ORG 20H ; Bit adressable memory BITS: DS 1
UP BIT BITS.0 DWN BIT BITS.1COUNT: DS 1SPEED: DS 1VALUE_1: DS 1VALUE_2: DS 1VALUE_3: DS 1COUNTER: DS 1STACK: DS
1 ; Stack begins here CSEG ; Code begins here
;---------==========----------==========---------=========---------; PROCESSOR INTERRUPT AND RESET VECTORS;---------==========----------==========---------=========---------
ORG 00H ; Reset JMP MAIN
ORG 000BH ;Timer Interrupt0
JMP REFRESH
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&; MAIN PROGRAM;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&MAIN:
CLR BUZZERMOV SPEED,#00HMOV COUNT,#00HMOV VALUE_1,#00HMOV VALUE_2,#00HMOV VALUE_3,#00HMOV COUNTER,#00H
CLR DIS1CLR DIS2CLR DIS3
MOV TMOD,#01H;enable timer0 for scanningMOV TL0,#00HMOV TH0,#0FDH SETB ET0SETB EASETB TR0
AJMP ZAZA
ASSA: AJMP ASAA
ZAZA:SETB LDR1
Page 18 of 35
Microcontroller Based Digital Visitor Counter
JNB LDR1,ASSA
CALL DELAYSETB LDR2JNB LDR2,$
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&; UP COUNTER;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
SETB BUZZERINC COUNTERMOV R5,COUNTER
DOIT: MOV A,#10CLR CSUBB A,R5JC ZX1JZ AQ1 INC VALUE_1AJMP CVC
AQ1: MOV VALUE_2,#01HMOV VALUE_1,#00HAJMP CVC
ZX1: MOV A,#20CLR CSUBB A,R5JC ZX2JZ AQ2INC VALUE_1AJMP CVC
AQ2: MOV VALUE_2,#02HMOV VALUE_1,#00HAJMP CVC
ZX2: MOV A,#30CLR CSUBB A,R5JC ZX3JZ AQ3INC VALUE_1AJMP CVC
AQ3: MOV VALUE_2,#03HMOV VALUE_1,#00HAJMP CVC
ZX3: MOV A,#40CLR CSUBB A,R5JC ZX4JZ AQ4INC VALUE_1AJMP CVC
AQ4: MOV VALUE_2,#04HMOV VALUE_1,#00HAJMP CVC
ZX4: MOV A,#50CLR CSUBB A,R5JC ZX5JZ AQ5INC VALUE_1AJMP CVC
AQ5: MOV VALUE_2,#05HMOV VALUE_1,#00HAJMP CVC
ZX5: MOV A,#60CLR CSUBB A,R5JC ZX6JZ AQ6INC VALUE_1AJMP CVC
AQ6: MOV VALUE_2,#06HMOV VALUE_1,#00HAJMP CVC
ZX6: MOV A,#70CLR CSUBB A,R5JC ZX7JZ AQ7INC VALUE_1AJMP CVC
AQ7: MOV VALUE_2,#07HMOV VALUE_1,#00HAJMP CVC
Page 19 of 35
Microcontroller Based Digital Visitor Counter
ZX7: MOV A,#80CLR CSUBB A,R5JC ZX8JZ AQ8INC VALUE_1AJMP CVC
AQ8: MOV VALUE_2,#08HMOV VALUE_1,#00HAJMP CVC
ZX8: MOV A,#90CLR CSUBB A,R5JC ZX9JZ AQ9INC VALUE_1AJMP CVC
AQ9: MOV VALUE_2,#09HMOV VALUE_1,#00HAJMP CVC
ZX9: MOV A,#100CLR CSUBB A,R5JC ZX10JZ AQ10INC VALUE_1AJMP CVC
AQ10: MOV VALUE_3,#01HMOV VALUE_2,#00HMOV VALUE_1,#00HAJMP CVC
ZX10: MOV A,COUNTERCLR CSUBB A,#100JZ AQQ1JC ZXX1MOV R5,AAJMP DOIT
AQQ1:MOV VALUE_3,#02HMOV VALUE_2,#00HMOV VALUE_1,#00HAJMP CVC
ZXX1: MOV VALUE_1,#00HMOV VALUE_2,#00HMOV VALUE_3,#00H
CVC:;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
CALL DELAYCLR BUZZERJB LDR2,$AJMP ZAZA
ZAZAA: JMP ZAZAASAA: SETB LDR2
JNB LDR2,ZAZAA
CALL DELAYSETB LDR1JNB LDR1,$
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&; DOWN COUNTER;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
SETB BUZZERDEC COUNTERMOV R5,COUNTERMOV A,R5INC ACJNE A,#00H,DOIT1MOV VALUE_1,#00HMOV VALUE_2,#00HMOV VALUE_3,#00HMOV COUNTER,#00HAJMP CVCV
DOIT1:MOV A,#10CLR CSUBB A,R5JC AZX1JZ AAQ1 MOV R6,VALUE_1CJNE R6,#00H,GHGMOV VALUE_2,#00HMOV VALUE_1,#09HAJMP CVCV
Page 20 of 35
Microcontroller Based Digital Visitor Counter
GHG:DEC VALUE_1AJMP CVCV
AAQ1:MOV VALUE_2,#01HMOV VALUE_1,#00HAJMP CVCV
AZX1: MOV A,#20CLR CSUBB A,R5JC AZX2JZ AAQ2MOV R6,VALUE_1CJNE R6,#00H,GHG1MOV VALUE_2,#01HMOV VALUE_1,#09HAJMP CVCV
GHG1:DEC VALUE_1AJMP CVCV
AAQ2:MOV VALUE_2,#02HMOV VALUE_1,#00HAJMP CVCV
AZX2: MOV A,#30CLR CSUBB A,R5JC AZX3JZ AAQ3MOV R6,VALUE_1CJNE R6,#00H,GHG2MOV VALUE_2,#02HMOV VALUE_1,#09HAJMP CVCV
GHG2:DEC VALUE_1AJMP CVCV
AAQ3:MOV VALUE_2,#03HMOV VALUE_1,#00HAJMP CVCV
AZX3: MOV A,#40CLR CSUBB A,R5JC AZX4JZ AAQ4
MOV R6,VALUE_1CJNE R6,#00H,GHG3MOV VALUE_2,#03HMOV VALUE_1,#09HAJMP CVCV
GHG3:DEC VALUE_1AJMP CVCV
AAQ4:MOV VALUE_2,#04HMOV VALUE_1,#00HAJMP CVCV
AZX4: MOV A,#50CLR CSUBB A,R5JC AZX5JZ AAQ5MOV R6,VALUE_1CJNE R6,#00H,GHG4MOV VALUE_2,#04HMOV VALUE_1,#09HAJMP CVCV
GHG4:DEC VALUE_1AJMP CVCV
AAQ5:MOV VALUE_2,#05HMOV VALUE_1,#00HAJMP CVCV
AZX5: MOV A,#60CLR CSUBB A,R5JC AZX6JZ AAQ6MOV R6,VALUE_1CJNE R6,#00H,GHG5MOV VALUE_2,#05HMOV VALUE_1,#09HAJMP CVCV
GHG5:DEC VALUE_1AJMP CVCV
AAQ6:MOV VALUE_2,#06HMOV VALUE_1,#00HAJMP CVCV
Page 21 of 35
Microcontroller Based Digital Visitor Counter
AZX6: MOV A,#70CLR CSUBB A,R5JC AZX7JZ AAQ7MOV R6,VALUE_1CJNE R6,#00H,GHG6MOV VALUE_2,#06HMOV VALUE_1,#09HAJMP CVCV
GHG6:DEC VALUE_1AJMP CVCV
AAQ7:MOV VALUE_2,#07HMOV VALUE_1,#00HAJMP CVCV
AZX7: MOV A,#80CLR CSUBB A,R5JC AZX8JZ AAQ8MOV R6,VALUE_1CJNE R6,#00H,GHG7MOV VALUE_2,#07HMOV VALUE_1,#09HAJMP CVCV
GHG7:DEC VALUE_1AJMP CVCV
AAQ8:MOV VALUE_2,#08HMOV VALUE_1,#00HAJMP CVCV
AZX8: MOV A,#90CLR CSUBB A,R5JC AZX9JZ AAQ9MOV R6,VALUE_1CJNE R6,#00H,GHG8MOV VALUE_2,#08HMOV VALUE_1,#09HAJMP CVCV
GHG8:DEC VALUE_1AJMP CVCV
AAQ9:MOV VALUE_2,#09HMOV VALUE_1,#00HAJMP CVCV
AZX9: MOV A,#100CLR CSUBB A,R5JC AZX10JZ AAQ10MOV R6,VALUE_1CJNE R6,#00H,GHG9MOV VALUE_3,#00HMOV VALUE_2,#09HMOV VALUE_1,#09HAJMP CVCV
GHG9:DEC VALUE_1AJMP CVCV
AAQ10: MOV VALUE_3,#01HMOV VALUE_2,#00HMOV VALUE_1,#00HAJMP CVCV
AZX10: MOV A,COUNTERCLR CSUBB A,#100JZ AAQQ1JC AZXX1MOV R5,AMOV A,COUNTERCJNE A,#199,JKJKMOV VALUE_3,#01H
JKJK:AJMP DOIT1
AAQQ1: MOV VALUE_3,#02HMOV VALUE_2,#00HMOV VALUE_1,#00HAJMP CVCV
AZXX1: MOV VALUE_1,#00HMOV VALUE_2,#00HMOV VALUE_3,#00H
Page 22 of 35
Microcontroller Based Digital Visitor Counter
CVCV:
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
CALL DELAYCLR BUZZERJB LDR1,$AJMP ZAZA
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&; 7 SEGMENT DISPLAY;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&DISP:
MOV R2,SPEEDCJNE R2,#00H,AAS1CLR DIS_ACLR DIS_BCLR DIS_CCLR DIS_DCLR DIS_ECLR DIS_FSETB DIS_GRET
AAS1: CJNE R2,#01H,AS2CLR DIS_BCLR DIS_CSETB DIS_ASETB DIS_DSETB DIS_ESETB DIS_FSETB DIS_GRET
AS2: CJNE R2,#02H,AS3CLR DIS_ACLR DIS_BCLR DIS_DCLR DIS_ECLR DIS_GSETB DIS_CSETB DIS_F
RETAS3: CJNE R2,#03H,AS4
CLR DIS_A CLR DIS_BCLR DIS_CCLR DIS_DCLR DIS_GSETB DIS_ESETB DIS_FRET
AS4: CJNE R2,#04H,AS5CLR DIS_BCLR DIS_CCLR DIS_FCLR DIS_GSETB DIS_ASETB DIS_DSETB DIS_ERET
AS5: CJNE R2,#05H,AS6CLR DIS_ACLR DIS_CCLR DIS_DCLR DIS_FCLR DIS_GSETB DIS_BSETB DIS_ERET
AS6: CJNE R2,#06H,AS7CLR DIS_ACLR DIS_CCLR DIS_DCLR DIS_ECLR DIS_FCLR DIS_GSETB DIS_BRET
AS7: CJNE R2,#07H,AS8CLR DIS_ACLR DIS_BCLR DIS_CSETB DIS_DSETB DIS_ESETB DIS_FSETB DIS_G
Page 23 of 35
Microcontroller Based Digital Visitor Counter
RETAS8: CJNE R2,#08H,AS9
CLR DIS_ACLR DIS_BCLR DIS_CCLR DIS_DCLR DIS_ECLR DIS_FCLR DIS_GRET
AS9: CJNE R2,#09H,AS10CLR DIS_ACLR DIS_BCLR DIS_CCLR DIS_DCLR DIS_FCLR DIS_GSETB DIS_ERET
AS10: MOV SPEED,#00HAJMP DISP
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&REFRESH:
INC COUNTMOV R4,COUNT
QA1: CJNE R4,#01H,QA2MOV SPEED,VALUE_1SETB DIS1CLR DIS2CLR DIS3CALL DISP AJMP DOWN
QA2: CJNE R4,#02H,QA3MOV SPEED,VALUE_2CLR DIS1SETB DIS2CLR DIS3CALL DISP AJMP DOWN
QA3: CJNE R4,#03H,QA4MOV SPEED,VALUE_3CLR DIS1CLR DIS2
SETB DIS3CALL DISP AJMP DOWN
QA4: MOV COUNT,#01HMOV R4,COUNTAJMP QA1
DOWN: MOV TL0,#0FFH;reload the timer for scanningMOV TH0,#0F2HRETI
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
DELAY:MOV R1,#0FFH
RE1: MOV R2,#5FHRE: NOP
DJNZ R2,REDJNZ R1,RE1RET
END
Page 24 of 35
Microcontroller Based Digital Visitor Counter
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 ohm’s 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
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
Page 25 of 35
Microcontroller Based Digital Visitor Counter
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 35
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 applied. Then the cycle repeats. The monostable circuit has only one stable state (output low)
hence the name monostable.
Page 27 of 35
Microcontroller Based Digital Visitor Counter
PIN DIAGRAM OF MONOSTABLE:
Page 28 of 35
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.01µF 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.
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
Page 29 of 35
Microcontroller Based Digital Visitor Counter
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
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 (2×109) crystals are manufactured annually. Most are small devices for consumer
Page 30 of 35
Microcontroller Based Digital Visitor Counter
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 7×4 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.
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 31 of 35
Microcontroller Based Digital Visitor Counter
Page 32 of 35
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 33 of 35
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 34 of 35
Microcontroller Based Digital Visitor Counter
Page 35 of 35