Previous Lecture        Next Lecture                                                                                  Home        Classes        Contact

Lecture 20: Computer Data Acquisition

Hardware – Software Integration

Table of Contents

Overview / Class Goal 1

Data Acquisition and Control Hardware. 1

Overview DAC computer cards. 1

Analog Inputs. 2

Sensor Overview.. 2

Basic A/D Function. 2

Signal Conditioning / DAC Interface. 4

Analog Outputs. 5

Digital Inputs. 5

Digital Outputs. 5

Switching. 5

Communication Interfaces. 7

Application Examples from Robust Data Comm.. 8

Grounding, Bonding. 8

Power, Power Return, Chassis Ground, Earth Ground. 8

Bonding. 10

Shock hazard. 10

QUICK REFERENCE FOR RS485, RS422, RS232 AND RS423. 12

Guide to RS422 and RS485. 15

 

Overview / Class Goal

  • Overview of DAC hardware and its limitation
  • Hardware / Periphery Interfaces
  • Lessons Learned

Data Acquisition and Control Hardware

Overview DAC computer cards

  • Interface between computer (digital) and outside world, such as sensors, actuators, communication
  • Typically provides basic functions of:
    • Analog Inputs (converts analog voltages to digital representation)
    • Analog Outputs (converts digital value into analog voltage representation)
    • Digital Input (status indicator, communication, pulse counter)
    • Digital Outputs (switching, communication, PWM)
  • Some specialized cards:
    • Multi-channel PWM cards
    • Relays Cards for load switching
    • High speed cards (fast AC data acquisition)
    • Simultaneous multi-channel vs. multiplexed sequential A/D
    • On-board DSP (digital Signal Processor)

Analog Inputs

Sensor Overview

  • Convert physical quantity (pressure, temperature, light) into electric signal. Physical quantity could affect electric properties (resistance, conductivity), or sensor produces electric signal under mechanical change (piezoelectric devices), or converts light energy into electric energy,…
  • Conditioning: Signal may be very weak and sensor may condition signal through amplification, linearization, offset, conversion to voltage, frequency, current, optical signal.
  • Voltage: A/D card will measure voltage (so will voltmeter). Most common, but susceptible to noise over longer distances. Potential problems with ground loops, voltage offsets due to changing current draw,…
  • Current: best choice for noisy environments. Typical standard is 4-20mA range. Use precision resistor to convert back to voltage. A 0.1% accurate sensor requires at least a 0.1% precision resistor. The voltage is I*R. To stay within 0-5 volt range, use 250 Ohm (=5V), at 4 mA you get 1V. Be careful what the current return line is – it may or may not be the sensor power line. If it is, you still may get ground loops or short out the sensors, depending what end of the resistor / current loop line you connect to the A/D board ground !!.
  • Optical: used to isolate different power systems. Can still get ESD / voltage discharge even through plastic / glass fiber – watch isolation rating.
  • 2-wire, 3-wire, 4-wire sensor interfaces:
    • 2-wire typically current-sensors: photodiode, thermistor. Physical quantity changes property, affect current flow. Need to convert to voltage at A/D.
    • 3-wire typically voltage sensor: power (+), shared sensor power and signal return (GND), and signal (+S). Could be current sensor, with power (+), GND, and a current driver sharing the ground as current return.
    • 4-wire (strain gauge, pressure): +PWR, -PWR, +Signal, -Signal. Requires SEPARATE power return (-pwr) and sensor signal return (-Signal). Typically use instrument amplifier to convert differential signal into single ended signal for A/D (see below).

