You are on page 1of 7

Industrial Automation Tutorial

Introduction RS-232 RS-422 RS-485


Industrial communications refers to the Type of transmission lines Unbalanced Differential Differential
wide range of hardware and software pro- Maximum number of drivers 1 1 32
ducts and protocols used to communicate Maximum number of receivers 1 10 32
between standard computer platforms Maximum cable length meters (feet) 15.2 (50) 1.2 (4000) 1.2 (4000)
(PC, Macintosh, or workstation) and Maximum data rate 20 kb/s 10 Mb/s 10 Mb/s
devices used in industrial automation Table 1. Features of RS-232, RS-422, and RS-485
applications. This tutorial describes the
fundamentals of serial interfaces and the soft-ware protocol. Table 1 summarizes longer distances as compared to RS-232.
simpler software protocols commonly the main features of these three serial inter- The greater noise immunity and distance are
used with industrial devices. There are faces as defined in their respective stan- big advantages in industrial environments.
communications many protocols that dards documents.
require sophisticated hardware and software RS-485 (EIA-485 Standard) is an
to ensure robust, reliable, and sometimes RS-232 (ANSI/EIA-232 Standard) is the improvement over RS-422 because it
real-time operation. These industrial serial connection found on IBM-compatible increases the number of devices from
networks are sometimes generically referred PCs. It is used for many purposes, such 10 to 32, and defines the electrical
to as fieldbus. This tutorial will introduce as connecting a mouse, printer, or modem, characteristics necessary to ensure adequate
you to some of the many industrial net- as well as industrial instrumentation. Due signal voltages under maximum load. With
working protocols in use and to improvements in line drivers and cables, this enhanced multidrop capability, you
Tutorial

under development. applications often increase the performance can create networks of devices connected
of RS-232 beyond the distance and speed to a single RS-485 serial port. The noise
Serial Interface listed in the standard. RS-232 is limited immunity and multidrop capability make
Standards to point-to-point connections between RS-485 the serial connection of choice
Many devices used in industrial applica- PC serial ports and devices. in industrial applications requiring
tions use EIA standards RS-232, RS-422, many distributed devices networked
or RS-485 to connect to computers and RS-422 (EIA RS-422-A Standard) is the to a PC or other controller for data
to one another. (In this tutorial, we use the serial connection used on Apple Macintosh collection, MMI, and other operations.
term RS-xxx to refer generically to RS-232, computers. RS-422 uses a differential elec-
RS-422, and RS-485). A common miscon- trical signal, as opposed to the unbalanced
ception about these specifications is that signals referenced to ground with RS-232.
they define specific software protocols. Differential transmission, which uses two
The ANSI/EIA RS-xxx standard specifies lines each for transmit and receive signals,
only the electrical characteristics – not the results in greater noise immunity and

Tem
pe

RS-485
ratu
re

Flo
w

device
Con
trol
Pan
Pre el

RS-485
ssur
eA
larm
Con
ditio
ns

ST
OP

"#0110.000\r"

Carriage return to end message


Analog output value in mA or %
Hex address of device
Character signifying beginning of message

Figure 1. An example of a command string sent to a 6B analog output module.

6-6 NATIONAL INSTRUMENTS PHONE: (512) 794-0100 • FAX: (512) 794-8411 • info@natinst.com • www.natinst.com
Industrial Automation Tutorial

Software Protocols libraries in LabVIEW, BridgeVIEW,


Note that RS-xxx protocols do not or LabWindows/CVI encapsulate these
specify anything about the software used types of commands into high-level VIs,
to communicate with devices. A common servers, or functions for configuring and
question asked about RS-485 devices in querying serial devices. OptoMux and
particular is, “How do I address my RS-485 ModBus ASCII are examples of serial
device?” The answer is, “It depends on the protocols that use standard serial ports
device.” RS-485 specifies only that it is and have achieved broad acceptance
capable of connecting multiple electrical across many devices and suppliers.
loads (devices) on a single set of wires. (See Table 2 for a list of devices that
It does not say anything about how to use the modbus protocol.)
address (or communicate at all with) these
loads. It is the job of a particular device’s Another protocol commonly used with Figure 2. PLCs typically use vendor-specific
software protocol to describe how to standard PC serial ports (using an electrical communications protocols that require specialized
address a specific device. adapter for physical signal conversion) and hardware interfaces and software drivers.
that has found wide usage across process
There are very few protocols that have control instrumentation is the HART to ensure reliable, robust communication.
widespread use by serial instrument (Highway Addressable Remote Transducer) Most such protocols are proprietary
manufacturers. The most common solu- protocol. HART is a hybrid network that to a specific supplier, requiring special

