Hardware Reference
In-Depth Information
Sensors with digital outputs
Sensors which provide digital (rather than analogue) outputs can generally be
quite easily interfaced with conventional PC bus expansion cards. However,
since the signals generated by such sensors are seldom TTL compatible, it is usu-
ally necessary to include additional circuitry between the sensor and input port.
Switches
Switches can be readily interfaced to expansion cards in order to provide man-
ual inputs to the system. Simple toggle and push-button switches are generally
available with normally open (NO), normally closed (NC), or changeover con-
tacts. In the latter case, the switch may be configured as either an NO or an NC
type, depending upon the connections used.
Toggle, lever, rocker, rotary, slide, and push-button types are all commonly
available in a variety of styles. Illuminated switches and key switches are also
available for special applications. The choice of switch type will obviously
depend upon the application and operational environment.
An NO switch or push-button may be interfaced to a digital I/O card using
nothing more than a single pull-up resistor as shown in Figure 9.1.
The relevant bit of the input port will then return 0 when the switch con-
tacts are closed (i.e. when the switch is operated or where the pushbutton is
depressed). When the switch is inactive, the relevant port bit will return 1.
Unfortunately, this simple method of interfacing has a limitation when the
state of a switch is regularly changing during program execution. However, a
typical application which is unaffected by this problem is that of using one or
more PCB mounted switches (e.g. a DIL switch package) to configure a system
in one of a number of different modes. In such cases, the switches would be
set only once and the software would read the state of the switches, and use
the values returned to configure the system upon reset. Thereafter, the state of
the switches would then only be changed in order to modify the operational
parameters of the system (e.g. when adding additional I/O facilities). A typical
DIL switch input interface to a digital input port is shown in Figure 9.2.
Figure 9.1 Interfacing a normally open switch or push-button to a digital
input port
Search WWH ::




Custom Search