Homepage von Ingo Klöckl
 Home
 Programmieren
 - Toolbox
 - Java
 - PostScript
 - Perl
 - Assembler
 - - Stopuhr 0V1
 - Links
 - Download
Ingo Klöckl
i.kloeckl@2k-software.de

Stopwatch with microsecond resolution 0V1

Since I was a young boy knowing about physics, I wanted to be able to perform physical experiments to measure physical constants like the gravitational constant. To do so, an exact stopwatch is required which can triggered e.g. by light barriers. So I started to plan varying electronic stopwatches, basing on TTL circuits. None of my first designs survived, but suddenly, I recovered this early hobby and started again by constructing a first version of a stopclock (0V0) with microsecond resolution. This design includes many TTL circuits and requires an external event counter. In my case, I use a data acquisition system which can be connected by USB to a computer. Naturally, I wasn't very happy with this rough design, so I began to play with Atmels micro controllers to create an enhanced version of my first stopwatch. Using an ATMega8 and a GAL, I could finally condense my first stopwatch to a pocket box containing only two chips and a crystal oscillator by widening the stopwatch features. These includes:

  • Microsecond resolution
  • 24 bit counting range, that means time intervals from 0.000 001 s to 16.100 000 s can be measured
  • No external counter or display is required any longer, a multiplexed 8-digit 7-segment display is part of the stopwatch
  • Three different trigger modes: start/stop with two separate signals (one pulse each), start/stop by one single signal line (two subsequent pulses), and level-based
Before the schematic and more details, a small gallery shall demonstrate the final device:

The hardware

The central counter/display controller

The hardware consists of a ATMega8 micro controller,labeled 2K1190 in the schematic, which contains a 24 bit counter for time interval measurement. Furthermore, it converts the 24 bit result into 8 digit decimal representations and display this on a multiplexed 8-digit 7-segment display.
The firmware of the controller is written in assembler and available as a HEX file. Please note that the controller is not dedicated to this stopwatch, but to any application which requires a 24 bit counter/display multiplexer. So you might use this for your own application! A detailled description of the component can be found here.

The input logic

The GAL contains all gating and mode switching logic. I implemented this logic by hardware to gain fast reactivity to the input signals. A micro controller could have a latency in the magnitude of some clock cycles.
The internal circuitry of the GAL (the component labeled 2K1002 in the schematic) is shown in this schematic. In fact, the GAL is not really necessary and can easily be replaced by some TTL chips, but it saves a lot of space and TTL circuits. If you have access to a GAL-burning device, you might want to use this Jedec fuse map file. A detailled description of the component can be found here.

Fitting all together

The wiring of the complete device is shown in this schematic. The schematic does not display the power supply, which is a regular stabilized 5 V power supply, using a 7805. The two connectors J1 and J2 are not necessary; I use them to attach extensions to the basic stopwatch.
If the device is build correctly, the 7-segment display should not be attached directly to the controller, but by means of a driver transistor for the common anode lines. I have saved these, noting that the ATMega8 can drive them directly - at least over the time I have watched it, that is some weeks :) To be sure no overload takes place, you should use the transistors.

Extensions

I have added an extension to the basic stopwatch, allowing you to measure one single pulse in a series of multiple pulses, i.e. of a clock generator.