You are on page 1of 33

Vidyalankar Institute of Technology

2009-2010

Certificate
This is to certify that
Sumedh.M.More(07-336)
Sneha Newalkar(07-339)
Prathamesh.B.Sarang(07-349)

Have satisfactorily completed the project entitled


Microprocessor based Digital Visitor Counter
In fulfillment of the Degree of T.E. in Electronics
Engineering Affiliated to the
UNIVERSITY OF MUMBAI
For the academic year 2009-10
Date: ____________
Microcontroller Based Digital Visistor Counter

Page 2 of 33
Microcontroller Based Digital Visistor Counter

PAGE INDEX

Topic Page No.


ACKNOWLEDMENT 4
ABSTRACT 5
INTRODUCTION 6
1 PROJECT DESCRIPTION
.
1.1 BLOCK DIAGRAM 8
EXPLAINATION

2 CIRCUIT DIAGRAM AND DESCRIPTION


.
2.1 CIRCUIT DIAGRAM 15
2.2 POWER SUPPLY 16
2.3 FLOW CHART 17

3 PROGRAM 18
.
COMPONENTS
4 DETAILS
. 4.1 RESISTOR 25
4.2 CAPACITOR 25
4.3 TRANSISTOR 25
4.4 DIODES 26
4.5 INTEGRATED CIRCUIT(IC555) 26
4.6 INFRARED SENSORS 28

5 CONCLUSION
. 5.1 APPLICATIONS 29

BIBLIOGRAPHY 30

PROJECT PRINTOUTS 31 onwards

Page 3 of 33
Microcontroller Based Digital Visistor Counter

FIGURE INDEX

Figure Page No.

1.1 BLOCK DIAGRAM 7


1.2 PIN Configuration 12
1.3 Block Diagram 13

2.1 Circuit diagram of Digital Visitor Counter 15


2.2 Power Supply Diagram 16

4.1 Pin diagram of IC555 27


4.2 Infrared Sensor 28

TABLE INDEX
Table Page No.

1.1 Pin Description of AT89C2051 14

Page 4 of 33
Microcontroller Based Digital Visistor 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 5 of 33
Microcontroller Based Digital Visistor 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 displays.The system is fully controlled by the 8 bit
microcontroller AT89C2051 which has a 2Kbytes of ROM for the program
memory.

Page 6 of 33
Microcontroller Based Digital Visistor Counter

INTRODUCTION

The proposed system is based on 8051 μcontroller 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.
1. Detect Object (Sensor): Proximity sensor(infrared sensors)
2. Data Processing (CPU): For this project we choose microcontroller 8051
3. 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 7 of 33
Microcontroller Based Digital Visistor Counter

PROJECT DESCRIPTION
Figure 1.1: BLOCK DIAGRAM

Infrared Micro Seven


Sensors Timer IC’s
TSOP1736
Controller segment
AT8C2051 display

Page 8 of 33
Microcontroller Based Digital Visistor 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 onchip 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 embedded needs.

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 onchip Data Memory.
 32 Bi directional and individually addressable I/O lines.
 Two 16 bit timer/counters.
 Full Duplex UART.

Page 9 of 33
Microcontroller Based Digital Visistor Counter

 6 source / 5 vector interrupt structure with priority levels.


 Onchip clock oscillator.

