Abl-electronic PIC Microcontrollers PIC16 Manuel d'utilisateur Page 288

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 312
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 287
Util library contains miscellaneous routines useful for project development.
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
280
MikroElektronika:
Development
tools
-
Books
-
Compilers
page
Util Library
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
port and pin specify location of the button; parameter time specifies the
minimum time pin has to be in active state in order to return TRUE; parameter
active_state can be either 0 or 1, and it determines if button is active upon logical
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)) {
PORTD = ~PORTD;
oldstate = 0;
}
} while(1);
Button
Vue de la page 287
1 2 ... 283 284 285 286 287 288 289 290 291 292 293 ... 311 312

Commentaires sur ces manuels

Pas de commentaire