Digital Stop Watch with ATmega8 using microcontroller

Nov 13, 2012 by


Hello Friends,

In this tutorial we will make a “Digital Stop Watch” using an AVR ATmega8 Microcontroller. This will help you learn many concepts like

  1. Multiplexed Seven Segment Display Interfacing
  2. Using AVR Timers
  3. Using Interrupts
  4. And many others too.

The code is written in C language for avr-gcc (WinAVR) .

Digital Stop Watch Digital Stop Watch with ATmega8 using microcontroller

Steps to Build the “Digital Stop Watch” using AVR ATmega8 MCU

  1. Make the circuit according to the schematic on general purpose PCB or a BreadBoard.
  2. Make a project in AVR Studio and add a new file to the project. Copy/paste the “c” code. Set optimization as “o2″ and CPU frequency as 16000000Hz. Save and Build the project. You will get a HEX file.
  3. Burn this HEX file to an ATmega8 MCU using a tool such as eXtreme Burner AVR.
  4. Set High Fuse = C9(Hex) Low Fuse = FF(Hex). How to do this depends on you programmer software.

I have use a xBoard MINI development board for fast and easy prototyping. The Displays+Transistors+Key are on the Veroboard while the Core CPU unit + power supply is in the xBoard MINI. It can be programmed “In System” over USB Port using eXtreme Burner – AVR software toolkit.

How to Use the “Digital Stop Watch”

When initially powered up the Stop watch is in “STOP” condition. This is indicated by a blinking display. The count is 00:00 initially. Press “START” to start the watch. The blinking will now stop and the display will be fully on. It will start counting and MIN:SEC is displayed. The stop watch can be halted at any time by pressing “HALT” key. In halt state the counting freezes and the display starts blinking. You can press “START’ key again to resume counting from there. The “RESET” key is used to reset the clock to 00:00 i.e. 0 minute and 0 sec.

Digital Stop Watch Schematic

Digital Stop Watch Schematic Digital Stop Watch with ATmega8 using microcontroller

Digital Stop Watch C Source Code.

 /*
  Description:
 An AVR ATmega8 based Digital Stop Watch
   Project.
  ________________________________________________________
   */ 
#include <avr/io.h>  
#include <avr/interrupt.h>  
#include <util/delay_basic.h>  
#define true 1 #define false 0  
#define SEVEN_SEGMENT_PORT PORTD  
#define SEVEN_SEGMENT_DDR DDRD   
volatile uint8_t digits[4];   
//Global variable for the clock system   
volatile unsigned int clock_millisecond=0;   
volatile unsigned char clock_second=0;   
volatile unsigned char clock_minute=0;   
volatile unsigned char clock_hour=0;   
//Display hiding system   
uint8_t hide_display = false;   
//Blinking system   
uint8_t blink_display = true; 

For more detail: Digital Stop Watch with ATmega8 using microcontroller 

This free embedded project also found using:

  • digital stopwatch circuit diagram
  • atmega8 digital clock
  • stopwatch
  • stop watch
  • stopwatch using atmega 16
  • atmega8 microcontroller small projects

Leave a Comment

You must be logged in to post a comment.

Read more:
Motorola emphasizes design in circular smartwatch
Close