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
  • atmega16 stopwatch
  • digital clock and stopwatch timer using atmega32
  • c code stopwatch microcontroller
  • Clock with atmega 8
  • coding of digital clock watch using atmegq8

Leave a Comment

You must be logged in to post a comment.

Recent Posts

Battle video game Using Atmega644

Battle video game Using Atmega644

Introduction Our project is a simple game where two players control tanks in a stage with the ultim[...]
Persistent of Vision Display Using Atmega644

Persistent of Vision Display Using Atmega644

Introduction The purpose of this project is to design and to create a persistence of vision (POV) d[...]
Sign language translator Using Atmega644

Sign language translator Using Atmega644

Introduction "A portable Glove Based Sign Language Translator with LCD Display, Speech Synthesi[...]
Evolutionary Altitude Control for a Helicopter Using Atmega644

Evolutionary Altitude Control for a Helicopter Using Atmega644

Overview For our ECE 4760 project, we developed a self learning 1 degree of freedom (DOF) helicopte[...]
Digital Stethoscope Using Atmega644

Digital Stethoscope Using Atmega644

"A digital stethoscope that can amplify, play, and record heart signals in real-time." Project So[...]

Read more:
Next-door leopards: First GPS-collar study reveals how leopards live with people
Close