You are here

Count time after pushing button | Cypress Semiconductor

Count time after pushing button

Summary: 1 Reply, Latest post by Bob Marlowe on 05 Jul 2016 04:41 AM PDT
Verified Answers: 1
Last post
Log in to post new comments.
asier_1604701's picture
19 posts


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 !!

user_1377889's picture
9273 posts

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.



Log in to post new comments.