Chapter 16

Discrete Input and Output


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.


Discrete I/O




Get Embedded C Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.