I want to count 2 minutes after I push a button. I do it that way:
- I'm always checking the state of the button on the main loop, so that if it gets pressed I do "Timer_1_Start();".
- Timer1 is configured (Trigger mode none, Capture mode none, Enable mode Software only and Run mode Continouos).
- In the "tc" output of the Timer1 I connect a Interrupt component "isr_1", so that when timer1 is time out I do "Timer_1_Stop();" and other tasks.
Is there anyway to do this simplest ? Maybe configuring One shot Run mode on Timer1 ?
Thank you !!
The one shot needs a hardware reset signal to run again, so your solution is probably the simplest.
Only thing I can imagine is to set up an interrupt for the button's pin to avoid polling the button state.