• We need to be able to connect computers to transfer information.
• Basic Communication Categories
Interface to Sensors and Actuators
• Classification of Interconnected processors (by Physical Size)
• Interfacing describes a broad group of methods that allow us to pass data between computers and other devices.
• To connect PLCs for communication, we first need connecting wires. This is the followed by a communication protocol.
• There are a few common methods of interfacing,
serial: a single point to point connection allows data communication over a small number of wires (eg. RS-232)
parallel: multiple wires are used for data communication. This is only common for older data bus designs such as printer parallel port and GPIB buses.
network: networks allow multiple connections to pass data. These actually are built upon the basics of serial and parallel communications
• Serial communication channels send data one bit at a time.
• These techniques are often slower, but are essential when transmitting using radio waves, telephone lines, or similar media.
• Serial lines have become one of the most common methods for transmitting data to instruments, and most personal computers now have two serial ports.
• Serial data can be transmitted two ways,
synchronous: all of the data bits are timed between sender and receiver.
asynchronous: the data bits arrive unannounced, without any coordination between sender and receiver. (this is the most common)
• A typical data byte looks like the one below. The voltage/current on the line is turned on/off. The width of the bits determines the possible bits per second (bps). The value shown before is used to transmit a single byte.
• The bits shown correspond to,
before: this is a period where no bit is being sent and the line is high
start: a single bit to help get the systems synchronized
data: this byte could be 7 or 8 bits, but is almost always 8 now. The value shown here is 01001000 binary.
parity: this lets us check to see if the byte was sent properly. The most common choices here are no parity bit (just drop it out), or even parity, or odd parity. In this case there are two bits set. If we are using even parity the bit would be set. If we are using odd parity the bit would be off
stop: the stop bits allow form a natural pause at the end of the data.
after: a period of time where the line is high before the next byte.
• Typical electrical connections look like,
• This standard is based on a high being +3 to +15V, and an off being -3 to -15V (+/-12V is commonly used).
• The typical connection scheme is shown below. notice that the lines are crossed between connectors. Also note that in some cases the dsr/dtr lines are not used. (Note: these are the lines used when connecting to a modem)
TXD/RXD: (transmit data, receive data) these lines pass data one way from sender to receiver.
DSR/DTR: (data set ready, data terminal ready) these handshaking lines indicate when the remote machine is ready to receive data.
COM: a common ground to keep things from blowing up, etc.
• A cable that emulates a modem connection between two devices is shown below and is called a null modem cable.
• There are typically two connectors used for these devices. (Note: the connectors have very fine numbers on them)
• The main pin assignments for the DB-25 are,
12: Secondary Received Line Signal Detector
14: Secondary Transmitted Data
15: Transmission Signal Element Timing (DCE)
17: Receiver Signal Element Timing (DCE)
23: Data Signal Rate Selector (DTE/DCE)
24: Transmit Signal Element Timing (DTE)
• The pin assignments for the DB-9 are,
• There are other settings such as half/full duplex.
• When communicating between two devices the setting must agree baud rate, stop bits, parity, data bits, full/half duplex, etc.
• The figure below shows a PLC connected to a data terminal with a serial line. This is followed by ladder logic to use the serial connection.
• ASCII functions can be used to interpret and manipulate strings in PLCs.
ABL(channel, control, )- reports the number of ASCII characters including line endings
ACB(channel, control, ): reports the numbers of ASCII characters in buffer
ACI(string, dest): convert ASCII string to integer
ACN(string, string,dest): concatenate strings
AEX(string, start, length, dest): this will cut a segment of a string out of a larger string
AIC(integer, string): convert an integer to a string
AHL(channel, mask, mask, control): does data handshaking
ARD(channel, dest, control, length): will get characters from the ASCII buffer
ARL(channel, dest, control, length): will get characters from an ASCII buffer
ASC(string, start, string, result): this will look for one string inside another
AWT(channel, string, control, length): will write characters to an ASCII output
Problem 28.1 Add the following numbers and store the results in ST10:2
• While numbers are well suited binary, characters don’t naturally correspond to numbers. To overcome this a standard set of characters and controls were assigned to numbers. As a result, the letter ‘A’ is readily recognized by most computers world-wide when they see the number 65.
• This I/O port uses multiple data lines (one for each bit) and extra lines for handshaking.
• These cables can permit very high data transfer rates.
• Because of the extra conductors the cables are large, most costly, length limited and much less flexible
• A Network is a way of connecting different computers to allow data and message passing, and resource sharing.
• Early communication techniques included telegraphs (with morris code), telephones and teletypes.
allows shared computers and peripherals
provides communication and cooperation tools for people and computers
increases reliability by having alternate computers available
decreases isolation of many computers
more sophisticated hardware and knowledge required
allows remote access to databases and libraries
distributed computational facilities
remote control of applications
• The relationship between various network types is shown below
• The Star Network topology uses many connections to a central server
• When all computers are connected to the same network cable, there are a number of structures which may be used. The bus topology below is simpler, and the tree topology is more flexible and versatile. This approach uses a single cable which is easy to add to
• The ring topology below shows a closed loop of cable which can be simple to implement, but limited in capabilities
• An enhanced ring topology is pictured below
• Significant issues in networks are,
Network power: does the network distribute power, or does each station need to be separately powered.
Network tees: to tap into the network cable simple connections can be used, or the connection can have circuitry.
Transmission type: switched voltage levels (baseband), single band FSK (carrierband), multiple frequency FSK (broadband). The FSK methods allow much higher network speeds.
Bus access: When network nodes share the same wire they may try to talk at the same time (this is called a network collision). Different schemes for dealing with collisions include,
CSMA/CD (Collision Sense Multiple Access/Collision Detection): if two nodes start talking and detect a collision then they will stop, wait a random time, and then start again.
CSMA/BA (Collision Sense Multiple Access/Bitwise Arbitration): if two nodes start talking at the same time the will stop and use their node addresses to determine which one goes first.
Master-Slave: one device one the network is the master and is the only one that may start communication. slave devices will only respond to requests from the master.
Token Passing: A token, or permission to talk, is passed sequentially around a network so that only one station may talk at a time.
Computers not necessarily from the same manufacturer
Allow computers to communicate information.
Sharing of equipment such as printers, disks, etc.
Programs can run on multiple machines improving performance
Access to machines with better/different resources.
• General OSI Diagram contains seven layers
• Physical layer is concerned with transmission of raw bits over a physical circuit.
• Deals with voltages, timing, connections, etc.
• Responsible for bit synchronization and the identification of a signal element as either a 0 or a 1.
• Protocols: RS-232, RS-449, CCITT X.25 and X.21, IEEE 802
• Data link layer breaks input data into “data frames” and processes acknowledgments.
• Object is to provide a error-free transmission line to the network layer.
• Responsible for the reliable delivery of information over a point-to-point or multipoint link.
• Supervises interchange of both link control data and user information
• Protocols: ANSI X3.28, HDLC, X.25, ISDN, IEEE 802
• Network layer determines the interface between the computer and the intermediate system, how packets are routed.
• Chooses a route from the available data links that form the network.
• Object is to take messages, convert them to packets and send them towards the destination.
• Protocols: CCITT X.25, X.21, IP, CCITT Q.931, ISO 8473
• Transport layer takes data from the session layer, splits it up if necessary, and passes this to the network layer.
• Ensures that pieces all arrive correctly at the other end.
• Isolates the user from any concern for the actual movement of the information.
• Session layer defines a connection between users (presentation layer processes).
• Includes specification of the remote machine, authorization, options for the communication, and recovering from errors in broken transport connections.
• The set-up of communications is called binding.
• Protocols: ISO 8327, CCITT X.225, T.62, ECMA 75, NFS, RPC.
• Ensures compatible syntax among the communicating processes by adjusting data structures, formats, and codes.
• Presentation layer is generally represented by library routines which the user accesses to perform network operations.
• This layer can also perform transformations such as compression and encryption.
• Protocols: DIS 8823, 8824, 8825, CCITT X.409, T.61
• Application layer is written by the user, or is a program that performs some function for the user.
• Provides a window by which the user gains access to the communication services provided by the architecture.
• Protocols: DIS 8571, 8832, 9040
Entity is a group of functions for a particular task. Accept input, and produce output.
Layer is a group of functions designed to provide a set of services related to the mission of that layer
Entities provide a set of services to the layer above. In doing this they use the services of the underlying layers.
Each layer isolates the layer above from the details of the underlying layers, and thus a lower layers characteristics can change without affecting the rest of the system.
Primitives control the layer’s services and data flow. Primitives fall into 4 groups: Request, Indicate, Response, and Confirm
• We can do a simple comparison of networking models
• A number of basic components are required for networks
• Computer (or dedicated computing equipment)
An obvious must. Without the computer there is no need for networking
Approximate cost $500 to $1,000,000
Some computers come with built in network interfaces, If these are for the wrong network types, or there is no network interface, a networking interface must be purchased.
examples are ethernet, latticenet, fibre, etc.
Approximate Cost $30.00 and up
This is the cabling which will connect the computers
10base2 (thin wire) is thin shielded coaxial cable with BNC connectors
10baseF (fiber optic) is costly, but signal transmission and noise properties are very good.
10baseT (twisted pair) is the most popular. It is a pair of twisted copper wires terminated with an RJ-45 connector.
Approximate cost for thick net $40 + $5/station, for thin net $10 + $1/station
A device which is sometimes included between the network media, and the network interface hardware.
Allows easy changes to media type.
Not used for thin cable computer interfaces.
Approximate costs $100 to $200
Connects separate wires and will route local traffic to local wires and remote through external connections.
Used when hooking one network type to another, or isolating one part of a network from another.
A bridge can be used for hooking an ethernet cable to an optical backbone cable.
Has one input, one output, and will only handle sorting by network address (like ethernet address of machine).
Approximate cost $2,000 to $5,000
When there are too many networks on the same network, a router can be used to isolate small loops of the network from traffic which does not involve it.
More intelligent than a bridge, multiple inputs/outputs.
Sorts Network packets by IP address.
Approximate cost $5,000 to $10,000.
If network cables are too long, the repeaters will boost the signal strength so that it may complete it’s journey.
Also allows media to be changed
Examples of this are NFS (Network File Server), SNMP (Simple Network Management Protocol)
Approximate costs >$1,000, unless provided with system
• Gateways (Application, Presentation, Session and Transport layers)
• An example of a micro computer with a networked interface
• Basic network hardware can be described with the 7-layer ISO model,
Smart Distributed System (SDS)
• Devicenet is meant as a noise resistant, robust, shop floor network.
• The main change that the user will notice is that a rack of a PLC can be broken up and CPU, I/O, etc. are now connected by Devicenet.
• Devicenet is an open standard, so components can come from a variety of suppliers.
• Based on the CANbus (Controller Area Network) protocol.
open system is not tied to a single vendor
diagnosis of devices is possible
wiring becomes easier (no long wire runs)
complex devices are easy to connect
possibility of using a PC based control package
multiple controllers can share the net
lengths of 500m/250m/100m for speeds of 125kbps/250kbps/500kbps respectively
power and signal in the same cable
addressing includes peer-to-peer, multicast, master/slave, polling or change of state
devices can be added/removed while power is on
• Devicenet is a layer 7: application protocol (Note that CANbus is level 2)
• A typical structure for Devicenet is shown below,
• There are two types of wire used,
Thick trunk: carries up to 8A for power up to 500m
Thin trunk: up to 3A for power up to 100m
• Power supplies are directly connected to the cable to supply power.
• The drop lengths are limited
total length/speed 156m/78m/39m are 125Kbps/250Kbps/500Kbps respectively
a single drop is limited to 6m
• The wiring can come in a form of end/connectors,
• Devices may have a red/green status light for the network status.
• Devicenet used the CANbus indentifier to specify,
node number (6 bits) up to 64 nodes on the net
• On a PLC-5 rack you would need a devicenet interface and could use the instructions below.
• On a Softlogix PLC the I/O will be copied into blocks of integer memory. These blocks are selected by the user in the setup of the software. Here the inputs are copied into N9 integer memory, and the outputs are set by copying the N10 block of memory back to the outputs.
• The CANbus (Controller Area Network) uses bit wise resolution for collisions on the network (i.e., the lower the network identifier, the higher the priority for sending)
• A data frame for the CANbus is shown below,
• Each device listens to the frame it sent to ensure proper communication.
• This is intended for communication between controllers, and permits more complex messages than Devicenet.
• A control network that is popular overseas, and primarily pushed by Siemens.
A token passing between up to three masters
length from 9600m/9.6Kbps with 7 repeaters to 500m/12Mbps with 4 repeaters
2048 bits of I/O per network frame
• Major features of the DH+ network,
peer to peer with token passing
uses shielded twisted pair cables
data rates of 57.6Kbps, 230 Kbps
• The basic data frame looks like,
• The data packet looks like that shown below (but it will vary depending upon the requested command).
• Some command examples include,
• Example for the Allen-Bradley PLC-5 Data Highway Network Connection
• PROFIBUS (Professional Field Bus) is an emerging standard for PLC communication that Siemens has incorporated into its product line with the “SINEC L2” bus. Companies such as Festo have agreed to follow the bus standard.
• Most robots have inputs and outputs that can be connected directly to sensors, actuators, PLCs, etc.
• Consider a case where a PLC controls a press and a robot unloads it.
Problem 28.2 Explain why networks are important in manufacturing controls.
Problem 28.3 We will use a PLC to control a cereal box filling machine. For single runs the quantities of cereal types are controlled using timers. There are 6 different timers that control flow, and these result in different ratios of product. The values for the timer presets will be downloaded from another PLC using the DH+ network. Write the ladder logic for the PLC.
Problem 28.4 a) We are developing ladder logic for an oven to be used in a baking facility. A PLC is controlling the temperature of an oven using an analog voltage output. The oven must be started with a push button and can be stopped at any time with a stop push button. A recipe is used to control the times at each temperature (this is written into the PLC memory by another PLC). When idle, the output voltage should be 0V, and during heating the output voltages, in sequence, are 5V, 7.5V, 9V. The timer preset values, in sequence, are in N7:0, N7:1, N7:2. When the oven is on, a value of 1 should be stored in N7:3, and when the oven is off, a value of 0 should be stored in N7:3. Draw a state diagram and write the ladder logic for this station.
b) We are using a PLC as a master controller in a baking facility. It will update recipes in remote PLCs using DH+. The master station is #1, the remote stations are #2 and #3. When an operator pushes one of three buttons, it will change the recipes in two remote PLCs if both of the remote PLCs are idle. While the remote PLCs are running they will change words in their internal memories (N7:3=0 means idle and N7:3=1 means active). The new recipe values will be written to the remote PLCs using DH+. The table below shows the values for each PLC. Write the ladder logic for the master controller.
Problem 28.5 Describe what the bits would be when an ‘A’ (ASCII 65) is transmitted in an RS-232 interface with 8 data bits, even parity and 1 stop bit.