ATMega16 AVR Microcontroller Seven Segment Digital Clock
The ATMega16 Seven Segment Digital Clock
In this ATMega16 AVR project we will be designing and implementing a digital clock with the aid of a Atmel AVR ATMega16 microcontroller and Seven Segment Displays. As such before going through this digital clock AVR project it is recommended to complete the tutorial on Interfacing a Seven Segment Display with the AVR Microcontroller.
Note: Although this AVR project was designed around the ATMega16 the project could have utilized another microcontroller such as an ATMega32, ATMega8515, etc.
ATMega16 Digital Clock Operation
Our digital clock operates as follows. When the circuit is powered up the clock starts at “00:00:00” for “HH:MM:SS”. There are two push-button switches used to set the time. Switch SW1 is for setting the minutes, when this button is pressed the minutes in increase until it reaches 59 then reset and start counting from 0. Switch SW2 is for setting the hours.
ATMega16 Digital Clock Hardware Description
The figure below gives the circuit diagram for the ATmega16 Seven Segment Display Digital Clock. One feature to note in that all seven segment displays are driven by the same port (PortB). The microcontroller through controls from PortC indicate which seven segment display each digit is displayed on. Note that these Seven Segment Displays are common cathode display.
Important Note: In order for our digital clock to work correctly the internal oscillator of the ATMega16 AVR microcontroller must be enabled and set to 4MHz.
ATMega16 Digital Clock Software
Below is the AVR C implementation of the entire code for the ATMega16 based digital clock. The code was implemented and built using AVR Studio 5. Be reminded that the internal clock of the ATMega16 microcontroller should be enabled and programmed to operate at 4MHz for the AVR C code to operate correctly. A video of the digital clock in operation is presented at the end of this page.
Please see the Interfacing a Seven Segment Display with the AVR Microcontroller tutorial for more information on the seven segment display.
For more detail: ATMega16 AVR Microcontroller Seven Segment Digital Clock
Leave a Comment
You must be logged in to post a comment.