Embedded Systems Building Blocks, Second Edition

Natural parameters such as temperature, pressure, displacement, altitude, humidity, flow, etc., are analog. In other words, the value taken by these parameters can change continuously instead of in discrete steps. To be manipulated by a computer, these analog parameters must be converted to digital. This is called analog-to-digital conversion.
Certain analog parameters can also be controlled. For example, the speed of an automobile is adjusted by changing the position of the throttle. The exact position of the throttle depends on many factors, such as wind resistance, whether you are going uphill or downhill, etc. You can control the flow of liquids or gases by adjusting the opening of a valve. (Flow, in this case, is not necessarily proportional to the opening of the valve, but this is a different issue.) The position of the heads in some hard disk drives is controlled by voice coil type actuators. An actuator is a device that converts electrical or pneumatic signals into linear motion. To be controlled by a computer, analog parameters must be converted from their digital form to analog. This is called digital-to-analog conversion.
This chapter discusses software issues relating to analog-to-digital conversions and digital-to-analog conversions. I will also describe how I implemented an analog I/O module. The analog I/O module offers the following features:
Reads and scales from 1 to 250 analog inputs.
Updates and scales from 1 to 250 analog outputs.
Each analog I/O channel can define its own scaling function.
Your application...