To provide various options in the digital clock, following switches are used:
Switch 1 (S1) : Reset (to initiate the time 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 clock with the set time options)
Switch 5 (S5) : Alarm (to initiate the alarm set option)
The option to set alarm is provided by providing an extra switch S5, with the microcontoller At89C51, which is made active low. Whenever S5 is pressed, the time display goes off and only 1st segment is activated. But the clock time still runs in the background. In this mode, a segment can be selected in cyclic order by pressing S2. After selecting the desired segment, its value can be changed by using S3. Once the digits and hence the alarm is set, S4 is pressed to start the clock again. As soon as the set alarm time is reached, a buzzer gets signal from the microcontroller thus producing sound.
The seven segments are interfaced to port P2 of the microcontroller AT89C51 through its data pins (a – h). The enable pins are connected to pins 1-4 of port P1 (P1^0 – P1^3). The switches S1-S5 and buzzer are connected as following:
S1 : P1^4 S4 : P3^3
S2 : P1^6 S5 : P1^5
S3 : P1^7 Buzzer : P3^7
The buzzer is connected to the output pin of microcontroller at the negative end and to Vcc at the positive end.
Project Source Code
Filed Under: Electronic Projects