This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TM4C123GH6PM: Alarm Clock Project

Part Number: TM4C123GH6PM


Tool/software: TI C/C++ Compiler

Hi everyone, 

I am currently working on an alarm clock project that requires me to use a 7 segment display with 4 digits on it. I was wondering what the best way to implement this would be? In order for me to get all four digits to display, I have it connected to PE0-PE3, one for each digit. The 7 segments are connected to PB0-PB6. Having it increment manually with a switch works, however, I cannot get it to automatically count in accordance to time. My question is: how would I go about implementing this so that it automatically counts as well as display the time continuously. When I add a second delay, it would create such a large delay on the LEDs causing each digit to display one at a time. In addition, what is the best way to go about having my clock count in accordance to seconds, because using SysCtlDelay I feel would be too much room for error.

Thanks for your help, I appreciate it.

Board: TM4C123GH6PM

Language: C

  • Hi,
    Here is one article about driving a 7-segment display. www.circuitbasics.com/.../

    I will suggest you look into using Timer module to create your delay. I guess there are multiple ways to do this. One idea is to setup 4 timer modules. For example, the first timer will generate an timeout interrupt every 1ms. In this timer ISR, you will do your BCD to 7 segment decode and update the 7-segment display of the least significant digit. The second timer will be setup to generate an timeout interrupt every 10ms. The second timer ISR will control the 2nd least significant digit. Likewise, you will do the same to setup the third timer for 100ms timeout and the fourth timer for 1s timeout for the other two digits. Make sure you synchronize the 4 timers together. This is like a stop watch that can count up to 10s with a precision down to 1/1000th of a second. You can configure the timers for your desired delay. We don't have any ready to use examples as such. I think you can be creative to build your own. Share with us your project that may benefit the community.