Up down counter using 8051 microcontroller (AT89C51)

Group all Htabs

Description

Developed By:

Himanshu Choudhary

This article shows an easy to build up down counter. The counter is based around the 8051 microcontroller (AT89C51). Two switches are provided, one for increment and second for decrement. The switches can also be replaced by sensors to increment or decrement.

In this circuit, four seven segment display are used to show the value of count. The maximum value of count is 9999. The circuit uses the concept of multiplexing of seven segment to display the value of count. For more details on seven segment multiplexing, refer article titled “Seven segment multiplexing”.

In this circuit data output for the seven segment is given on the port P2 of the microcontroller AT89C51. The control signals for enabling the seven segment displays are given on pin no. 1,2,3,4 of microcontroller. The input of switches is taken on pin number P3.5 and P3.6. Switch connected on pin P3.5 is the increment switch and that at pin P3.6 is the decrement switch. The seven segment used here are common anode.

Whenever the increment switch is pressed the counter increments by one and when the decrement switch is pressed it gets reduced by one. The inputs of the microcontroller are made positive edge triggered by using a capacitor and resistor as shown in the circuit diagram. This helps in removing the problem of counting more than one on a single press of a switch. The value of the counter is displayed using the concept of seven segment multiplexing.