Embedded Systems Building Blocks, Second Edition

Discrete inputs and outputs (I/Os) are found in most control and/or monitoring systems. The word discrete refers to the fact that the value taken by the input can take only one of two states. For example:
1 or 0
TRUE or FALSE
ON or OFF
ENABLED or DISABLED
PRESENT or ABSENT
and so on.
Figure 8.1: Discrete inputs.
As shown in Figure 8.1, discrete inputs are generally used to monitor the state of manual switches, pressure switches (pressure exceeded or not), temperature switches (temperature exceeded or not), limit switches (device has reach its limit or not), relay contact closures (open or closed), proximity detectors (there or not there), etc. Discrete inputs are generally used to determine the state of an input. In some applications, however, you need to know whether a discrete input has changed state or not and, possibly, how many times it did so.
Discrete outputs are used to control lamps, relays, fans, alarms, heaters, valves, etc. (See Figure 8.2.) A discrete output is generally either in one state or the other. A blinking light versus a light that is always ON, however, does a better job of attracting the attention of a user to an error condition.
In this chapter, I will provide you with a module that monitors discrete inputs and controls discrete outputs. The module allows you to have as many discrete inputs and outputs as you need (up to 250 each). For...