Power Toggle Button

Discussion of the PSoC Creator Integrated Development Environment for PSoC3 & PSoC5 devices.

Moderator: ericb

Power Toggle Button

Postby jefft » Tue Nov 19, 2013 2:04 pm

Hi Everyone,

I'm fairly new to the PSoC creator. I'm working with the PSoC 5LP develeopment kit. Attached to this message is my project I am working on to use a switch to turn on a LED but to also use that same switch to turn off the LED and turn on another after holding that LED for 4 seconds. I set up a design that I'm most confident will work, with a debouncer to a counter.

The issue I am having is with the main.c that I am building. If I use the debouncer sperately I can toggle the LED on and off with the switch easily, but with the counter connected I seem to lose this capability. Also i cannot seem to get the other LED to turn on after 4 seconds. PLS HELP.
Attachments
Power toggle.jpg
jefft
Newbie
Newbie
 
Posts: 8
Joined: Tue Nov 19, 2013 1:29 pm

Re: Power Toggle Button

Postby danadak » Tue Nov 19, 2013 6:02 pm

Create an archive under the file menu and post so the forum
can look at your code and configuration.

Regards, Dana.
Field Application Engineer
KB1RHB Mostly listen :)
Semi Retired
User avatar
danadak
The Big Cheese
The Big Cheese
 
Posts: 2008
Joined: Thu Dec 27, 2007 8:42 am
Location: New Hampshire

Re: Power Toggle Button

Postby bobmarlowe » Wed Nov 20, 2013 12:19 am

You need different clocks for de-bouncer and counter. The counter clock must be (at least) twice the count frequency, enable of the counter could be set high.
You do not have any mechanism built-in to count the time.

I would suggest to:
Setup a timer generating an interrupt at 10 to 100 Hz
Debounce clock about 10 times the timer.
Check the debounced button when timer expires. React on button changes accordingly


Bob
User avatar
bobmarlowe
The Big Cheese
The Big Cheese
 
Posts: 1490
Joined: Thu Oct 06, 2011 2:03 am
Location: Germany


Return to “%s” PSoC Creator (PSoC3 & PSoC5 IDE)

Who is online

Users browsing this forum: No registered users and 1 guest

cron