Tutorial
tion is a set of ASCII strings that constitute uses the 4-20 mA analog signal commonly software drivers and often special inter-
commands to the device. These protocols found on process control instrumentation face hardware. Examples of these proto-
are most commonly implemented as and adds to it a digital signal. The digital cols are those used for communicating
asynchronous protocols, so-called because signal is added in such a way that it does with PLCs, for example DataHighway+
the transmitter and receiver do not have not interfere with the standard 4-20 mA from Allen-Bradley or ModBus+ from
any tightly-coupled synchronization functionality. In a control system where the Modicon. (Figure 2)
mechanisms. These networks are com- HART protocol is understood, the digital
monly master/slave, where one device signals can be read from the device
(usually the computer) is the master and to read and write data.
the devices are slaves. Normally, all devices
power up in receive mode, waiting to receive There are many protocols that are used
messages. When the master transmits a on standard serial interfaces but use much
message, all devices receive the message more sophisticated data packaging schemes.
(on a multidrop network) and determine These protocols use different mechanisms
if the message is addressed to them. If it is,
they act upon the message, writing data Device Type Manufacturer
on the serial interface if required to do so. Gas chromatograph Daniels, Applied Automation, ABB
Figure 1 shows an example of a command Power measurement Multilin, Power Measurements, Bitronics,
string used to set the output level of an Sprecher+Schuh
Analog Devices 6B analog output module. DCS systems Foxboro, Honeywell, Rosemount,
Similar commands are used to read Westinghouse, Fisher&Porter, Fisher Controls
data from a module. Tank level instruments Rosemount HTG, Gauging Systems, Enraf,
Sarasota, Saab, Varec, Endress+Hauser
Most manufacturers of serial devices Value systems Keystone Controls, Limitorque, Pakscan
invent their own ASCII protocol for Single loop controllers Eurotherm, Micon, Toshiba
their particular device. It is a relatively Flow computers/transmitters OMNI, Daniels, MicroMotion, Eliot
straightforward task to read and write these PLCs GE, Square-D, TI, Siemens, Westinghouse,
ASCII strings using the standard serial Modicon
functions built into a language such as RTUs Arcom, Automation Electronics, Westronics,
Visual Basic. You must understand how to (almost every RTU manufactured)
use the string formatting commands and Variable speed drives Allen-Bradley, Telemechanique/Square-D,
serial functions in order to build and Siemens, Toshiba, Magnetek, Saftronics
parse command strings. Instrument Table 2. Devices and Manufacturers that use the Modbus Protocol

PHONE: (512) 794-0100 • FAX: (512) 794-8411 • info@natinst.com • www.natinst.com NATIONAL INSTRUMENTS 6-7
Industrial Automation Tutorial

Industrial Networks Sensorbus Devicebus Fieldbus


There is growing momentum toward CAN CAN IEC/SP50
more multivendor connectivity through Seriplex DeviceNet Fieldbus Foundation
standardized versions of the sophisticated ASI Profibus DP Profibus PA
industrial network protocols mentioned LONWorks LONWorks LONWorks
at the end of the previous section. In this FIPIO WorldFIP
tutorial, we will generally refer to these SDS
networks as industrial networks. There are Interbus-S
some key reasons that users are looking to
move to standardized industrial networks. Table 4. Classification of Industrial Device Networks.

Open Systems – It is difficult and costly Intelligent Devices – Device vendors are applications that can use digital
to integrate systems with instrumentation putting more intelligence into their devices communications. For example, simple
from several vendors because of the to satisfy customers’ demands for more proximity sensors on a conveyor belt can
multitude of communication protocols. functionality at lower costs. The increased be networked together to a system that
With standard protocols, devices from information available with a digital network controls the movement of boxes on the
many suppliers can coexist on the is necessary for capitalizing on the extra belt. Another example is a control valve
same network and communicate capabilities made possible by intelligence used to regulate the flow of crude oil
with one another. in the devices. within a petroleum refinery. These two
Tutorial

examples show the extremes of digital