Basic A/D Function

  • Bit-resolution:
    • 8 bit: (basic PIC)                                             256 bins
    • 10 bit (PIC-type controllers)                          1024 bins
    • 12 bit (standard)                                            4096 bins
    • 16 bit (getting more common)                      65536 bins

 

  • Voltage Range / Reference Voltage:
    • Unipolar (positive voltages only), bi-polar (+/-).
    • Single Ended vs. Differential Input
      • Single Ended: all referenced to same common ground, typically the DAC board power return.
      • Differential: difference between two voltages with respect to a reference (‘ground’) is measured. This takes two channels (one for each potential to measure the difference between the two).
      • Most DAC boards can be configured for single ended or differential use. A 16 channel single ended board can also be used as a 8-channel differential input board.
      • When using differential output sensors, you can also design an interface board with amplifiers to convert from differential to single ended signals.
    • Range effects bit-resolution (mV/bin)
      • Use smallest range possible for highest mV/bin resolution
      • Ensure that all sensors are designed for same range, or modify to unify sensor output voltages (amplifier, offset)
      • Range typically set by jumpers (hardwired) or software. Range often set for entire range of channels, not on a per channel basis.
      • Some boards have software or hardware programmable amplifiers (gain) for all or individual channels.
    • Over-Voltage: if you exceed the range on one channel, it may affect the other channels also. You may loose all channels. Prevent over-voltage (clamping, proper range outside the capability of the sensor,…).
    • Reference voltage: The A/D converter assigns one of the bit-resolution dependent bins to a voltage relative to a reference voltage. The A/D does NOT know what, let’s say, 5 VDC is. It only knows that an applied voltage Vin is a certain ration to the Vref.
      • If your Vref changes, your conversion will be off (temperature, changes over time).
      • Some A/D converters have on-board references, others use the supply voltage, others accept reference voltage inputs. Your power supply voltage can vary depending on load – a bad choice for A/D reference.
      • Always calibrate your A/D conversion (often – annually, before major measurements) to a known good reference (6½ digit voltmeter in ITLL, precision voltage reference).
    • Multiplexer Settling time, Sample hold: most A/D boards use multiplexers, i.e., read the values on the channels sequentially. As your switch from one channel to the other, you MUST wait before taking a reading until the MUX has settled (switched to the new channel). If you read too fast, you will get a mix of the last and the new signal.
      • Check DAC card spec. on how fast you can read and what the required wait for settling is. Each A/D conversion (sample and hold, then read) will take some time – you can use multiple reads and the associated delay with each sample to get the required settling type – just throw out the first readings that are garbage, or use a time function to wait).
      • Manufacturer-supplied rivers that read all 16 channels and return an array of digitized values for all channels typically already include the settling time delays. Problem occurs with single reads under your software control.
      • Since most A/D card are multiplexed and collect channels sequentially, you may have problems when correlating signals on different channels (high speed, high frequency data such as AC signals, wind tunnel, flow, ….(100 kHz and up). In this case you need to spend $$$$$ to get true simultaneous data acquisition, or a real fast board with on-board data processing capabilities. Your CPU, its bus, and the standard A/D card will be much too slow.

Signal Conditioning / DAC Interface

  • Filtering / Noise:
    • Low-pass filtering only effective for conducted noise. Depending on environment, you may easily see 20 mV radiated noise. Bad if you are trying to measure 1 or 5 or 10 mV signals.
    • Use over-sampling and digital filtering if you are trying to measure DC or low frequency signals. Beware of aliasing.
  • Voltage Follower / Buffering:
    • Most PC DAC cards have 1 MWohm input impedance, and the signal should not be affected. The simpler 8 or 10 bit PICs A/D converters have sometimes only 10kW input impedance and may affect your signal (voltage divider).
    • In this case, and all others (good practice for isolation – prevent damage to DAC card), use voltage follower for isolation between signal and DAC card. The amplifiers have at least 10 MW if not higher input impedance at gain of 1, non-inverting setup.
  • Resolution / Amplification:
    • Make sure all signals fall within same range and well out of noise / minimum bit resolution.
    • Use amplification / voltage shift to avoid some bipolar and some unipolar sensor signals.
  • Calibration:
    • Make sure you’re A/D converter is regularly adjusted.
      • Either adjust gain on A/D, typically using gain and offset adjust, or reference voltage. Use high accuracy voltmeter of voltage reference.
      • Or use software to adjust reading.
  • Cable / Connector Interface
    • EMI noise – twisted pair, or shielded cable with twisted pairs (get the right pair).
    • Shielded connectors (metal backshell).
    • Connectors with ferrite inserts to reduce high frequency EMI.

Analog Outputs

  • Converts a digital value to an analog voltage, based on bit resolution (step function) and range (based on reference voltage).
  • Rapid changes can cause EMI and may not be feasible for hardware to follow – simple RC-filter reduces noise and allows hardware to follow command.

Digital Inputs

  • Read digital high (> 3V) or digital low (<0.4V).
  • Internally tied HIGH (5 V). If using programmable DIO (either input or output), they most often boot up as digital inputs, tied high. If you want to use it as digital output and default ‘off’ is low, you are in trouble.

Digital Outputs

  • Sets output to either high (‘1’, > 3 V), or low (‘0’, <0.4 V).
  • Limiting current source or sink capabilities (as low as 4 mA/channel, sometimes 16 mA). Typically can sink more than source à EE’s use digital ‘high’ as OFF, digital ‘low’ and ON when using DIO for switching.
    • Current source: chip output voltage and current used to switch a device, such as transistor, solid state relay. Chips typically have 8 output channels, each capable of driving 16 mA, but chip power may be limited to 100 mA total (heat) – so not all channels can be on !!!
    • When using transistors, digital ‘0’ is < 0.4 V, NOT ‘Zero’, but 0.4 V enough to turn on transistor !! – Use diode to eliminate false switching.
    • Current sink: power for device provided elsewhere, but returned to ground in digital chip – ‘0’ = ground, external circuit closed,  ‘1’ = ‘high’, external circuit open. Chips can typically sink more than they can source.
    • Current limit: always current limit the digital input or output to avoid damage to chips.

Switching

http://www.cyberresearch.com/content/tutorials/tutorial17.htm

·        Using Digital line directly – typically bad idea – current limit, no protection.

·        Using Digital lines with line buffer: increases your current capabilities. Also, can invert signal if necessary to avoid boot-up problems for some older, non-programmable cards.

·        Using transistor: better, but make sure that ‘off’ = really ‘off’ – use diode to require a minimum of 0.7V to turn on. Limit current using resistor and gain of transistor (Darlington: 10,000 to 100,000).

·        Optically coupled Solid State Relays, Opto-coupler Switches: based on LED (diode), requires minimum of 2 V to turn on, watch current – may require 10-20 mA, exceeds limit of Digital Output. Current limit required (diode will burn up) unless protected by optical device. Provides electric isolation when switching loads on different circuits.

·        Inductive Loads (solenoids, motors, valves,…): sure way to kill your switch or DIO. Always use ‘free-wheeling diode’ and caps to prevent voltage spikes. The induced voltages are easily 10x of supply (12 VDC solenoid will induce a 120 VDC spike). The diode provides a closed circuit for reverse voltage. The cap takes off any spikes, plus or minus.

·        EMI and PWM: typically, only one digital output is set up for PWM (i.e., software drivers exist to set frequency, duty cycle, rather than commanding a DIO for PWM yourself.

§         The pulse rise time determines the EMI frequency, not the PWM frequency. Slower rise / fall times are better, unless you need perfect square wave – perfect square wave is bad from EMI point.

·        Pulse Counting: only limited Dig. Inputs are set up for pulse counting. Out of 8, typically only one. There are limits for how many pulses you can count (buffer limit, 12 or 16 bit word). There is a maximum frequency limit on how many you can count – may have to divide.

 

Opto-Isolated Solid-State Relays

The diagram at right illustrates how an opto-isolated solid-state relay works. Notice that your digital I/O board functions as a current sink. When the voltage level on your digital I/O line goes low, it allows current to flow from the 5V power supply to ground on your digital I/O board. This is called "Negative True Logic" because the relay circuit is closed (turned on) when the voltage level of your digital I/O channel goes low (turns off). The light-emitting diode (LED) in series between the power supply and the current sink on your digital I/O board closes the circuit as the light it emits is picked up by a light-receptive transistor. This closes the contact and turns on power to your AC or DC power line. The greater the current sink rating of your digital I/O board, the more current will be able to flow from the power source through the LED, ensuring that enough light is emitted to close the circuit.

I/O Diagram

http://www.cyberresearch.com/content/tutorials/tutorial17.htm

DAC Card Boot-up

·        Often DAC cards use programmable DIO. By default, they boot up as digital inputs, tied high. If you use DIOs as switches, that means your device could be turned on until the computer has control of the card and can program / set the DIO.

§         You can use a Hex-inverter with enable lines as a buffer and to invert the default ‘high’ setting to a default ‘low’ setting. Also protects DAC card from damage, your own buffer chip typically can be replaced easier.

Communication Interfaces

http://www.cyberresearch.com/content/tutorials/tutorial2.htm

  • RS232A / RS232C Serial Communication (single ended voltage signal)
  • RS485 (voltage signal, multidrop) duplex (4 wire), half-duplex (2 wire).
  • RS422 (differential voltage signal, single drop).

 

RS-232: RS-232 is the most common serial line interface. All personal computers have at least one RS-232 serial port. RS-232 is an unbalanced or single ended peer to peer Line Interface Standard. RS-232 is ideal for connecting short distances less than 50ft. In general RS-232 is limited to 100kb/s, but new technologies allow for baud rates over 1Mbp/s along short distances of cable.

RS-422: RS-422 is used in situations where long distances are required. RS-422 can drive up to 4000FT at 100kbp/s. Or short distance's over 1 Mbp/s RS-422 allows for one driver and up to ten receivers to be on a multi-dropped network or bus. RS-422 is a differential or balanced Line Interface Standard.

RS-485: RS-485 is used in situations similar to where RS-422 is used. RS-485 has the added advantage of allowing up to thirty two (32) multi-dropped receivers or transmitters on a multi-dropped network or bus. Furthermore RS-485 also permits a wire saving (1/2) duplex mode.

RS-423: RS-423 is a single ended Line Interface standard similar to RS-232, but it permits up to 10 receivers to be multi-dropped on the same network or bus. It can drive up to 4000ft at 100kb/s

Current Loop: Current Loop is a reliable low baud rate, 20kp/s or less Line Interface Standard. All devices one the bus or "in the current loop" are wired in a series circuit. Up to 10 devices can be wired in a typical current loop circuit. The Connect Tech Current Loop SLIM offers optical isolation when wired in "passive mode". When wired in "Active" mode a current source on the SLIM in wired in the circuit and therefore the optical isolation is lost.

 

Application Examples from Robust Data Comm

Good application note for RS422 / RS485 / RS232 connection, grounding,, ….: http://www.robustdc.com/

Example RS-232 unbalanced signal

RS-422 with Signal Return    2 systems with well designed ground paths

 

Example RS-422 System

 

Grounding, Bonding

Power, Power Return, Chassis Ground, Earth Ground

  • Power and Power Return: electrons have to have a return path. Nomenclature assumes electrons flow from ‘+’ to ‘-‘, often also called ground. Both are confusing.
    • For single supply devices, use ‘+’ and ‘return’, NOT ground, not ‘minus’. For dual supply devices (actually 3 wires: ‘+’, ‘-‘, ‘0’), use ‘+’, ‘-‘, ‘return’. Neither of the returns has to be the ‘ground’.
  • Primary Power: outside power provided to you, such as 110 VAC wall outlet, 28 VDC Shuttle / ISS power
  • Secondary Power: what you create from primary power, such as 5 VDC, 12 VDC, for your computer, instrumentation.
    • If your secondary power is referenced / connected to the primary power return, you are safe. You must keep primary power isolated from chassis.
    • If your secondary power is isolated from primary power (such as any Laptop / PC power supply, DCDC converter supply, you could have a shock hazard. Solution: reference your secondary power return to chassis ground at one (1) point – single point ground (SPG).
  • Single Point Ground: termination for secondary power returns (DC and low frequency AC) at a SINGLE point.
    • Based on PC / embedded controller designs, that SPG is typically the computer, because it uses 5 VDC, 12 VDC, and connects all digital, analog, and video ground on its ground plane.
    • Sometimes this can cause ground loops when interfacing with the outside world, because your video and data lines to outside may be grounded elsewhere.
  • Ground Loops: will pick up RF signals / noise, and can make your life miserable for controls.
    • Each user should get its ground from the Single Point Ground (SPG). This will result in a ‘star’ distribution pattern.
    • Be careful with sensors: if their power and signal ground are the same, the sensor should be powered from the computer (SPG for sensors). If sensors use different signal and power grounds, no problem. To avoid ground loops with sensor power, use isolated DCDC converters for those.
  • Chassis Ground: metal boxes must all be electrically connected to avoid shock hazard or build-up of charge. On Earth, chassis ground must be terminated to the 3rd prong on the wall outlet. Exception: non-conductive plastic boxes (laptop, consumer electronics, even hair dryers) if double insulated / potted.
    • If you have only a chassis but no Earth (car, spacecraft), the PRIMARY power supply return (pole car battery, orbiter power supply – fuel cell) is connected to chassis at a Single Point Ground (SPG).
  • Earth Ground: big stake in the ground such as your water mains. Used as the ‘zero’ reference for instruments in lab (wall outlet 3rd prong, green wire). Identical to the AC power return (i.e., power company only sends you power in one (1) ‘hot’ line, they get the electrons back through the ground.

 

Bonding

  • To avoid shock hazard, fire hazard, and EMI noise / interference, all metal boxes and all wire connections must be bonded carefully to each other with the best electrically conductive method. Not scientifically bounded, but it seams to be possible to get < 20mW bond resistance and then problems go away. So MIL-STD461 says: use < 20 mW (class R).
  • If you only want to avoid shock hazard, 200 mW dissipated any charge before you can get shocked.
  • For ESD protection, NEVER EVER connect straight to the Earth ground while working – always use wrist strap with 1MW, or the fault current may find you appealing. High voltage electrostatic charge (cloth, shoes, carpet) of 100,000 Volt will dissipate through the 1MW resistor without killing you. Fault current to kill you could be 5 mA (that is very small). You can discharge you by touching the metal computer box, the metal cover on wall outlet, heater pipe, etc., but you may get shocked (static discharge only, not fault current).

Shock hazard

  • Bonding:
    • Class R (radio-frequency),
    • Class S (shock): 200 mW
  • Fault Current / Ground Fault Interrupt:
    • Measure current flow in both direction. If the outgoing current is different (larger) than the returning current (should be same, but could be smaller due to fault), interrupt the power (trip: 5 mA).
  • AC conducts across insulators (act like capacitors). A fluorescent lamp, mounted next to a metal wall, will charge the metal wall. This can be easily 20% of the lamp power !!!. If that metal box is not grounded, and you touch it, you get shocked. Fix: metal box must be bonded and grounded.

QUICK REFERENCE FOR RS485, RS422, RS232 AND RS423

Stolen from http://www.connecttech.com/products/interfaces/interfaces.html.

INTRODUCTION

Line drivers and receivers are commonly used to exchange data between two or more points (nodes) on a network. Reliable data communications can be difficult in the presence of induced noise, ground level differences, impedance mismatches, failure to effectively bias for idle line conditions, and other hazards associated with installation of a network. The connection between two or more elements (drivers and receivers) should be considered a transmission line if the rise and/or fall time is greater than half the time for the signal to travel from the transmitter to the receiver.

Standards have been developed to insure compatibility between units provided by different manufacturers, and to allow for reasonable success in transferring data over specified distances and/or data rates. The Electronics Industry Association (EIA) has produced standards for RS485, RS422, RS232, and RS423 that deal with data communications. Suggestions are often made to deal with practical problems that might be encountered in a typical network. EIA standards where previously marked with the prefix "RS" to indicate recommended standard; however, the standards are now generally indicated as "EIA" standards to identify the standards organization. While the standards bring uniformity to data communications, many areas are not specifically covered and remain as "gray areas" for the used to discover (usually during installation) on his own.

SINGLE-ENDED DATA TRANSMISSION

Electronic data communications between elements will generally fall into two broad categories: single-ended and differential. RS232 (single-ended) was introduced in 1962, and despite rumors for its early demise, has remained widely used through the industry. The specification allows for data transmission from one transmitter to one receiver at relatively slow data rates (up to 20K bits/second) and short distances (up to 50Ft. @ the maximum data rate).

Independent channels are established for two-way (full-duplex) communications. The RS232 signals are represented by voltage levels with respect to a system common (power / logic ground). The "idle" state (MARK) has the signal level negative with respect to common, and the "active" state (SPACE) has the signal level positive with respect to common. RS232 has numerous handshaking lines (primarily used with modems), and also specifies a communications protocol. In general if you are not connected to a modem the handshaking lines can present a lot of problems if not disabled in software or accounted for in the hardware (loop-back or pulled-up). RTS (Request to send) does have some utility in certain applications. RS423 is another single ended specification with enhanced operation over RS232; however, it has not been widely used in the industry.

DIFFERENTIAL DATA TRANSMISSION

When communicating at high data rates, or over long distances in real world environments, single-ended methods are often inadequate. Differential data transmission (balanced differential signal) offers superior performance in most applications. Differential signals can help nullify the effects of ground shifts and induced noise signals that can appear as common mode voltages on a network.

RS422 (differential) was designed for greater distances and higher Baud rates than RS232. In its simplest form, a pair of converters from RS232 to RS422 (and back again) can be used to form an "RS232 extension cord." Data rates of up to 100K bits / second and distances up to 4000 Ft. can be accommodated with RS422. RS422 is also specified for multi-drop (party-line) applications where only one driver is connected to, and transmits on, a "bus" of up to 10 receivers.

While a multi-drop "type" application has many desirable advantages, RS422 devices cannot be used to construct a truly multi-point network. A true multi-point network consists of multiple drivers and receivers connected on a single bus, where any node can transmit or receive data.

"Quasi" multi-drop networks (4-wire) are often constructed using RS422 devices. These networks are often used in a half-duplex mode, where a single master in a system sends a command to one of several "slave" devices on a network. Typically one device (node) is addressed by the host computer and a response is received from that device. Systems of this type (4-wire, half-duplex) are often constructed to avoid "data collision" (bus contention) problems on a multi-drop network (more about solving this problem on a two-wire network in a moment).

RS485 meets the requirements for a truly multi-point communications network, and the standard specifies up to 32 drivers and 32 receivers on a single (2-wire) bus. With the introduction of "automatic" repeaters and high-impedance drivers / receivers this "limitation" can be extended to hundreds (or even thousands) of nodes on a network. RS485 extends the common mode range for both drivers and receivers in the "tri-state" mode and with power off. Also, RS485 drivers are able to withstand "data collisions" (bus contention) problems and bus fault conditions.

To solve the "data collision" problem often present in multi-drop networks hardware units (converters, repeaters, micro-processor controls) can be constructed to remain in a receive mode until they are ready to transmit data. Single master systems (many other communications schemes are available) offer a straight forward and simple means of avoiding "data collisions" in a typical 2-wire, half-duplex, multi-drop system. The master initiates a communications request to a "slave node" by addressing that unit. The hardware detects the start-bit of the transmission and automatically enables (on the fly) the RS485 transmitter. Once a character is sent the hardware reverts back into a receive mode in about 1-2 microseconds (at least with R.E. Smith converters, repeaters, and remote I/O boards).

Any number of characters can be sent, and the transmitter will automatically re-trigger with each new character (or in many cases a "bit-oriented" timing scheme is used in conjunction with network biasing for fully automatic operation, including any Baud rate and/or any communications specification, eg. 9600,N,8,1). Once a "slave" unit is addressed it is able to respond immediately because of the fast transmitter turn-off time of the automatic device. It is NOT necessary to introduce long delays in a network to avoid "data collisions." Because delays are NOT required, networks can be constructed, that will utilize the data communications bandwidth with up to 100% through put.

SPECIFICATIONS

RS232

RS423

RS422

RS485

Mode of Operation

SINGLE
-ENDED

SINGLE
-ENDED

DIFFER- ENTIAL

DIFFER- ENTIAL

Total Number of Drivers and Receivers on One Line

1 DRIVER
1 RECVR

1 DRIVER
10 RECVR

1 DRIVER
10 RECVR

1 DRIVER
32 RECVR

Maximum Cable Length

50 FT.

4000 FT.

4000 FT.

4000 FT.

Maximum Data Rate

20kb/s

100kb/s

10Mb/s

10Mb/s

Maximum Driver Output Voltage

+/-25V

+/-6V

-0.25V to +6V

-7V to +12V

Driver Output Signal Level (Loaded Min.)

Loaded

+/-5V to +/-15V

+/-3.6V

+/-2.0V

+/-1.5V

Driver Output Signal Level (Unloaded Max)

Unloaded

+/-25V

+/-6V

+/-6V

+/-6V

Driver Load Impedance (Ohms)

3k to 7k

>=450

100

54

Max. Driver Current in High Z State

Power On

N/A

N/A

N/A

+/-100uA

Max. Driver Current in High Z State

Power Off

+/-6mA @ +/-2v

+/-100uA

+/-100uA

+/-100uA

Slew Rate (Max.)

30V/uS

Adjustable

N/A

N/A

Receiver Input Voltage Range

+/-15V

+/-12V

-10V to +10V

-7V to +12V

Receiver Input Sensitivity

+/-3V

+/-200mV

+/-200mV

+/-200mV

Receiver Input Resistance (Ohms)

3k to 7k

4k min.

4k min.

>=12k

 


Guide to RS422 and RS485

General

This text, stolen from http://www.kksystems.com/serdesc1.html, is a general overview of RS422 and RS485 interfacing. The examples are based on the K422 and K485 converters, unless specified otherwise.

Both RS422 and RS485 use a twisted-pair wire (i.e. 2 wires) for each signal. They both use the same differential drive with identical voltage swings: 0 to +5V. The main difference between RS422 and RS485 is as follows: RS422 has no tri-state capability (its driver is always enabled) and it is therefore usable only in point-to-point communications (although an RS422 device can act as a Master on a 4-wire RS485 system). RS485 has tri-state capability and can therefore be used in multidrop systems.

RS422

RS422 is full-duplex, i.e. data can flow in both directions simultaneously - and often does. RS422 uses two separate twisted pairs. RS422 is often used simply for extending RS-232 cables. Figure 1 shows a typical RS422 connection:

Figure 1.

RS485

RS485 is half-duplex. It exists in two varieties: 2-wire (which uses a single twisted pair) and 4-wire (which uses two twisted pairs like RS422). RS485 systems are usually "Master/Slave"; each Slave device has a unique address and it responds only to a correctly addressed message (a "poll") from the Master. A Slave never initiates a dialogue. In a 2-wire system, all devices (including the Master) must have tri-state capability. In a 4-wire system, the Slaves must have tri-state capability but the Master does not need it (i.e. it can be an RS422 device) because it drives a bus on which all other devices merely listen.

2-wire RS485 only See Figure 2a below.

Figure 2a.

4-wire RS485 only

The main advantage of 4-wire RS485 systems is that the Master does not need tri-state capability. This often allows Master software and drivers originally developed for RS232 to be used in a multidrop system, provided of course that the Master software emits the correct device addresses. See Figure 2b below.


Figure 2b.

Sometimes a 4-wire RS485 system is used to interconnect just two devices; this is virtually identical to RS422 and a K422 series device can be used at both ends becaus