The digital clock that we are going to make operates at frequency 4MHz and is programmed using interrupt. It has two buttons as in wrist watches. One of toggling between the hour minute and second value and the other for changing those values.
The PORTC pins have been used as control pins which is used to select which segment will display which data. The PORTD pins have been used as segment data pins which instructs the segment which data to display.
Circuit diagram for digital clock is given below:
Code :
C code for digital clock written in WINAVR
Explanation:
- The program has been written making use of interrupt. The MCU is clocked at 1Mhz.
- sei() enables global interrupt.
- Pulling cs10,cs11 high sets prescaler to 64. This means that the clock counts 1Mhz/64 times ie.
- 15625 times in 1second.
- Pulling wgm 12 high sets CTC mode (clear timer on compare). It sets the count to 0 as the set count OCR1A is reached.
- As OCR1A value is reached, ISR(interrupt service routine) is called.
Video Link:
sir which is the 7 segment display using here??
ReplyDeletecommon anode or common cathode??
common cathode
ReplyDelete