The Digital I/O Handbook
A Practical Guide to Industrial Input & Output Applications
Digital I/O Explained
Renowned technical author Jon Titus and the President and CEO of Sealevel Systems, Tom O’Hanlan, clearly explain real-world digital input/output implementation from both a hardware and software perspective. Whether you are a practicing engineer or a student, The Digital I/O Handbook will provide helpful insight you will use again and again.
- Covers a wide range of devices including optically isolated inputs, relays, and sensors
- Shows many helpful circuit diagrams and drawings
- Includes software code examples
- Presents common problems and solutions
- Detailed glossary of common industry terms
“What I like most is its mix of hardware and software. Most pages have a bit of code plus a schematic. All code snippets are in C. This is a great introduction to the tough subject of tying a computer to the real world. It’s the sort of quick-start of real value to people with no experience in the field.” – Jack Ganssle, The Embedded Muse, January, 2005.
Switch and Relay Configurations
When you look at the specifications for relays and mechanical switches, you’ll find a variety of designations, such as DPST and 3C, associated with them. These designations describe electrical contacts and how they work. A basic on-off light switch, for example, controls one circuit (pole), and it provides a switch contact in only one position (throw). So, engineers call this a single-pole, single throw (SPST) switch. (See Figure A-1 for contact configurations.)
A single-pole switch may include an additional contact so it can turn off one device and then turn on another. This type of switch contains a set of single-pole, double-throw (SPDT) contacts. The term “double-throw” refers to a switch that can make connections in either of its two positions. Note that the two circuits in an SPDT switch always share a common signal, or pole.
Switches may include electrically separate “gangs” made up of several poles that act in unison. A double-pole, double-throw (DPDT) switch provides two independent SPDT switches operated by a single actuator. A DPDT switch can control two independent and isolated circuits.
Switches can include many poles, although for more than two poles the nomenclature uses numeric designations. So a 4PDT switch comes with four independent and isolated poles, each with two contacts. A single actuator or switch handle moves all four sets of contacts simultaneously. Keep in mind, though, that just because a switch has several poles, an application need not use them all. An SPDT switch, for example, will work just as well a SPST switch in a simple on-off circuit.
Switch nomenclature also may include designations for momentary switches; devices that either momentarily open (break) or close (make) a circuit. A pushbutton used with a doorbell operates as a normally-open switch. Pushing a normally-closed pushbutton on a lawnmower could open the ignition circuit to stop current from flowing to the sparkplug; in effect stopping the mower’s gasoline engine. Momentary switches carry the designations NO for normally-open, or NC for normally-closed. Even momentary switches may come with various contact configurations, so you may encounter spring-loaded switches that offer contacts in DPDT arrangements, for example.
Electromechanical relays also provide a variety of contact configurations such as SPST, DPDT, 3PDT, and so on. But suppose you have a relay with an SPST contact. That simple designation doesn’t indicate whether the switch contacts open or close when you energize the relay. You just can’t tell how a relay’s contacts operate without more information. Relay manufacturers use a different shorthand to designate relay contacts and the action a relay causes.
So, although relays come with standard contact configurations, such as SPDT and DPDT, the industry uses letters A, B, C, and so on, to indicate contact arrangements.
A relay with A-type contacts provides an SPST switch that closes when a circuit energizes the relay.
If you want SPST contacts to open when a circuit energizes a relay, choose one with B-type contacts. You can think of A-type contacts as normally-open (NO) and B-type contacts as normally-closed (NC).
A relay with a SPDT set of contacts-probably the most common relay contact arrangement-carries the C notation. A relay’s contact diagram shows the contact arrangement and notes which contacts open or close when a circuit energizes the relay. You will find that information printed on the case of an enclosed relay or in accompanying data sheets.
Relays, like manual switches, can provide multiple sets of isolated contacts that operate simultaneously. So a relay designated 2A would provide two separate NO SPST contacts, and a 2C relay would supply the equivalent of DPDT contacts. You may find relays with other letters that designate specialized contact configurations. A set of D contacts, for example, closes one circuit before opening another, also known as a make-before-break operation.
* – When used as a suffix on a signal name, an asterisk indicates a logic 0 causes the named action to occur. An input labeled TEST* requires a logic 0 to cause the TEST action to occur. See also: Negative Logic and /.
/ – When used as a prefix on a signal name, a forward slash indicates a logic 0 causes the named action to occur. An input labeled /RUN requires a logic 0 to cause a RUN action. See also: Negative Logic and *.
Active High – A digital signal that represents active, on, or true when its voltage is higher than the other logic state (low). Active-high signals can range from a few volts DC to as high as 24V DC, depending on the logic family or devices in use.
Active Low – A digital signal that represents active, on, or true when its voltage is lower than the other logic state (high). Active-low signals can range from digital ground to a few tenths of a volt.
Analog – A type of signal that varies continuously (lighter to darker, 4 to 20 mA, and so on), as opposed to a digital signal that can exist in only one of two possible states.
Analog Ground – The location in a system that serves as a reference ground for all analog signals. Some circuits may combine analog ground and digital ground, but most circuits separate them to reduce noise and ground currents.
AND – A logical operation in which the result is true only when all inputs are true. See: Logical AND.
AND Gate – A circuit that performs an AND operation based on the state of its inputs.
ASCII – American Standard Code for Information Interchange, an 8-bit binary code that represents characters and symbols in the Roman (English) alphabet. ASCII includes codes that controlled older communication devices, thus the CRTL key on computer keyboards.
BCD – See: Binary Coded Decimal.
Binary – A numbering system that allows for only two states, usually 1 and 0.
Bit-Wise – An operation, usually between two bytes or words, in which corresponding bits take part in an operation.
Boolean Logic – A form of mathematics named after George Boole (1815-1864) who devised formal expressions for AND, OR, and INVERT operations.
Blocking Diode – A diode, also called an isolation diode, that stops, or blocks, current from flowing through a circuit. Typically used in a battery circuit to prevent the reverse biasing of a battery by a more positive power supply.
Buffer – An output device that operates high-current or high-voltage devices. Some manufacturers produce drivers specifically to control devices such as stepper motors or displays. See: Driver.
Buffered – A signal that has passed through a buffer. See: Buffer.
Bus – A group of related electrical signals. 1. A control bus, an address, bus, a data bus, and so on. Some buses carry specific names, such as PCI Bus and Universal Serial Bus (USB). 2. A group of conductors that distribute power.
Capacitor – An electronic component that stores a charge and provides a reserve of power in a circuit. Typically used to smooth variations in a power-supplys output voltage, and to provide power in the event of brief power failures.
Carry Current – The amount of current a relays contacts can safely conduct after the contacts close.
Chassis Ground – The ground point in a system, typically on a metal chassis, where signals connect to an earth ground. In most cases, a grounded chassis helps shield circuits from EMI and RFI, and provides a safety connection to ground. This type of ground should not carry current. See also: Analog Ground and Digital Ground.
CPU – See: Central Processing Unit.
Current – A measure of the amount of electron flow in a circuit, typically measured in amperes (A) or milliamperes (mA).
Darlington Output – A configuration of output transistors that can handle high currents. Usually found on the outputs of sensors or buffers that drive relays or
Derate – A decrease in the rating of device characteristics, depending on operating conditions.
Digital – A system that uses discrete states to represent information.
Digital Ground – A common 0V ground reference for all digital signals. Digital ground and analog ground systems are usually wired separately to avoid introducing digital noise into the analog circuit.
Diode – An electronic component that lets current flow only in one direction.
Dry Contact – 1. Metallic contacts in a relay or switch that mechanically touch to make a contact. 2. Contacts through which no current flows. See: Wet Contact.
Earth Ground – The ground point in a system that provides the lowest voltage-reference point, or “”earth.”” An earth ground usually connects to a power-line ground, a ground rod, or in some cases, cold-water plumbing. An earth ground should not carry current.
Electro Magnetic Interference (EMI) – Energy induced into a circuit by radiated emissions. EMI may cause unpredictable results. See: RFI.
EMI – See: Electro Magnetic Interference.
Excitation Voltage – A voltage that powers a sensor or transducer.
Energize – To provide power to a device or circuit. Typically to power a relay coil, thus forcing it to change the state of its contacts.
Flag – 1. An electronic device, usually with two possible states, that signals an external event to a computer. 2. An internal CPU indicator that signals a condition such as register overflow or error. Sensed with software.
Flip-Flop – A bistable logic circuit that changes state due to an input event, generally a clock or pulse signal. A flip-flop remains in that state until the next input event causes it to “”flip”” or “”flop”” to its other state.
Form-A Relay – A relay that supplies normally-open (NO) SPST contacts.
Form-B Relay – A relay that supplies normally-closed (NC) SPST contacts.
Form-C Relay – A relay that supplies normally-open and normally-closed SPDT contacts.
Gate – A logic device that performs Boolean-logic operations.
Gated – A signal that is enabled, allowed to operate, or allowed to pass through a circuit depending on the state of a separate logic condition or signal.
Ground – A zero-volt reference point in a system. Provides the reference for all other voltages.
High Impedance – 1. A high resistance that reduces current flow. 2. A third state in special logic devices that “disconnects” them from a bus.
High-Side Switch – A switch that makes a connection directly to power at a higher voltage than that at the controlled load.
Impedance – Similar to resistance, an impedance represents the total opposition to the flow of current offered by a circuit. Impedance equals the vector sum of resistance and reactance, which is the complex resistance resulting from inductance and capacitance, not just pure resistance. Measured in ohms, and given the symbol, Z.
Inrush Current – A large charging current that flows into a capacitor or circuit when power is first applied.
Interposing Relay – A relay that isolates the circuit driving it, and switches a higher current or voltage than the driving circuit could provide. See: Relay.
Inverter – A logic device that complements the logic state of its input. See: Complement.
I/O – Input/output, as in I/O port. See: Port.
Isolation – A condition that separates circuits so no current can flow between them. Special devices such as opto-couplers provide a signal path between two circuits, but without current flow between them.
Latch – A logic circuit that takes a “”snapshot”” of information and saves it. Latches operate using an edge-triggered or a level-triggered control signal.
LED – See: Light-Emitting Diode.
Light-Emitting Diode (LED) – A diode that emits light when current passes through it (forward biased). LEDs provide white light as well as most colors. LEDs usually require an external current-limiting resistor.
Logic Ground – A ground-reference point in a circuit for all logic signals. Usually kept separate from other grounds in a system due to noise concerns.
Low Impedance – A low-resistance circuit that usually requires high current to drive it, as opposed to a high-impedance circuit.
Low-Side Switch – A switch that makes a connection directly to ground.
Mask Byte – A combination of 1s and 0s used in a bit-wise logical operation to set or clear individual bits. Masks can exist as any integer value, such as byte, word, long word, and so on.
NAND Gate – A circuit that performs a NOT-AND operation based on the state of its inputs. This gate performs an AND operation and inverts (NOTs) its output.
Non-Buffered – An unbuffered signal that should not drive more than a few inputs within its logic family. See: Buffered.
NOR Gate – A circuit that performs a NOT-OR operation based on the state of its inputs. This gate performs an OR operation and inverts (NOTs) its output.
Normally-Closed (NC) – Relay or switch contacts that normally form a complete low-resistance path for current flow. In an unenergized relay, a set of closed contacts.
Normally-Open (NO) – Relay or switch contacts that normally do not make contact. In an unenergized relay, a set of open contacts.
NOT – The equivalent of an inversion operation, usually applied as part of another logic element or operation. See: Inverter.
NPN – A type of transistor often used as an on-off switch in electronic devices. An NPN switch usually sinks current from a higher potential through a device to ground.
Open Collector – A logic device or sensor that provides an output transistor with an unconnected collector. When turned on, this transistor sinks current to
ground, but it cannot source any current. An open-collector output usually serves as a switch to ground.
Optical Coupler – See: Opto-Coupler.
Optical Isolator – See: Opto-Coupler.
Optical Isolation – The use of a light path to transfer a signal from a transmitter, usually a light emitting diode (LED), to a receiver, usually a phototransistor. This technique provides electrical isolation as a signal passes from one circuit to another.
Opto-Coupler – A device that uses light emissions to cause an isolated output stage to turn on. This device allows detection and sensing of potentially dangerous or high voltage signals, while providing isolation and protection to the circuitry sensing them.
Opto-Isolator – See: Opto-Coupler.
OR – A logical operation or circuit in which the result is false only when all inputs are false. See: Logical OR.
OR Gate – A circuit that performs an OR operation based on the state of its inputs.
Overload Protection – The capability to protect a circuit when current exceeds a predetermined value. Devices such as fuses or circuit breakers automatically disconnect a load when they sense an overcurrent.
PNP – A type of transistor often used as an on-off switch in electronic devices. A PNP switch usually sources current from a positive supply to a device at a lower potential.
Positive Logic – A notation that indicates a logic 1 represents the active state for a signal.
Pull-Down Resistor – A resistor used to pull a logic input “”down”” to the low state, or logic-0 state, thus preventing a disconnected input from floating into an undetermined state.
Pull-Up Resistor – A resistor used to pull a logic input “”up”” to the high state, or logic-1 state, thus preventing a disconnected input from floating into an undetermined state.
Radio Frequency Interference (RFI) – Unwanted high-frequency signals, often generated by switching circuits, power supplies, computer cables, and oscillators. RFI may interfere with the proper operation of other circuits.
Reed Relay – A small relay comprising two magnetic contacts within a sealed glass envelope. When energized, a coil around the envelope moves the contacts to make a low-resistance connection. See: Relay.
Relay – A device that opens or closes a circuit under control of a separate and isolated circuit. A mechanical relay uses a coil to actuate mechanical contacts. A solid state relay uses electronic devices to open or close circuit paths. Both types of relays isolate the controlling circuit from the circuit the relay controls.
Resistance – The total amount of opposition to current in a circuit. Resistance carries the units of ohms and the Greek symbol omega, ?. Resistance values may have units of kilohms, k? or megohms M?. See: Resistor.
Resistor – A device that opposes or limits current flow. Usually noted in schematic diagrams as R. See: Resistance.
RFI – See: Radio Frequency Interference.
RTD – See: Resistance Temperature Detector.
Sensor – A device that monitors or measures phenomena such as temperature, pressure, light intensity, weight, conductivity, and so on. Sensors may provide digital or analog output proportional to the phenomenon measured.
Single-Pole Double-Throw (SPDT) – A three-terminal switch or relay in which one central terminal connects to either one of the other two terminals. This type of switch can alternately connect a signal to one of two devices.
Sink – The ability to allow current to flow through the circuit, usually to ground.
Snubber – A circuit that suppresses inductive “”kickback”” that may result when inductive loads switch off. Unless snubbed, the kickback voltage can harm the device that drives the load. See: Suppression Diode.
Solenoid – An electrical coil equipped with a magnetic core. Energizing the coil moves the core. Removing the current lets the solenoid core return to its normal position. Solenoids move levers, open valves, and so on.
Solid State Relay (SSR) – A solid state circuit that employs devices such as opto-couplers, transistors, and triacs to perform the function of a mechanical relay. See: Relay.
Source – The ability to provide current flow.
SPDT – See: Single-Pole Double-Throw.
SPST – See: Single-Pole Single-Throw.
SSR – See: Solid State Relay.
Supply Current – The total current that a circuit requires from a power supply.
Surge Current – A high charging current that flows into a power supply filter capacitor or similar circuit as the power is first turned on. Similar to inrush current.
Surge Suppressor – A circuit that limits the effects of power surges. Devices such as metal-oxide varistors (MOVs), zener diodes, and fuses provide this function.
Switch – An electronic or mechanical device that can connect one signal to a series of connections. Switches ideally have zero impedance when closed and infinite impedance when open.
Thermocouple – A temperature transducer made of two dissimilar metals welded together at one point to form a junction that, whenheated in a complete circuit, generates a small voltage proportional to the junction temperature.
Three State – An output from a logic device that can exist in one of three states; logic 0, logic 1, or a high-impedance (disconnected) state. This latter state allows multiple outputs to connect to one signal, effectively providing a “bus” that many signals can share. Three-state devices will provide an output-enable signal that either connects logic signals to the devices outputs, or places the outputs in a high-impedance state. (National Semiconductor owns the trademark, “tristate,” although the term finds common use among designers.)
Transparent Latch – A latch that passes signals from its inputs to its outputs as long as its Enable signal remains activeusually logic 1. When the Enable signal changes to its inactive stateusually a logic 0the latch closes and then the outputs remain as they were when the Enable signal changed from logic 1 to logic 0. In effect, this IC acts like a small memory.
Triac – A semiconductor switch that can control devices powered by AC current.
Truth Table – A table that shows all possible input and output conditions for a logic element such as a gate or flip-flop. This table may show binary states as well as clock and signal transitions.
TTL – See: Transistor-Transistor-Logic.
VA – See: Volt-Ampere.
VCC – The symbol for the positive supply voltage in a circuit. Also noted as VCC.
Volt – The unit of potential difference or electromotive force, abbreviated V. One volt represents the potential difference needed to produce one ampere of current through a resistance of one ohm.
Voltage – The term used to designate electrical potential that causes current to flow.
Watt – The unit of electrical power required to do work at the rate of one joule per second. One watt of power is expended when one ampere of direct current flows through a resistance of one ohm. Abbreviated W.
Wet Contact – 1. Mercury-wetted contacts in sealed reed relays. When the contacts meet, the surface tension of the mercury draws the contacts together and forms a low-resistance path for low-level signals. In effect, the small amount of mercury ensures low-resistance contacts for low-level signals that dont clean the contacts. 2. Contacts through which current flows. See: Dry Contact.
Zero-Crossing Detector – A circuit that detects when an AC voltage signal has reached zero volts. Switching a circuit at this time reduces inrush currents and minimizes any EMI or RFI produced during switching.
You can purchase the complete Digital I/O Handbook for only $19.95 by clicking here. The Digital I/O Handbook is FREE with any qualifying Sealevel Digital I/O product purchase. You can find a listing of all Sealevel Digital I/O products by clicking here.