Cost Reduction in Wiring – Many Figure 6 on page 6-12 illustrates how communication. The proximity sensor
systems are still using 4-20 mA analog standard industrial networks will transform has a simple function – transmit an
instrumentation, requiring extensive today’s control system. on/off signal indicating if a box is near
point-to-point wiring. Multidrop wiring the sensor. This signal can be accom-
means lower installation costs. Industrial networks are often characterized modated in a few bits of data. Diagnostic
according to the type of device best suited information from the sensor, if it exists
Increased Information Need – In today’s for residence on the network. Three at all, is probably limited to a single
regulatory environment, companies are general classes of such networks are “health” indicator which again requires
required to gather more information sensorbus, devicebus, and fieldbus. very little data to communicate. The
about their processes and the instrumen- Table 3 summarizes the major charac- control valve, on the other hand, could
tation connected to the processes. Tradi- teristics of each type of bus. be expected to provide very sophisticated
tional 4-20 mA instrumentation provides diagnostics, such as number of turns since
only one value, the process value. On There are many networks in use and last servicing, bearing friction, and ambient
a digital network, instruments can pro- under development today. Table 4 lists operating temperature. These parameters
vide maintenance and diagnostics some of these networks and their bus may be extremely critical in an environ-
information for better tracking of classification(s). The reason for the many ment such as a refinery where failures
instrument performance. buses is that there is a very wide range can result in dangerous situations and
industrial process and manufacturing costly downtime. The network in

Sensorbus Devicebus Fieldbus


Primary applications Discrete, machine Discrete, machine Process
Typical control system PLC PLC DCS
Data size Less than 1 byte Up to 32 bytes Up to 1000 bytes
Microprocessor-based No Yes Yes
Embedded intelligence No Varies Yes
Diagnostics No Simple Sophisticated
Response time 5 ms or less 5 ms or less 100 ms
Distance Short Short Long
Example device Discrete proximity Photoelectric sensor Smart valve with PID
sensor with diagnostics capability and
advanced diagnostics
Table 3. General Characteristics of Industrial Device Networks.

6-8 NATIONAL INSTRUMENTS PHONE: (512) 794-0100 • FAX: (512) 794-8411 • info@natinst.com • www.natinst.com
Industrial Automation Tutorial

a refinery may therefore be expected to OSI Model Fieldbus Model


be extremely robust and able to handle
large amounts of data. It stands to reason,
then, that the proximity sensor and the User Application User Application
control valve have different network
requirements. Thus, the reason for such
Fieldbus Message
a wide variety of industrial communica- Specification
Application Layer 7
tion networks. Fieldbus Access
Sublayer

As mentioned previously, industrial net- Presentation Layer 6


work protocols are much more sophisti- Communication
Session Layer 5 “Stack”
cated than the simple command sets
commonly used with typical serial Transport Layer 4
instruments. Dedicated hardware and
software drivers are required to provide Network Layer 3
robust connections between computer
Data Link Layer 2 Data Link Layer
platforms and each of these networks.
Options for using these networks today Physical Layer 1 Physical Layer Physical Layer
include DDE servers and DLL function

Tutorial
libraries for the Windows environment.
Though it is not clear that any one net- Figure 3 – The Fieldbus model compared to the OSI 7-layer communications model.
work will satisfy all industrial networking Note that OSI does not define a user application.
requirements, these buses will bring more
standardized interconnection between cations model. FOUNDATION Fieldbus has 1. The Data Link Layer is based on a
computers and the devices used optimized the OSI architecture for process token passing protocol.
in industrial automation applications. control by removing the middle layers that 2. The Link Active Scheduler (LAS) is
are generally associated with non-time a centralized device that acts as the
FOUNDATION Fieldbus critical applications such as file transfer. arbitrator of the bus.
FOUNDATION Fieldbus is a very sophisti- FOUNDATION Fieldbus technology consists 3. The LAS executes a schedule that makes
cated industrial network specifically tar- of a) the Physical Layer, b) the Communi- possible deterministic communication.
geted at the need for robust, distributed cation “Stack”, and c) the User Application. 4. The LAS distributes time to the net-
control in process control environments. Figure 3 shows these components modeled work to permit all devices to share the
The fieldbus specifications were developed using the OSI layered communication same sense of time.
by the Fieldbus Foundation, a group model. The physical layer (electrical,
representing over 80% of the world’s wiring, and so on) is based upon standards A key “8th layer” of FOUNDATION Fieldbus
suppliers of industrial automation systems, created by ISA/IEC (ISA S50.02-1992, is the User Application, or User Layer.
devices, and services. FOUNDATION Fieldbus IEC 1158-2). These physical layer stan- The User Layer defines “blocks” that
is based upon existing standards and other dards specify data communication rates represent the functions and data available
proven technologies, including work from of 31.25 kb/s, 1 Mb/s, and 2.5 Mb/s. in a device. Rather than interface to a
the ISA (International Society for Measure- Devices operating at 31.25 kb/s can draw device through a set of commands as
ment and Control), IEC (International their power directly from the network. commonly used with communication
Electrotechnical Committee), Profibus This Physical Layer also specifies the protocols, a FOUNDATION Fieldbus user
(Process Fieldbus, a German national capability for intrinsically safe operation. interacts with devices through a set of
standard), FIP (Factory Instrumentation blocks that define device capabilities in
Protocol, a French national standard), and The layers above the Physical Layer to- a standardized way. In this tutorial, we’ll
HART (Highway Addressable Remote gether are often referred to as the “stack” describe the most important block type –
Transducer, a widely-used process for fieldbus. Detailed discussion of the Function Blocks.
instrumentation protocol). stack is beyond the scope of this tutorial.
Several characteristics and functions in the Function Blocks are the core components
The FOUNDATION Fieldbus communica- Data Link Layer, however, are key to the with which a user specifies the behavior of
tion protocols are based on the OSI (Open distributed, real-time control capabilities a control system. FOUNDATION Fieldbus
Systems Interconnect) seven layer communi- of FOUNDATION Fieldbus: defines standard sets of Function Blocks.

