mikroC - C Compiler for Microchip PIC microcontrollers
Util Library
Util library contains miscellaneous routines useful for project development.
Button
Prototype
char Button(char *port, char pin, char time, char active_state);
Returns
Returns 0 or 255.
Description
Function eliminates the influence of contact flickering upon pressing a button (debounc-
ing).
Parameters
minimum time pin has to be in active state in order to return TRUE; parameter
active_state
zero or logical one.
Example
Example reads RB0, to which the button is connected; on transition from 1 to 0 (release
of button), PORTD is inverted:
do {
if (Button(&PORTB, 0, 1, 1)) oldstate = 1;
if (oldstate && Button(&PORTB, 0, 1, 0)) {
}
} while(1);
page
280
and
specify location of the button; parameter
port
pin
can be either 0 or 1, and it determines if button is active upon logical
PORTD = ~PORTD;
oldstate = 0;
MikroElektronika: Development tools - Books - Compilers
mikroC
making it simple...
specifies the
time
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?