Now you may be wondering about the non mentioning of memory space
meant for the program storage, the most important part of any embedded
controller. Originally this 8051 architecture was introduced with onchip, `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 any thing 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

Page 10 of 33
Microcontroller Based Digital Visistor Counter

inputs and then 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 8 bit microcontroller AT89C2051, it is the advanced 8
bit microcontroller from ATMEL, which incorporates Flash Rom, and Timer etc.
Features of AT89C2051:
 Compatible with MCS-51 Products
 2 Kbytes of Reprogrammable Flash Memory
 Endurance: 1,000 Write/Erase Cycles
 2.7 V to 6 V Operating Range
 Fully Static Operation: 0 Hz to 24 MHz
 Two-Level Program Memory Lock
 128 x 8-Bit Internal RAM
 15 Programmable I/O Lines
 Two 16-Bit Timer/Counters
 Six Interrupt Sources
 Programmable Serial UART Channel

Page 11 of 33
Microcontroller Based Digital Visistor Counter

 Direct LED Drive Outputs


 On-Chip Analog Comparator
 Low Power Idle and Power Down Modes
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
applications.

Page 12 of 33
Microcontroller Based Digital Visistor Counter

Figure1.2: PIN Configurations

Page 13 of 33
Microcontroller Based Digital Visistor Counter

Figure 1.3: Block Diagram

Page 14 of 33
Microcontroller Based Digital Visistor Counter

Table 1.1:PIN DESCRIPTION OF AT89C2051

VCC Supply voltage.


GND Ground.
Port 1 Port 1 is an 8-bit bidirectional I/O port. Port pins P1.2 to P1.7 provide
internal pullups. P1.0 and P1.1 require external pullups. P1.0 and P1.1
also serve as the positive input (AIN0) and the negative input (AIN1),
respectively, of the on-chip precision analog comparator. The Port 1
output buffers can sink 20 mA and can drive LED displays directly.
When 1s are written to Port 1 pins, they can be used as inputs. When
pins P1.2 to P1.7 are used as inputs and are externally pulled low, they
will source current (IIL) because of the internal pullups. Port 1 also
receives code data during Flash programming and program verification.
Port 3 Port 3 pins P3.0 to P3.5, P3.7 are seven bidirectional I/O pins with
internal pullups. P3.6 is hard-wired as an input to the output of the on-
chip comparator and is not accessible as a general purpose I/O pin. The
Port 3 output buffers can sink 20 mA. When 1s are written to Port 3
pins they are pulled high by the internal pullups and can be used as
inputs. As inputs, Port 3 pins that are externally being pulled low will
source current (IIL) because of the pullups. Port 3 also serves the
functions of various special features of the AT89C2051 as listed below.
Port 3 also receives some control signals for Flash programming and
programming verification.
RST Reset input. All I/O pins are reset to 1s as soon as RST goes high.
Holding the RST pin high for two machine cycles while the oscillator is
running resets the device. Each machine cycle takes 12 oscillator or
clock cycles.
XTAL1 Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
XTAL2 Output from the inverting oscillator amplifier.

CIRCUIT DIAGRAM AND DESCRIPTION


Figure 2.1 Circuit Diagram of Digital visitor counter.

Page 15 of 33
Microcontroller Based Digital Visistor Counter

2.2 Power Supply

Page 16 of 33
Microcontroller Based Digital Visistor Counter

Figure 2.2. Power Supply Diagram

+12V

IC1
D1
1 3 +5V
LM7805
230/ 9V AC D4 C1 C2
2
230V 1000uF/25V 47uF/25V
D3
AC
Gnd
D2

D(1-4)=1N4007

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.

2.3. Flowchart

Page 17 of 33
Microcontroller Based Digital Visistor Counter

Page 18 of 33
Microcontroller Based Digital Visistor Counter

3.PROGRAM
$MOD52 ORG 00H ; Reset
JMP MAIN
DIS_A EQU P1.5
DIS_B EQU P1.4 ORG 000BH ;Timer
DIS_C EQU P1.3 Interrupt0
DIS_D EQU P1.1 JMP REFRESH
DIS_E EQU P1.2
DIS_F EQU P1.6 ;
DIS_G EQU P1.7 &&&&&&&&&&&&&&&&&&&&&&&
DIS1 EQU P3.3 &&&&&&&&&&&&&&&&&&&&&&&
DIS2 EQU P3.4 &&&&&&&&&&
DIS3 EQU P3.5 ; MAIN PROGRAM
LDR1 EQU P3.0 ;
LDR2 EQU P3.1 &&&&&&&&&&&&&&&&&&&&&&&
BUZZER EQU P1.0 &&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&
DSEG ; This is internal data MAIN:
memory CLR BUZZER
MOV SPEED,#00H
MOV COUNT,#00H
ORG 20H ; Bit adressable MOV VALUE_1,#00H
memory MOV VALUE_2,#00H
BITS: DS 1 MOV VALUE_3,#00H
UP BIT BITS.0 MOV COUNTER,#00H
DWN BIT BITS.1
COUNT: DS 1
SPEED: DS 1 CLR DIS1
VALUE_1: DS 1 CLR DIS2
VALUE_2: DS 1 CLR DIS3
VALUE_3: DS 1
COUNTER: DS 1
STACK: DS MOV TMOD,#01H ;enable
1 ; Stack begins here timer0 for scanning
CSEG ; Code begins here MOV TL0,#00H
MOV TH0,#0FDH
SETB ET0
;---------==========---------- SETB EA
==========---------=========--------- SETB TR0
; PROCESSOR INTERRUPT
AND RESET VECTORS AJMP ZAZA
;---------==========----------
==========---------=========--------- ASSA: AJMP ASAA

Page 19 of 33
Microcontroller Based Digital Visistor Counter

ZAZA:SETB LDR1
JNB LDR1,ASSA

CALL DELAY ZX3: MOV A,#40


SETB LDR2 CLR C
JNB LDR2,$ 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 20 of 33
Microcontroller Based Digital Visistor Counter

MOV VALUE_1,#00H AJMP CVC


AJMP CVC

ZX7: MOV A,#80 ZXX1: MOV VALUE_1,#00H


CLR C MOV VALUE_2,#00H
SUBB A,R5 MOV VALUE_3,#00H
JC ZX8
JZ AQ8 CVC:
INC VALUE_1 ;
AJMP CVC &&&&&&&&&&&&&&&&&&&&&&&
AQ8: MOV VALUE_2,#08H &&&&&&&&&&&&&&&&&&&&&
MOV VALUE_1,#00H CALL DELAY
AJMP CVC CLR BUZZER
JB LDR2,$
ZX8: MOV A,#90 AJMP ZAZA
CLR C ZAZAA: JMP ZAZA
SUBB A,R5 ASAA: SETB LDR2
JC ZX9 JNB LDR2,ZAZAA
JZ AQ9
INC VALUE_1 CALL DELAY
AJMP CVC SETB LDR1
AQ9: MOV VALUE_2,#09H JNB LDR1,$
MOV VALUE_1,#00H ;
AJMP CVC &&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&
ZX9: MOV A,#100 ; DOWN COUNTER
CLR C ;
SUBB A,R5 &&&&&&&&&&&&&&&&&&&&&&&
JC ZX10 &&&&&&&&&&&&&&&&&&&&&
JZ AQ10 SETB BUZZER
INC VALUE_1 DEC COUNTER
AJMP CVC MOV R5,COUNTER
AQ10: MOV VALUE_3,#01H MOV A,R5
MOV VALUE_2,#00H INC A
MOV VALUE_1,#00H CJNE A,#00H,DOIT1
AJMP CVC MOV VALUE_1,#00H
MOV VALUE_2,#00H
ZX10: MOV A,COUNTER MOV VALUE_3,#00H
CLR C MOV COUNTER,#00H
SUBB A,#100 AJMP CVCV
JZ AQQ1 DOIT1:
JC ZXX1 MOV A,#10
MOV R5,A CLR C
AJMP DOIT SUBB A,R5
AQQ1:MOV VALUE_3,#02H JC AZX1
MOV VALUE_2,#00H JZ AAQ1

Page 21 of 33
Microcontroller Based Digital Visistor Counter

MOV VALUE_1,#00H MOV R6,VALUE_1


AJMP CVC CJNE R6,#00H,GHG
MOV VALUE_2,#00H
GHG: MOV VALUE_1,#09H
DEC VALUE_1 AJMP CVCV
AJMP CVCV
AAQ1:MOV VALUE_2,#01H MOV R6,VALUE_1
MOV VALUE_1,#00H CJNE R6,#00H,GHG3
AJMP CVCV MOV VALUE_2,#03H
AZX1: MOV A,#20 MOV VALUE_1,#09H
CLR C AJMP CVCV
SUBB A,R5 GHG3:
JC AZX2 DEC VALUE_1
JZ AAQ2 AJMP CVCV
MOV R6,VALUE_1 AAQ4:MOV VALUE_2,#04H
CJNE R6,#00H,GHG1 MOV VALUE_1,#00H
MOV VALUE_2,#01H AJMP CVCV
MOV VALUE_1,#09H
AJMP CVCV AZX4: MOV A,#50
GHG1: CLR C
DEC VALUE_1 SUBB A,R5
AJMP CVCV JC AZX5
AAQ2:MOV VALUE_2,#02H JZ AAQ5
MOV VALUE_1,#00H MOV R6,VALUE_1
AJMP CVCV CJNE R6,#00H,GHG4
MOV VALUE_2,#04H
AZX2: MOV A,#30 MOV VALUE_1,#09H
CLR C AJMP CVCV
SUBB A,R5 GHG4:
JC AZX3 DEC VALUE_1
JZ AAQ3 AJMP CVCV
MOV R6,VALUE_1 AAQ5:MOV VALUE_2,#05H
CJNE R6,#00H,GHG2 MOV VALUE_1,#00H
MOV VALUE_2,#02H AJMP CVCV
MOV VALUE_1,#09H
AJMP CVCV AZX5: MOV A,#60
GHG2: CLR C
DEC VALUE_1 SUBB A,R5
AJMP CVCV JC AZX6
AAQ3:MOV VALUE_2,#03H JZ AAQ6
MOV VALUE_1,#00H MOV R6,VALUE_1
AJMP CVCV CJNE R6,#00H,GHG5
MOV VALUE_2,#05H
AZX3: MOV A,#40 MOV VALUE_1,#09H
CLR C AJMP CVCV
SUBB A,R5 GHG5:

Page 22 of 33
Microcontroller Based Digital Visistor Counter

JC AZX4 DEC VALUE_1


JZ AAQ4 AJMP CVCV
AAQ6:MOV VALUE_2,#06H
MOV VALUE_1,#00H
AZX6: MOV A,#70 AJMP CVCV
CLR C
SUBB A,R5 GHG8:
JC AZX7 DEC VALUE_1
JZ AAQ7 AJMP CVCV
MOV R6,VALUE_1 AAQ9:MOV VALUE_2,#09H
CJNE R6,#00H,GHG6 MOV VALUE_1,#00H
MOV VALUE_2,#06H AJMP CVCV
MOV VALUE_1,#09H
AJMP CVCV AZX9: MOV A,#100
GHG6: CLR C
DEC VALUE_1 SUBB A,R5
AJMP CVCV JC AZX10
AAQ7:MOV VALUE_2,#07H JZ AAQ10
MOV VALUE_1,#00H MOV R6,VALUE_1
AJMP CVCV CJNE R6,#00H,GHG9
MOV VALUE_3,#00H
AZX7: MOV A,#80 MOV VALUE_2,#09H
CLR C MOV VALUE_1,#09H
SUBB A,R5 AJMP CVCV
JC AZX8 GHG9:
JZ AAQ8 DEC VALUE_1
MOV R6,VALUE_1 AJMP CVCV
CJNE R6,#00H,GHG7 AAQ10: MOV VALUE_3,#01H
MOV VALUE_2,#07H MOV VALUE_2,#00H
MOV VALUE_1,#09H MOV VALUE_1,#00H
AJMP CVCV AJMP CVCV
GHG7:
DEC VALUE_1 AZX10: MOV A,COUNTER
AJMP CVCV CLR C
AAQ8:MOV VALUE_2,#08H SUBB A,#100
MOV VALUE_1,#00H JZ AAQQ1
AJMP CVCV JC AZXX1
MOV R5,A
AZX8: MOV A,#90 MOV A,COUNTER
CLR C CJNE A,#199,JKJK
SUBB A,R5 MOV VALUE_3,#01H
JC AZX9 JKJK:
JZ AAQ9 AJMP DOIT1
MOV R6,VALUE_1 AAQQ1: MOV VALUE_3,#02H
CJNE R6,#00H,GHG8 MOV VALUE_2,#00H
MOV VALUE_2,#08H MOV VALUE_1,#00H

Page 23 of 33
Microcontroller Based Digital Visistor Counter

MOV VALUE_1,#09H AJMP CVCV


AJMP CVCV
AZXX1: MOV VALUE_1,#00H
CVCV: MOV VALUE_2,#00H
MOV VALUE_3,#00H
;
&&&&&&&&&&&&&&&&&&&&&& RET
&&&&&&&&&&&&&&&&&&&&&& AS3: CJNE R2,#03H,AS4
CALL DELAY CLR DIS_A
CLR BUZZER CLR DIS_B
JB LDR1,$ CLR DIS_C
AJMP ZAZA CLR DIS_D
CLR DIS_G
SETB DIS_E
; SETB DIS_F
&&&&&&&&&&&&&&&&&&&&&& RET
&&&&&&&&&&&&&&&&&&&&&& AS4: CJNE R2,#04H,AS5
&&&&&&&&&&&& CLR DIS_B
; 7 SEGMENT DISPLAY CLR DIS_C
; CLR DIS_F
&&&&&&&&&&&&&&&&&&&&&& CLR DIS_G
&&&&&&&&&&&&&&&&&&&&&& SETB DIS_A
&&&&&&&&&&&& SETB DIS_D
DISP: SETB DIS_E
MOV R2,SPEED RET
CJNE R2,#00H,AAS1 AS5: CJNE R2,#05H,AS6
CLR DIS_A CLR DIS_A
CLR DIS_B CLR DIS_C
CLR DIS_C CLR DIS_D
CLR DIS_D CLR DIS_F
CLR DIS_E CLR DIS_G
CLR DIS_F SETB DIS_B
SETB DIS_G SETB DIS_E
RET RET
AAS1: CJNE R2,#01H,AS2 AS6: CJNE R2,#06H,AS7
CLR DIS_B CLR DIS_A
CLR DIS_C CLR DIS_C
SETB DIS_A CLR DIS_D
SETB DIS_D CLR DIS_E
SETB DIS_E CLR DIS_F
SETB DIS_F CLR DIS_G
SETB DIS_G SETB DIS_B
RET RET
AS2: CJNE R2,#02H,AS3 AS7: CJNE R2,#07H,AS8
CLR DIS_A CLR DIS_A
CLR DIS_B CLR DIS_B

Page 24 of 33
Microcontroller Based Digital Visistor Counter

CLR DIS_D CLR DIS_C


CLR DIS_E SETB DIS_D
CLR DIS_G SETB DIS_E
SETB DIS_C SETB DIS_F
SETB DIS_F SETB DIS_G
RET
AS8: CJNE R2,#08H,AS9 SETB DIS3
CLR DIS_A CALL DISP
CLR DIS_B AJMP DOWN
CLR DIS_C QA4: MOV COUNT,#01H
CLR DIS_D MOV R4,COUNT
CLR DIS_E AJMP QA1
CLR DIS_F DOWN: MOV TL0,#0FFH
CLR DIS_G ;reload the timer for scanning
RET MOV TH0,#0F2H
AS9: CJNE R2,#09H,AS10 RETI
CLR DIS_A ;
CLR DIS_B &&&&&&&&&&&&&&&&&&&&&&&
CLR DIS_C &&&&&&&&&&&&&&&&&&&&&&&
CLR DIS_D &&&&&&&&&&
CLR DIS_F
CLR DIS_G DELAY:
SETB DIS_E MOV R1,#0FFH
RET RE1: MOV R2,#5FH
AS10: MOV SPEED,#00H RE: NOP
AJMP DISP 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 25 of 33
Microcontroller Based Digital Visistor 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 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

Page 26 of 33
Microcontroller Based Digital Visistor Counter

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 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

Page 27 of 33
Microcontroller Based Digital Visistor Counter

 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

Figure 4.1 PIN Diagram of Timer IC:

Page 28 of 33
Microcontroller Based Digital Visistor Counter

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.

Figure 4.2 Infrared sensor

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

Page 29 of 33
Microcontroller Based Digital Visistor Counter

 High immunity against ambient light


 Continuous data transmission possible (up to 2400 bps)
 Suitable burst length 10 cycles/burst
 Output active low

Page 30 of 33
Microcontroller Based Digital Visistor 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 31 of 33
Microcontroller Based Digital Visistor 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 32 of 33
Microcontroller Based Digital Visistor Counter

Page 33 of 33

You might also like