Pausing a STM32 TIMER
Hi,
I am using the STM32F401RE microcontroller to control 4 seven segment displays which together represent a countdown timer.
In order to control the displays I am multiplexing and therefore using the general purpose TIMER 2 in interrupt mode for a fast refresh rate.
My challenge right now is i want to be able to pause the time. That is,when i press a button the countdown timer should be interrupted and stops counting down (7 segement displays still showing the time, only pause) and when pressed again, it should continue from where it stopped. For this to happen, the TIMER 2 should still be enabled, but not counting, or so goes my idea.
So I thought if I reset CEN bit in CR1 register (that is disable the counter) of TIMER 2 , it should pause the time. and set it again to continue the time.
When i try this, what happens is the TIMER 2 does gets paused but then only one of the displays stay on and this happens because the TIMER 2 is no longer able to do the multiplexing and fast refresh rate.
So my question is, is there a way to pause the TIMER 2 or pause the counter of TIMER 2 and still does multiplexing and fast refresh.
Now i think of this, i feel its stupid because if the counter is disabled, then of course TIMER 2 wont keep refreshing or am I wrong?
Any suggestion on how to achieve this will be greatly appreciated.:smiling_face_with_smiling_eyes:
P.S : I did not paste any code because i thought it unnecessary. If some code is needed, please let me know.