PHONE: (512) 794-0100 • FAX: (512) 794-8411 • info@natinst.com • www.natinst.com NATIONAL INSTRUMENTS 6-9
Industrial Automation Tutorial

Function Block Name Symbol other functions. Note that the DD is a


Analog Input AI mechanism for describing the functions
Analog Output AO in a device. This is the key to fieldbus
Bias B interoperability. This can be contrasted
Control Selector CS to a more simplistic and common approach
Discrete Input DI to the problem of compatibility and inter-
Discrete Output DO changeability, namely by specifying that
Manual Loader ML only a given set of functions can be used
Proportional/Derivative PD in a device to ensure that a given system
Proportional/Integral/Derivative PID can always talk to a new device. This would
Ratio RA severely restrict the ability of a device manu-
Table 5 – The 10 basic standard function blocks defined by FOUNDATION Fieldbus. facturer to innovate by adding new device
features, and there would be never-ending
contention about the “right” set of functions
upon which to standardize. With the DD,
AI PID AO developers can add new features and be
confident that host systems can learn
about and take advantage of these
features in standard way.
Tutorial

Controller Area
Figure 4 – A Basic Control Loop Using AI, PID, and AO Function Blocks. Network (CAN)
The Controller Area Network is a serial
There is a set of 10 basic control and second system, however, shows the true bus growing in popularity as a device-
I/O functions (see Table 5). potential of FOUNDATION Fieldbus – level network. CAN was developed by
distributed control, where the control Bosch to address the needs of in-vehicle
The inputs and outputs of individual functionality exists out in the field rather automotive communications. Automobiles
functions blocks can be connected to specify than concentrated in larger controllers. have a variety of control devices in them,
communication of data on the bus. Even for such functions as engine timing,
more importantly, the execution of a A second important feature of the carburetor throttle control, and antilock
function block can be precisely scheduled. FOUNDATION Fieldbus User Layer is brake systems. With increasing demands
This is a very key capability of FOUNDATION Device Descriptions. A key objective for placed upon these systems for safety,
Fieldbus because it allows execution of FOUNDATION Fieldbus is interoperability – performance, and customer needs, CAN
control loops directly over the network. the ability to build systems comprised of was developed to provide a digital serial
The Function Blocks themselves reside devices from a variety of manufacturers bus system to connect controllers. CAN
in individual devices but the overall and take full advantage of both the stan- has been standardized internationally
scheduling of execution is specified and dard and unique capabilities of every device. (ISO DIS 11898 and ISO DIS 11519-2)
executed across the network. Figure 4 Function Blocks go a long way to ensuring and is already available in a number of
shows a simple control loop with three a consistent model of a control system. silicon implementations. The CAN
Function Blocks – AI, PID, AO. From a system point-of-view, however, a protocol meets real-time requirements
mechanism is needed to document in a encountered in many automotive applica-
The function blocks shown in Figure 4 standard way the types of functions available tions. The network protocol can detect
could be implemented on the fieldbus in in any given device. To achieve this end, and correct transmission errors caused
several different ways. The AI, PID, and FOUNDATION Fieldbus defines the Device by electromagnetic interference. Also,
AO could each reside in separate devices, Description (DD), is a standardized the network itself is relatively easy to
such as a transmitter, loop controller, and description of the functions available in a configure and offers the ability to
valve. Alternatively, the PID itself could device. Using the DD, the host in a control perform centralized diagnostics.
reside in the control valve. In the second system, for example a Windows NT-based
case, there is no explicit controller device. MMI, can obtain the information necessary Comparison of automotive and indus-
In either system, the user’s view is the to create the human interface for interacting trial network requirements show that a
same – a series of connected function with the device to configure parameters, number of characteristics of CAN also
blocks and an execution schedule. The perform calibration and diagnostics, and make it suitable for industrial applica-

