Setting up a timer

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

cross mob
Anonymous
Not applicable

Hello:

   

I'm working on a project and I'm a little new with PSoCs.  I would like to know how to set up a timer to hold a signal ON for 30 seconds.  In my application, I would like to push an activation button and provide a 5V signal for 30 seconds and then turn it off.  Also, I would like to have an Override button that will turn OFF the process at any time.  Any help would be greatly appreciated!!  I've provided the code I'm working with so far.

   

   

while

       

   

(1) // Run the loop forever

   

   

{

   

{

 

   

   

if ((PRT1DR & 0x01) == 0x01) // Is Bit 0 high? (Manual Override)

   

{

   

PRT2DR =

    0x01    ;     // Output this value   

}

 

 

    else        if    ((PRT1DR &     0x02    ) ==     0x02    )     // Is Bit 1 high? (Activation Button)   

{

PRT2DR =

    0x02    ;     // Output this value   

}

 

 

    else   

{

PRT2DR =

    0x00    ;     // Output this value   

}

   

}

0 Likes
0 Replies