Follow-up stopwatch with digital display
We don’t want to withhold from you how it went on with the stopwatch board from one of the last posts.
As a reminder: We have realized a stopwatch with 7-segment digital display for a customer in the field of special machine construction. The central component of the board is an AVR ATmega32 microcontroller, which now had to be programmed.
In the meantime the assembled boards have arrived. We think they look great. But see for yourself:
We have programmed the firmware for the microcontroller in C. As we have a soft spot for successful OpenSource projects, we like to acknowledge the great achievements of OpenSource communities by using open source tools in our daily work. Therefore we used the editor Geany under Debian Linux and the AVR-GCC toolchain for the AVR microcontrollers, consisting of the C-library avr-libc, the C-compiler AVR-GCC and the ISP-programmer AVRDUDE on command line basis.
Testing the board
After making sure that the circuit boards are electrically OK and that the built-in switching regulator provides a clean supply voltage for the microcontroller, we could continue. Setting the necessary fuses for the ATmega32 worked without problems. It was thus clear that the ISP interface was also working properly. We were then able to verify that the oscillating quartz delivers a proper clock rate. Great – so nothing stood in the way of flashing, testing and debugging the firmware.
The source code
For the source code, we deliberately paid attention to a modular, clear program structure and bundled all important processes into functions with simple, clear responsibilities. This has proven to be very advantageous. Already the first compilation ran smoothly without any errors. And we didn’t have to do much debugging. Within a few hours after the first compilation process we had reached our goal: the stopwatch worked as the customer requested.
The clock can be started, stopped and reset via a central control input. It counts up every second and automatically resets to 00:00 after reaching 59:59.
Conclusion – it was a lot of fun! Finally, a few impressions of the programming work: