Countdown timer using 8051 microcontroller (AT89C51)

Group all Htabs

Description

Developed By:

Himanshu Choudhary

A countdown timer is a down counter that counts from a specified time to 00:00. It is used in many devices such as washing machine, televisions, microwave ovens, etc. This countdown timer has three states: the running state where it counts down, the pause state where it displays the paused time and the reset state to set the countdown. The countdown is displayed on a set of four seven segment displays using the 8051 microcontroller (AT89C51). A buzzer sounds when the countdown gets over.

The countdown timer keeps the track of time the same way as a simple digital clock does. The control options are provided by means of tactile switches which are active low. This circuit uses five such switches for following operations:

Switch 1 (S1) : Reset (to initiate the timer set option)

Switch 2 (S2) : Select (to select the segment where value is to be changed)

Switch 3 (S3) : Increment (to increase the value at selected segment)

Switch 4 (S4) : Start (to start the timer with the set time)

Switch 5 (S5) : Pause (to hold the time)

As soon as the Vcc supply is provided to the circuit, the timer goes in reset mode with 00:00 display state on seven segments. The segment to be set can then be selected in cyclic order each time S2 is pressed. After selecting the desired segment, its value can be changed by using S3. Once the digits and hence the time is set, S4 is pressed to start the countdown. The countdown can be held in between by using S5. If S5 is not pressed, the time runs until the 00:00 state is reached. At this instant, a buzzer connected to the microcontroller AT89C51 gets activated and produces sound to indicate that the countdown is over. To bring the timer back in reset mode, i.e., to set the countdown again, S1 needs to be pressed.

The seven segments are interfaced to port P2 of the microcontroller through its data pins (a - h). The enable pins are connected to pins 1-4 of port P1 (P1^0 – P1^3) of the microcontroller AT89C51. The switches S1-S5 and buzzer are connected as following:

S1 : P1^7 S4 : P1^6

S2 : P1^4 S5 : P3^3

S3 : P1^5 Buzzer : P3^7

The buzzer is connected to the output pin of microcontroller at the negative end and to Vcc at the positive end.