Pushbuttons Cy8CKIT-050

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

cross mob
JiGi_284761
Level 4
Level 4
Welcome!
        Hi. I got a CY8CKIT-050. I ran thru a few programs. LCD character, segment, ADC. No problem. However I seem to be having problems with the digital input pins for the push buttons. I set up a control register to control a LED and have no roblem getting that to change state. I connected a interrupt to the digital input pin and have no trouble activating the interrupt by incerting a not logic between the input pin and the interrupt. The input is set for resistive pull up and a initial "1" state. Ive tried playing with the states and still have no luck with the input pin. Any Ideas? Im using the built in pin P15_5.   
0 Likes
11 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Will you please post your complete project, there might be settings that hinder your interrupt to be raised.

   

Use "File -> Create Workspace Bundle(minimal)" and upload the resulting archive (DO NOT use chrome, does not work)

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
JiGi_284761
Level 4
Level 4
Welcome!
        Here is the file. Pushing one button should turn the LED on and the other turn it off. By the way. Why is there a little tiny window for messages??   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Regarding Project: The interrupt type is "Derived" which is used for fixed-function blocks. Use "rising edge" here.

   

You do not need to use a control register, you may remove the "Hardware Connection" check un a pin and write directly wit Pinname_Write().

   

 

   

Regarding the "Small Window": Turn on "Compatibility Mode" in IE.

   

 

   

Happy coding

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

For simple projects, turning on led, your approach OK. But mechanical switches,

   

relays, etc.. have a nasty habit of bouncing on contact and release. So consider

   

using the glitch component when handling this problem.

   

 

   

Regards, Dana

   

 

   

0 Likes
JiGi_284761
Level 4
Level 4
Welcome!

Thanks folks.

   

I had it all configured with logic and a debouncer. But to make it simple I removed all but the basic.

   

However I think the board is no good. Nothing seems to generate a signal from the pushbuttons.

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

We did not have a case like you describe in the forum yet. *ALL* boards have been working and there was initially a self-test programmed into which you may reload and run again.

   

How did you confirm that no interrupt is generated? By LED not working or did you set a breakpoint in the interrupt handler?

   

Did you correctly support the required external connections to the LEDs?

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Do a quick test with a DVM to see if button is pulling pin to ground.

   

 

   

Regards, Dana.

   

 

   

0 Likes
JiGi_284761
Level 4
Level 4
Welcome!

Already checked the buttons.

   

The soldering around the cpu looks very dry and un flowed on the side with the IO im using. Ill going to reflow it and see what happens.

   

Bob. I can generate a interrupt and light the LED by inserting a not condition between the pin and the interrupt..

   

Thanks for the HW tip.

   

Im not the best programmer. But not the worse either. 😄

   

Is there a setting to prevent the IDE from erasing user code?

   

 Jim

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

Well, when you invert the pin-signal with a NOT-gate there will be a rising edge that triggers the interrupt, quite o.k.

   

I always use the CY_ISR_PROTO() and CY_ISR() macros (all described in the "System Reference Guide" accessable from help menu) and the API isr_StartEx(). So I keep the interrupts in my own files and not within the generated sources which might be overwritten by accident.

   

Nobody questioned your programming skills and style (yet) so keep on coding...

   

Bob

0 Likes
JiGi_284761
Level 4
Level 4
Welcome!

Reflowed the solder and it seems to work now.

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

Congratulations!

   

I have learned (at a time where µPs where a lot slower) to NEVER connect an mechanical switch to an interrupt because the bouncing could easily fire a couple of hundred ints.

   

A switch can be polled easily and when you set up a timer that fires 100 times a second you may poll the switch(es) in the timer-int and still the system is not stressed much. Additionally this might be used as the point to introduce a self-written de-bounce routine.

   

 

   

Bob

0 Likes