EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / algo for bidirectional visitor counter

algo for bidirectional visitor counter

|

Microcontroller › 8051 › Please give me c coding for bidirectional visitor counter using AT89C52 › algo for bidirectional visitor counter

February 22, 2011 at 6:50 am #5572
dagakshay
Participant

here i am writing the algo code it by yourself

 

i assumed

the RX1 is inside the room and rx2 is out side the room….

 

the variable for the number of came person inside a room is total_in

similarly the number of person outside the room is total_out

and the number of person present in side is present_in = total_in – total_out;

 

let the sensors are connected to port1

Rx1 to P1.0

Rx2 to P1.1

rest of the pins are high

when any one comes inside the room first out sensor will sens the person and the inside one

similarly when any one goes out side from room the inside sensor will sense the person first then the out side one

the sensors are active low o/p

 

algo:

while(1)

{

while(P1= 0 0xff)

if(P1_0= =0) // inside sensor ; person is going out

  {  

  while(P1_1 = = 1);

  total_out++;

  delay_1s( );

  } 

 

else if(P1_1= =0) // outside sensor ; person is comming inside

  {  

  while(P1_0 = = 1);

  total_in++;

  delay_1s( );

  } 

 

present_in = total_in – total_out;

 

display(present_in);

}

 

 

 

 

 

RSS Recent Posts

  • Some opamp advice please April 12, 2026
  • isolating S-params in of PCB board without connectors April 11, 2026
  • want help with microprocessor April 11, 2026
  • Voltage comparator circuit verification April 11, 2026
  • Integrating 0–5V ECU Signals into a Double-DIN Setup – Module vs Custom Head Unit? April 11, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise