Home    Industrologic, Inc. (636) 723-4000    Products Page

Interfacing to Digital Inputs and Outputs

Data acquisition and control systems, as well as microprocessor and microcontroller based boards and units, usually have what is described as "digital" inputs and outputs. However, there are several types of digital inputs and outputs, and though they are all called "digital", their interface capabilities are different.

The exact capabilities and limitations of a particular signal will be described in the manufacturer's reference manual for the product, however, there are several common types of digital input and outputs, as well as general rules about how they can be used. This guide to using digital inputs and outputs will help explain how some of the most common digital signals work and what devices can be connected to them.

The figures below show some of the most common digital circuits that are included in Industrologic products as well as many other manufacturer's board products and units. (The shaded areas represent the type of circuits being described, and the components outside the shaded areas represent typical devices that can be connected to those circuits.)

Logic Level

The expression "logic level" refers to signals that are compatible with the "logic" and microprocessor and microcontroller components in the system, usually being powered by 5 volts. There are many families of logic level components, often called logic "gates", and they all have slightly different logic voltages, currents, and interface capabilities.

In general "logic level" refers to signals that are at a very low voltage when in the logic "low" or "false" state, and at a specified higher voltage when in the logic "high" or "true" state. A logic level "low" is assumed to not be a high enough voltage to turn on circuits like driver transistors, and a "high" level is assumed to be high enough to turn them on. For example, if powered by a 5 volt power supply, a logic "low" might might be specified as .5 volts or less while a logic "high" might be specified at 4.5 volts or greater, with some degree of tolerance given.

The terms "active high" and "active low" refer to the logic level state that a circuit is in when a signal is active, or "on". One might assume that a device that is on has a higher voltage than one that is off, but with computer and logic circuits this is often not the case. Many signals are active low.

In the figures below logic level gates are represented by triangles (which happens to be how a logic gate called a "buffer" is drawn), however, keep in mind that these gates also represent the circuitry associated with pins of some microprocessors and microcontrollers that have logic level signals.

Sink and Source

The expressions "sink" and "source" basically refer to which direction the current is flowing when one signal is "driving" or activating another signal. Figure 1 is a simplified diagram of the output circuitry of a logic gate. The circuit uses two transistors, only one of which is turned on at any time.
  • When transistor "A" is turned on, the output becomes a "source" of current from the voltage powering the logic gate, and provides a logic "high" level.
  • When transistor "B" is turned on, the output becomes a current "sink" to the ground connection to the logic gate, and provides a logic "low" level.
It is important to remember that most logic gates can "source" and "sink" a very limited amount of current, usually in the order of a few milliamperes, not enough to operate relays, LED's, and other devices directly.

Pullup Resistors

Resistors are often used to "source" current from the logic power supply to "pull up" a signal to a logic "high" level. By doing this, switches, relay contacts, and other devices can then "sink" the current provided by the resistor to ground, causing the signal to go to a logic "low" level. The values of pullup resistors are usually kept as high as possible to limit the amount of current that the devices must sink. Some of the figures below show pullup resistors used in conjunction with switches and relay contacts.

Logic Level Outputs

Logic level outputs as shown in Figure 2 are the simplest form of digital output, but are also limited in what they can operate. Most logic gates and pins of microprocessors and microcontrollers are limited to how much current they can source and sink, usually in the order of a few milliamperes, so most often, they can operate only other logic level signals or circuits like that shown in Figure 4.

Some logic level gates and devices can sink or source enough current for very low current devices like LED's (using a resistor to limit the current), but careful attention must be paid to the manufacturer's data on these devices so as not to destroy them by sourcing or sinking too much current.

Open-Collector Transistor Outputs

Since logic gates can only "sink" a limited amount of current, transistors are used on some digital outputs to increase the amount of current the output can sink. This is usually done with an "open-collector" NPN transistor shown in Figure 3, or some other component that has the equivalent of transistors inside it.

Open-collector outputs can directly operate many types of relays like the one shown in Figure 5 (within the current limitation of the transistor.) It can also operate LED's (using a resistor to limit the LED current) as well as incandescent lamps and other devices (within the current limitation of the transistor).

(Note the "back EMF suppression diodes" connected across the coil of the relays shown. This diode is necessary to prevent the voltage generated when the magnetic field of the relay collapses when the relay is turned off from damaging components driving the coil.)

Logic Level Inputs

Figure 6 shows a typical logic level input typical of a logic gate or a pin of a microprocessor or microcontroller. Logic level inputs are versatile in that they can be connected to many types of contact closure devices when a pullup resistor is included. (On Industrologic products most logic level inputs have a built-in pullup resistor.)

Logic level inputs can also be driven by other logic level devices powered by the same power supply voltage (usually 5 volts.) This is possible even with a built-in pullup resistor if it does not source so much current that the driving signal cannot sink it all to ground.

digital input and output circuits

log file