AUTOMATIC VISITOR COUNTER
In this circuit, two infrared (IR) sensor modules are used each for up and down counting, respectively. Whenever an interruption is observed by the first IR sensor, it increments the counter value. Similarly, when the second sensor detects an obstacle, the count is decremented.
The count value is calculated depending upon the sensors’ input and is displayed on a set of four seven segment displays by using the concept of multiplexing (for concept of multiplexing refer seven segment multiplexing). The data pins of each 7-segment display are connected to port P2 of the microcontroller P89V51RD2 The first four pins of port P1 (P1^0-P1^3) are connected to control pins to enable a particular 7-segment. P1^5 & P1^6 are configured as input pins at which the sensors are connected. The sensor inputs are defined as up and down selector modes for the counter in the code. Each time the first sensor is blocked, it gives a high signal at P1^5 and the count value gets incremented. The value gets decremented when P1^6, connected to second sensor, gives high input. At each step, the value of the counter is sent to be displayed on the segments.
COMMON ANODE AND COMMON CATHODE
In a CA display, the anodes for the seven segments and the decimal point are joined into a single circuit node. To illuminate a segment in a CA display, the voltage on a cathode must be at a suitably lower voltage (about .7V) than the anode. In a CC display, the cathodes are joined together, and the segments are illuminated by briging the anode voltage higher than the cathode node (again, by about .7V). The Digi lab board uses CA displays. The seven LEDs in each digit are labelled a-g. Since the Digilab board uses CA displays, the anodes for each of the four digits are connected in a common node, so that four separate anode circuit nodes exist (one per digit). Similar cathode leads from each digit have also been tied together to form seven common circuit nodes, so that one node exists for each segment type. These four anode and seven cathode circuit nodes are available at the J2 connector pins labelled A1-A4 and CA-CG. With this scheme, any segment of any digit can be driven individually. For example, to illuminate segments b and c in the second digit, the b and c cathode nodes would be brought to a suitable low voltage (by connecting the corresponding circuit node available at the J2 connector to ground), and anode 2 would be brought to a suitable high voltage (by connecting the corresponding circuit node available at the J2 connector to Vdd).