Object Counter Using 8051 Microcontroller
Object Counter Using 8051 Microcontroller
in 8051 PROJECTS
This article is about a simple object counter/visitor counter using 8051 microcontroller
. AT89S51 belonging to the 8051 family is the microcontroller used here. This circuit
can count the number of objects passing across a line , number of persons passing
through a gate/door and so on. The can be simply divided into two sections i.e. the
sensor section and the display section.
Sensor.
The sensor part consists of a ultra bright led (with focus), and LDR, opamp LM324 and
the associated passive components. The LED is placed on one side of the door and the
LDR is placed on the other side so that the light from the LED falls directly on the x
LEARN MORE
LEARN MORE
LDR.As you know, the resistance of the LDR has an inverse relationship with the
mersenfuses.net
intensity of the light falling on it. The preset resistor R14 is so adjusted that the
24/7
voltageCustomer Service
across the LDR is below 1.5V when it is illuminated. This voltage (labelled A in x
the circuit diagram) is connected to the inverting input of the opamp which is wired as
a comparator with reference voltage 1.5V (set using R15 and R16).Capacitor C1 is
meant for bypassing noise or anything like that which may cause false
triggering.Resistor R13 is meant to control the current through the LED.
When the light is falling on the LDR the voltage across it will be less than the reference
voltage and so the output of the opamp remains high. When the light beam is
interrupted, the voltage across the LDR goes above the reference voltage and so the
opamp output goes low and it indicates a pass.
Display section.
The output of the opamp is fed to the INTO (interrupt 0) pin of the microcontroller. The
microcontroller is programmed to count the number of negative edge pulses received
at the INT0 pin and displays it on the three digit seven segment display.
Circuit diagram.
Object counter using 8051
Program.
ORG 000H
SJMP INIT
ORG 003H // starting address of interrupt service routine (ISR)
ACALL ISR // calls interrupt service routine
RETI
INIT: MOV P0,#00000000B
MOV P3,#11111111B
MOV P1,#00000000B
MOV R6,#00000000B
MOV DPTR,#LUT
SETB IP.0 // sets highest priority for the interrupt INT0
SETB TCON.0 // interrupt generated by a falling edge signal at INT
SETB IE.0 //enables the external interrupt
SETB IE.7 //enables the global interrupt control
MAIN: MOV A,R6
MOV B,#100D
DIV AB
ACALL DISPLAY
ACALL DISPLAY
SETB P1.0
ACALL DELAY
ACALL DELAY
MOV A,B
MOV B,#10D
DIV AB
ACALL DISPLAY
CLR P1.0
SETB P1.1
ACALL DELAY
ACALL DELAY
MOV A,B
ACALL DISPLAY
CLR P1.1
SETB P1.2
ACALL DELAY
ACALL DELAY
CLR P1.2
SJMP MAIN
ISR: INC R6 //interrupt service routine
RET
DISPLAY: MOVC A,@A+DPTR // display sub routine
CPL A
MOV P0,A
RET
DELAY: MOV R3,#255D // 1mS delay
LABEL: DJNZ R3,LABEL
RET
LUT: DB 3FH
DB 06H
DB 5BH
DB 5BH
DB 4FH
DB 66H
DB 6DH
DB 7DH
DB 07H
DB 7FH
DB 6FH
END
The program is written so that, it keeps displaying the current value in register R6 on
the three digit seven segment display. When ever there is a valid negative going pulse
(interrupt) at the INT0 pin, the program branches to the interrupt service routine (sub
routine ISR). Subroutine ISR increments the value in register R6, then jumps back to
the MAIN loop and the display gets updated by the new value.
Notes.
LDR must be placed in an enclosure so that the light from LED alone falls on it.
OBJECT COUNTER USING 8051 VISITOR COUNTER USING 8051
AUTHOR
admin
RELATED POSTS
27 COMMENTS
Zeenath
3 YEARS AGO
I used IR sensors and my project is automatically counting with any objects when power is given can u
tell me the possible errors
faiz
5 YEARS AGO
faiz
5 YEARS AGO
sharnitha
5 YEARS AGO
Sajor Barrie
5 YEARS AGO
can anyone please explain the circuit diagram briefly say the functions of the components used
especially the resistors. will be very grateful. regards
Sajor Barrie
5 YEARS AGO
hello helper. please i want to know the speci몭c componenets to be used say for example the 7-segment
display type and also the type of programming language used.regards
Umang khatri
5 YEARS AGO
newton
3 YEARS AGO
if you remove the connections from pin 9 , then where did you connect the reset button ?
Shivam
3 YEARS AGO
vikrant
6 YEARS AGO
6 YEARS AGO
HAMZA
6 YEARS AGO
manju
6 YEARS AGO
sagar khandale
6 YEARS AGO
omkar
6 YEARS AGO
mithun
6 YEARS AGO
it was good
sir plz tell me which 7 segment display can i use in the project common anode or common cathode
riddhi
7 YEARS AGO
Ankit DHall
7 YEARS AGO
What type of 7 segment display is used? Please tell asap. I really need it.
Ankit
7 YEARS AGO
Can anyone please send a report on this circuit if they have made?
Waqar Ahmad
7 YEARS AGO
really?? how can you do that? please i need your help for my 몭nal year project. i you can reply my
amail as soon as posibble, really2 appriciate it. thanks
antony
5 YEARS AGO
ratnesh thepade
7 YEARS AGO
its not working….. comparator is not changing its state from low to high or from high to low.. please
help… as soon as possible..
Kornell Azih
8 YEARS AGO
I am relatively new in programming, what type compiler did you use for the writing of this program,
because I tried to build it with mide-51 ut gave ne 9 errors?
shegzzyy
8 YEARS AGO
Dear sir,
Its an interesting circuit to put in practice thanks for that, but I would like to understand how the
programming is done and to load it. Also to learn how to program it, so that we can create our own.
Thanks And regards
Safoor
ABOUT US
CircuitsToday.com is an effort to provide free resources on electronics for electronic students and
hobbyists. Our webiste has thousands of circuits, projects and other information you that will 몭nd
interesting.
ARDUINO COURSE
CATEGORIES
101-Announcements (29)
8051 (26)
Arduino (81)
ARM (3)
AVR (23)
Counters (2)
Drones (1)
Events
Events (3)
Guides (15)
History (26)
Infographics (1)
Instruments (13)
Inverters (5)
MATLAB (3)
Microcontrollers (12)
Nanotechnology (14)
Oscillators (25)
PCB (5)
Projects (12)
Proteus (16)
Raspberry Pi (4)
Relays (3)
Reviews (8)
Robotics (7)
RTOS (2)
Transmitters (7)
Tutorials (163)
UPS
UPS (2)
Videos (5)
VLSI (36)
OTHER LINKS
About
Authors
Advertise With Us
Write For Us
Disclaimer
Privacy Policy
report this ad
© 2020 CircuitsToday
Top