- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello guys,
I am trying to set up a basic rig to allow me to develop a reliable debounce circuit for a button I am using.
What I am trying to do is have the value 'Count' incremented every time there is a rising/falling edge and have the total displayed in binary on a bar graph display I have to hand.
The output part works fine and I am able to display whatever I like, the problem seems to be entering the ISR.
At the moment I have set the ISR to display 10101010 just to show that it has successfully been entered but the only time I have managed this is when I hold down the bootload button (Causes a crash).
I've used interrupts before in a very similar manner so I'm just confused now.
Kind regards,
Giga
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Giga,
If you need it, I have a draft version of the component with random pins assignment also. All pins are assigned on startup though. To make input pins be re-assignable on-the-fly in software you have to add extra code
/odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I should add that I've tried to use 'CY_ISR_PROTO' before main as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You wrote
bootloadISR_StartEx(bootloadISR_Handler); | |
bootloadISR_StartEx(Button_Change_Handler); |
But you should have
bootloadISR_StartEx(bootloadISR_Handler); | |
Button_Change_StartEx(Button_Change_Handler); |
Additionally:
Every global variable that isaltered within an interrupt handler must be declared as "volatile".
if ( (count & (0x01) ) == 0b00000001){Out_1_Write(1);} | |
else {Out_1_Write(0);} |
is easier to write as
Out_1_Write(count & 0x01);
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Giga,
alternatively, you may consider using a button debouncing component ButtonSw32 (beta)
Re: Advanced button debouncing
/odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot guys, I feel daft now!
Cool component odissey, especially if it handles multiple pins.
Only issue is that not all of the inputs on my port will be buttons and can change to another type of input at any given time (Modular hardware) so I'm not sure it will work for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Giga,
If you need it, I have a draft version of the component with random pins assignment also. All pins are assigned on startup though. To make input pins be re-assignable on-the-fly in software you have to add extra code
/odissey1