One input to control TWO Outputs with timer

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.
EyLa_1625036
Level 3
Level 3
10 likes given 10 sign-ins 25 replies posted

Hello all ,

i have a custom PCB with PSOC4 on it ,

i have 1 input pin controlled by a switch (switchPIN),

i have 2 outputs pins (resetPin , onoff_Pin),

i need to implement the following logic :

starting state is switchPIN=1 in that case turn on onoff_Pin-->1,

if someone turn the switch off switchPIN=0 and 6 sec is passed then turn off onoff_Pin-->0,

but if someone turn the switch off switchPIN=0

and BEFORE 6 sec is passed he turns on the switch switchPIN=1

then send reset pulse (resetPin =1 wait 100ms then resetPin =0).

this simple logic is driving me crazy, i have tried using 2 timers with isr on

the switchPIN (one is 6 sec timer , and one is a fast timer),

i just can figured out a way to do it .

can someone direct me to a simple solution to this problem ????

I have attached a flow chart of what i want to achive .

Thanks in advanced.

psoc_logic.png

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I tried by myself with CY8CKIT-044.

001-State_table.JPG

It seems working, although not quite tested

000-TeraTermLog.JPG

Hope this can be a little help for you.

moto

View solution in original post

0 Likes
3 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

elampel,

Take a look at the custom component ButtonSw32, which debounces and process button press/release events.

ButtonSw32: button switch debouncer component

In the Application Note you will find a "Button long press demo" project, which is close to what you want. You would have to update clock source for PSoC4 (see e.g. WDT timer examples).

/odissey1

pastedImage_0.png

0 Likes
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I tried by myself with CY8CKIT-044.

001-State_table.JPG

It seems working, although not quite tested

000-TeraTermLog.JPG

Hope this can be a little help for you.

moto

0 Likes

Thank you !

Your code is very clear , and the comments helps a lot .

Very nice implementation !

seems to work.

0 Likes