6-10 NATIONAL INSTRUMENTS PHONE: (512) 794-0100 • FAX: (512) 794-8411 • info@natinst.com • www.natinst.com
Industrial Automation Tutorial

tions. These characteristics include low


cost, suitability for harsh electrical
environments, good real-time capabilities, Application Layer
and ease of configuration. There are now
many examples of CAN being the basis
for networks used in industrial manu- Logical Link Control (LLC)
facturing applications. CAN is particularly Data Link
well-suited to networking smart I/O devices, (Layer 2)
as well as sensors and actuators, either in Medica Access Control (MAC)
a single machine or in a plant. Several CAN Protocol
Specification
industrial devicebus systems have been
built upon CAN. Allen-Bradley developed Physical Layer Signaling (FLS)
Physical
DeviceNet, a CAN-based protocol now (Layer 1)
maintained by the Open DeviceNet Medium Attachment Unit (MAU)
Vendor’s Association. Other such indus-
trial networks include CANopen,
developed by CAN in Automation (CiA) Media
(Layer 0) Transmission Media
and the Smart Distributed System (SDS),
developed by Honeywell Microswitch.

Tutorial
Figure 5 – CAN defines parts of the Physical and Data Link Layers of the OSI 7 layer com model .
CAN is a communications protocol
specification that defines parts of the OSI 4. Access to the CAN network is per- enable CAN’s widespread use in industrial
Physical and Data Link Layers. CAN does formed using a method called nondes- automation applications.
not specify the entire Physical Layer or the tructive bitwise arbitration. In this system,
Medium upon which it resides, or the when a CAN node wants to send a frame,
Application Layer protcol used to it waits for the bus to become idle, then
move data. (See Figure 5). starts its frame with an arbitration identifier
(ID). Because of the underlying physical
As with the other network protocols layer, a dominant bit (0) always overrides
previously mentioned, detailed technical any recessive bit (1). As a node is writing
description of CAN and CAN-based its bits to the bus, it also reads the bus to
protocols is beyond the scope of this determine if the bit on the bus is different
tutorial. Listed below are some key than the bit written by the node. If the
technical aspects of CAN. bits are different, the node stops its write
because some other node has higher
1. Typical data rates are 125 k/s to 1 M/s, priority to the bus. Thus, the arbitra-
dependent upon the distance over which tion ID determines the priority of
the network is operating. The allowable messages on the bus, with lower
distance ranges from 40 m at 1 Mb/s IDs having higher priority.
to 500 m at 125 kb/s.
The industrial protocols built upon
2. CAN communications are performed CAN add further specifications in such
in a unit called a frame.CAN frames can areas as wiring types, connectors, diag-
be up to 8 bytes in length. nostics indicators, configuration switches,
and hot-swapping capability. Of great
3. CAN provides extensive error correc- importance with such networks is the
tion, including bit monitoring (comparing definition of objects for organizing data
transmitted bits to received), bit stuffing, within devices as well as for defining
CRC checksum, acknowledgment by all classes of devices, such as switches,
receivers, frame check (verify length), motor starters, and I/O systems. These
automatic retry, and fault confinement higher-level software definitions add
(defective devices automatically shut off). the ease of use and standardization to

PHONE: (512) 794-0100 • FAX: (512) 794-8411 • info@natinst.com • www.natinst.com NATIONAL INSTRUMENTS 6-11
Industrial Automation Tutorial

Te
mp
era
tur
e

Flo
w
Co
ntr
ol Pa
ne
Pres l
sure
Ala
rm
Co
nd
itio
ns

ST
OP

Controller

I/O
Proprietary digital
or custom interfaces

PLC

4-20 mA
4-20 mA plus digital or
Tutorial

proprietary digital

Analyzer
Traditional Hybrid instruments or
analog and discrete Hybrid intelligent instruments with
instruments instruments custom interfaces

Figure 6a. Today’s control systems use a combination of point-to-point analog connections and hybrid or proprietary digital communications networks.

Te
mp
era
tur
e

Flo
w
Co
ntr
ol Pa
ne
Pre l
ssu
re
Ala
rm
Co
nd
itio
ns

ST
OP

Higher speed fieldbus

Controller

I/O
PLC

Device or Lower speed fieldbus


sensorbus

Analyzer

Figure 6b. Using industrial device networks, system architecture is simplified because devices share common protocols.

6-12 NATIONAL INSTRUMENTS PHONE: (512) 794-0100 • FAX: (512) 794-8411 • info@natinst.com • www.natinst.com