How to configure button / timer for 2 sec and 5 sec interrupt in PSOC3

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hello Everyone,

   

 

   

I am started working on the PSOSC 3 EVB i would like to configure timer for 2sec and 5 sec interrupt (button press detection) so i cant able to execute both logic in an simple way so i request can anyone provide me some suggestions or ideas or examples how to configure the timer to detect the button pressed for 2 sec follwed by the interrupt exection and then 5 sec button press followed by timer interrupt  execution any hlep will be greatly aprreciated

   

 

   

Thank you

   

prabhu

   

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Program a state machine in HandleSwitch as

   

static uint SwitchState = 0;

   

    switch(++SwitchState)

   

    {

   

    case 1: Dothis();

   

        break;

   

    case 2: DoThat()

   

        break;

   

   case 3: DoNothing();

   

        SwitchState = 0;   // Begin new cycle

   

    default:

   

        SwitchState = 0;    //  Recover from unknown state

   

    }

   

 

   

 

   

Bob

View solution in original post

0 Likes
19 Replies