This chapter teaches the reader how to perform basic level-based digital I/O from C on a microcontroller. This essentially is setting an output pin to a high or low state or reading the state of an input pin.
In addition to the functions needed in C, some basic electronic concepts are covered such as voltages and drive current. Debouncing and filtering inputs are shown, with code examples and diagrams. TTL, Schmitt trigger, and open collector I/O pins are all described. An example is also included that shows mapping an entire I/O port to a C structure.
Examples and exercises are for the popular PIC® microcontroller manufactured by Microchip.