Digital Stop Watch with ATmega8 using microcontroller
In this tutorial we will make a “Digital Stop Watch” using an AVR ATmega8 Microcontroller. This will help you learn many concepts like
- Multiplexed Seven Segment Display Interfacing
- Using AVR Timers
- Using Interrupts
- And many others too.
The code is written in C language for avr-gcc (WinAVR) .
Steps to Build the “Digital Stop Watch” using AVR ATmega8 MCU
- Make the circuit according to the schematic on general purpose PCB or a BreadBoard.
- 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.
- Burn this HEX file to an ATmega8 MCU using a tool such as eXtreme Burner AVR.
- 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 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; //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 with lcd in avr c
- تایمر avr
- digital watch - atmega8
- atmega8 stopwatch