read_switch

Description

This function reads the last stable state of a noisey input such as a switch or relay contact.

Unlike the polled functions (read_porta and read_portb), this function executes relatively quickly since the debouncing is performed in the background by the debounce driver

Definition

ubyte read_switch(ubyte id)

Library

LIB/debounce_lib.bas

Usage



On entry:
id is the bit number to read.
  • Bits 0..7 are mapped to PORTA bits 0..7
  • Bits 8..15 are mapped to PORTB bits 0..7
On exit:
return true if the last stable state of the input is high (logic 1), return false otherwise