How does Button detect a press and debounce

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
vgershman
Posts: 7
Joined: 20 Nov 2008 02:34

How does Button detect a press and debounce

#1 Post by vgershman » 16 Oct 2023 23:50

Hi,
I am using microC Pro. I have used library Button function in simper programs the past w/o issues. Now my program changes clock frequencies and enables/disables a bunch of interrupts. This affects ability to detect a Button press using library Button function. I have a general question. Does anyone know how does Button function work under the hood? Mainly:
-Does it use any interrupts?
-Does it use TMR0 or other timers to set the debounce time or does it just count cycles?

Thanks

vgershman
Posts: 7
Joined: 20 Nov 2008 02:34

Re: How does Button detect a press and debounce

#2 Post by vgershman » 18 Oct 2023 15:07

Per Micro tech support:
1. No interrupts are used to detect button voltage level, just monitoring the logic state
2. Debounce uses clock in Edit Project settings
3. Delay also uses Project clock - see __Lib_Delays library source file in the Uses subfolder. It uses Get_Fosc_kHz() function that uses Project clock.

Post Reply

Return to “mikroC PRO for PIC General”