Modicon Programming Handbook

Modicon Family

This handbook is a collection of programming overviews, notes, helps, cheat sheets and whatever that can help you (and me) program a Modicon PLC.

If you have experience with Modicon then please contribute.

Common Installation Mistakes on Modbus Plus Networks

Courtesy of: Delta Automation, Inc.

History | Specifications | Modbus Organization">Modbus Plus is a robust network of peer to peer communications used on process control and data acquisition applications, but several basic mistakes are commonly uncovered during the certification process performed by Delta Automation, Inc.'s Field Service Engineers.

One, if not the, most frequent, is exceeding the maximum allowable limit of 1500 cable feet without a repeater. Modbus Plus is a continuous cable with four conductors, a twisted pair, a drain wire and a shield. You must use the approved shielded Belden cable for the network to perform properly.

There are several types of connectors approved for node connections, they are: the MBKT type, the TEE type, the Ruggedized Industrial type and the newest Version, which utilizes screw terminals. However; you cannot mix the MBKT style with any of the type connectors which utilize the drop cable (all others). The grounding scheme is quite different.

 

Modbus Plus Network for Quantum and Momentum

 

 

There are two lengths of drop cables, 8 and 20 feet that are connected to all but the MBKT type connectors. These add 16 or 40 feet respectively to the main Modbus Plus or “trunk” cable. Using the connectors which have drop cables guarantees the 10 feet minimum between nodes unless someone shortens the drop cable.

Orientation of these connectors is critical for proper grounding. If you terminate on the "left" side of one end of a segment you must follow the same pattern of coming in on the "left and going out on the right" so the other end of the segment is terminated on the "right" side. This will insure each piece of the main cable is grounded properly.

The Industrial taps cause an impedance mismatch which can be displayed as an insertion reflection when testing the network using a time domain reflectometer (TDR). Delta Automation, Inc. does not recommend more than two of these taps on any segment. The MBKT connectors are "daisy-chained" together so when a node is connected or disconnected, the main trunk may be disturbed or made intermittent. This also may cause a poor connection at the MBKT, which in turn changes the resistance of the network that adversely effects the communications. A quick check of a segment is to measure the resistance between pins 2 and 3. The reading should be between 60-80 ohms, if both ends are terminated properly and the 1500-foot length has not been exceeded. Any additions to your Modbus Plus networks or new networks can be certified by Delta Automation, Inc. Engineers. This certification includes a written report with the TDR printout as a snapshot of your network detailing node distances and any problems located and repaired.

 

Creating a Defined Function Block in Modicon Concept

by C. Stanley

This article will show how to create user defined function blocks. The first block, a summing junction, was chosen to be simple in nature to illustrate the steps in creation without unnecessary complication.  Future articles will not be as in depth with creation mechanics and spend more effort on the functionality. The culmination of these series of articles will be a functional turbine speed control. The programming package for this series is Modicon Concept v2.6s. 


Fig. 1

Summing junctions are found in control systems where a process set point is compared to the process variable and the difference is output. This summing junction will also include two additional inputs for feedback values. These values will be discussed in a later article.  Future articles will feature additional user defined blocks. These blocks will be combined to create a speed controller for a turbine.

Create the Summing Junction Function Block

Assuming that Concept programming package is installed and a shortcut is on the desktop, click on Concept DFB icon. Click on File and then New DFB as shown in fig. 1.


Fig. 2

Assigning Names to Function Block Variables

Next click on Project select Variable declarations on the drop down.   The variable dialog box will appear.  This step allows the programmer to define inputs and outputs of the function block.  The function block is only accessed through the input and output pins. In that respect the user defined block is like an integrated circuit. The inner workings of the block are hidden from the rest of the PLC program. The block can be thought of as a new PLC instruction.


Fig. 3

Click the input radio button and enter the variables shown in illustration 3. The SetPt is the first input and it represents the desired value for the process variable or second input to the block. The second input variable PrcVar represents the measured value of the quantity that we are trying to control. This function block uses the REAL data type for all inputs and outputs. There are many types available and it is possible to create compound data types made of more than one type.

Two additional input variables are shown:  FeedBk1 and FeedBk2. These represent feedback quantities.  I will defer a discussion of these until a later article where their purpose will be made clear.


Fig. 4

In fig. 4, clicking the output radio button will open the output variable dialog box. In this box we enter a single variable ProcErr. This variable will represents the difference between Setpt and PrcVar speed or the system error. Click on the OK button at the bottom of the viable dialog box to close the box.


Fig. 5

Create a Programming Sheet for the Function Block

Next click on the project drill down icon, as shown by the upper pointer on fig. 5. The drill down will appear without any sections or groups defined. Right click on the top item in the drill down named Project and the New section dialog box will appear.


Fig. 6

Name Programming Sheet for the Function Block

Type in the name of SummingJct. The code type defaults to FBD of function block. One could also select on of the other types of coding as well but we are programming in FDB in this article. Enter a section name of “Sum_Jct” as shown in fig. 6.

New Group, if selected, creates a folder like object which can contain more than one section of related code. One names the “Group” as one names a section. To create a section within a group click on the group icon just left of the group name.  Our function block is simple and only requires a single section.  Click OK to close the dialog box.


Fig. 7

Programming Sheet for the Function Block

Click on the FDB icon in the Project Browser window and a blank work sheet will appear. This sheet is like a CAD drawing. Using the icon on the tool bar, one can create a network of function blocks that resemble electronic drawings. With this blank sheet we will need to place some arithmetic predefined function blocks to process inputs and assign an output.


Fig. 8

Inserting Function Blocks on the Sheet

Click on the FBD selection icon on the tool bar (upper most arrow)  and then select the Arithmetic group and the ADD_REAL block. While on the block selection box the cursor will be the normal arrow. Moving off the box will cause the cursor to change to what is shown in fig. 9.

For the SumJct block we are creating, I will leave the FFB from Library IEC  dialog open and select the SUB_REAL block after dropping an ADD_REAL block with a left click on the sheet.

Finally, there are six buttons on the bottom of the dialog box: Library... allows selection of additional libraries.  There are quite a few libraries to select more specialized blocks but it is beyond the scope of this article to discuss these. DFB allows selection of user defined function blocks such as we are creating in this article. The others are self explanatory.


Fig. 9

Working with Predefined Blocks

Fig. 9 shows what was discussed in the last paragraph. Moving the cursor to the worksheet will cause the pointer to change to the cross hair and function block icon. Left clicking on the worksheet will drop the selected block on to the sheet at the location of the cross hair. Press ESC to return the cursor to a pointing device instead of a function dropping device mode. We are now in position to assign inputs and output variable previously defined to the function block pins.


Fig. 10

Expanding Inputs Available on Some Blocks

The ADD_REAL block in fig. 10 can take more than two inputs. This is indicated by the black square on the bottom of the block. Placing the cursor on the black square and dragging down will reveal more inputs. Add two more inputs. The SUB_REAL block does not have this property because it does not have the black square. User Defined Blocks in general do ot have the ability to have expanded inputs because there is no way to express this in the limited programing tool set provided.


Fig. 11

Assigning Variables to Input Pins:

To assign inputs to the ADD_REAL Function block, click on each input. This click will open a dialog box allowing you to select from the available input variables previous defined.


Fig. 12

Fig. 12 shows clicking on Lookup button to reveal a list of the previously defined input variables.


Fig. 13

Click on PrcVar to select the first input to the ADD_REAL function block by pointing to it and double clicking it as shown in fig. 13.


Fig. 14

Repeat the input selection for the remaining two inputs, FeedBk1 and FeedBk2, for the ADD_REAL function block. Shown in fig. 14.


Fig. 15

Assigning Variables to Output Pins

Fig. 15 shows clicking on the output pin on the SUB_REAL will bring up only one variable for selection. Chose ProcErr by double clicking it. Notice that clicking on an output pin only shows one variable. This variable was the only variable we previously defined as an output.  We are nearly done assigning variables.

The SUB_REAL block will be assigned the SetPt input variable on its first or upper input pin.

The second SUB_REAL pin will be “wired” to the output of the ADD_REAL block, the subject of our next topic.


Fig. 16

Wiring Between Output and Input Pins

In fig. 16 above, I select the function block wiring tool shown with the arrow.   This tool will allow me to connect the output of the ADD_REAL block to the lower input of the SUB_REAL block.  The function block programming allows outputs to be assigned to another function block without using intermediate named variables. This is great because it cuts down on the number of variables needed for a program.

Also, note that in fig. 16 the SUB_REAL block is surrounded by a blue box. This indicates that the block is “selected”. Hitting the delete key will delete the block. Press Ctrl-C and Ctrl-V to copy and paste the block. More than one block can be selected at a time. Wiring is preserved to and from the clip board. In fact the whole sheet can be selected with Ctrl-A and repasted back to the sheet. The execution order for the blocks on a sheet can be changed this way. More in later articles about execution order and changing the order.


Fig. 17

The cursor changes from the arrow to a wide cross hair when the wiring tool is selected. The wide cursor is shown on the above illustration as the upper most cross hair. The wide cross hair changes to a thin cross hair when the cursor is moved to a suitable function block pin. The check mark also indicates the cursor is over a suitable pin.  See Fig. 17 above.

To connect or wire pins together, one can click the first pin and either hold down the left mouse button and drag the cursor to the next pin or left click the first pin and move the cross hair to the next pin and left click. The outputs of an output pin can be connected to multiple inputs of other function blocks. There is no fan out limit. The pins must have the same type in order to make a connection, e.g. REAL to Real, INTEGER to INTEGER etc. The reader can see the first input to the SUB_REAL block was assigned to SetPt. This was done in a similar fashion as the inputs to the ADD_REAL block but not shown.

What we have at this stage is the summation of the PrcVar, FeedBk1 and FeedBk2. This summation is subtracted from the SetPt input and the result supplied as the output of the SUMJCT block.

The summation and subtraction process is common in a process controller. I will use this block in two different ways in the final composition of a turbine speed control.


Fig. 18

Saving the Completed Block

In fig. 18 I will save my newly created block by clicking on File and then on Save as...


Fig. 19

In fig. 19, I name this block “sumjct.dfb” and then click OK. This makes the sumjct DFB visible in the Concepts programming package DFB library. I can select it just like I selected the predefined ADD_REAL and SUB_REAL function blocks when writing a PLC program or user defined function block.

The sumjct block is generic in nature so that it can be used in various parts of our turbine governor.

The function it performs is comparing the Process set point to the Process controlled variable and outputting the difference. The process controlled variable value can be modified by one or both feed back inputs. This summation action forms the heart of a classic controller. In later articles, I will show how modification of the various quantities in the control system can be fed back in to the summation junction to create a stable controller.

The next articles will show the development of two additional user defined function blocks: PID and Reference. The PID will be developed in a couple forms. These blocks will be combined into a turbine speed or load controller. A bit of practical control theory will be covered to aid in understanding the controller. The final controller will fit on one PLC programming sheet because I am using user defined function blocks.

Creating an Integrator Function Block in Modicon Concept

by C. Stanley

This is the second article in a series that shows how to create user defined function blocks using Modicon Concept v2.6 programing software. This article will show how to create an integrator function block.

Many basic control system component blocks contain an integrator function. Some examples are PID, Lead-Lag and filter blocks. An integrator function has an output that is the time integral of the input signal.

out= Kin dt

The integrator function described in this article will be an approximation of the above expression, where K represents the integrator gain and dt is the PLC scan time interval: out=K*∑in*scan interval.

fig1 Fig. 1

Assign Inputs Variables

The steps to create a new blank function block are not shown but can be found in the first article in this series on creating a summing junction. Click on Project then select Variable declarations on the drop down. Select inputs by clicking the Input radio button and enter the shown variables. The variables named out_min and out_max are limits on the value of the output. Variables init_ref and set_ref are used to preset or initialize the output of the integrator function. When set_ref is 1 or TRUE the output of the integrator is set to the value of init_ref. When set_ref is 0 or FALSE the integrator is operating. In all cases, the output of the integrator is constrained to be between the out_min and out_max limits.

fig2 Fig. 2

Assigning Output Variables

Click on Output radio button and enter the shown variables. The variables at_min and at_max are set to 1 or TRUE, if the output out equals the value of the limits out_min or out_max. It is often useful to know when an integrator is maxed out. For example, the integrator output could represent a rotating vector’s angular displacement. Every time the displacement reaches 2π radians, external logic can reset the integrator to 0 radians. In this example the input would represent angular velocity of a vector rotating clockwise. The number of reset events would represent the number of turns of the vector. The integrator output would represent current position or displacement of the vector.

fig3 Fig. 3

Naming the Integrator Section

Click the Project browser tool bar icon. Next, right click on Project: noname, and then click on New section.

fig4 Fig. 4

Name the section integrator_sec as shown in fig. 4. Leave the default coding FBD radio button enabled.

fig5 Fig. 5

Create a Programming Sheet for the Function Block

Next, right click (double left click does same) on the project drill down icon, as shown by the upper pointer on fig. 5 to bring up the newly created programing sheet.

fig6 Fig. 6

Coding the Integrator Function

Using the tool bar icon Show FFB selection Dialog which is the icon pointed at by the upper right pointer in Fig. 6, place two arithmetic functions on the sheet. This is shown in Fig. 6. Using the tool bar icon Show Link creation mode which is the icon pointed at by the upper left pointer in fig. 6, wire the output of the MUL_REAL to the lower input of the ADD_REAL block. Finally assign the inputs to the function blocks as shown in Fig. 6. My previous article on creating a summing junction shows the wiring and variable assignment operations in more detail.

fig7 Fig. 7

Click again on the Show FFB selection Dialog icon to bring up the FFBs from Library dialog box. This time click on the DFB button to select a user defined function block.

fig8 Fig. 8

Fig. 8 shows a user defined function SCANTIME. This is a function I created to return the elapsed time in seconds of the last scan. The reader will not have such a function. I am using this function as a way to illustrate the introduction of time into the integration function I am creating. The integrator I am creating will work using this function. There is a problem. SCANTIME can only be called once per scan in a PLC program because it returns the elapsed time between calls. Calling it more than one time per scan may produce unpredictable scan times. I will resolve this issue later in this article.

Knowing the scan time, which can be variable, is required in PLCs that control physical processes in real time. Each PLC manufacturer has different ways to determine scan times. The top end PLCs often have multiple mechanisms for scheduling sections of code based on time as well. One could place the integrator function in a fixed period scan schedule of say 10 milliseconds in a PLC that would provide this. In this case scan time would be a constant 10 milliseconds.

fig9 Fig. 9

Working with the Selection Block

Fig. 9 shows the selection of a Selection group in the IEC library and SEL function in that group. The SEL function is an un-typed or generic function that gets its type from the type of the variable assigned to its input. The output will be the same type as the input. The SEL block selects its output from one of two inputs based on the value of a BOOL input.

fig10 Fig. 10

Wiring the SEL Block

The SEL block G input is a BOOL type. When G is a 1 or TRUE the output is the value of IN1. When G is a 0 or FALSE the output is the value of IN0. The assigning variables to the SEL block is a sticky operation. In other words, once you assign a variable to a specific instance of SEL, that instance will always have that type as input and output. If you assign the input as a REAL one can not reedit that instance to accept an INT. One needs to delete the SEL instance and insert a new SEL block if the type of the inputs to the SEL block change. This reasoning applies to the rest of the generic or un-typed functions of Concept libraries. By the same reasoning, one needs to wire or assign inputs of the generically typed blocks before assigning the output.

When editing function block sheets in Concept, one can select a function block that currently exists on the sheet by clicking it. The block will show it is selected by exhibiting a blue box around itself. Pressing Ctrl-C copies it to the clipboard. Paste it onto the sheet with a Ctrl-V. Copying generic typed instances in this manner also preserves the type of the copied instance, which may not be the type you need for your edit. It is best to get new instances of generic types such as SEL or MOVE.

fig11 Fig. 11

Initialization Coding

In fig. 11, the SEL block G input was wired to an input set_ref. The IN0 was wired to the ADD_REAL output. The IN1 input is about to be wired to the init_ref variable. The integrator is initialized with the SEL block. The integration operation is actually done in the ADD_REAL block starting from the initial value on the next scan. Note that the out variable is used as an input and as an output. The SEL block is inserted in a position that allows it to over ride the output of the ADD_REAL. This allows the caller of the integration function to initialize the integrator whenever set_ref is a 1.

fig12 Fig. 12

Implementing Integrator Upper Limit

Fig. 12 shows the selection of the Comparison group and GT_REAL function from the IEC library. The GT_REAL block will be wired to limit the integrator output to the value of the out_max input variable.

fig13 Fig. 13

Implementing Integrator Lower Limit

From the Comparison group select the LT_REAL function. The integrator limits are important in preventing windup. Windup occurs when the process error is such that an integrator accumulates a value that is way more than a physical device can accommodate. For example, a linear servo motor can only travel from 0% to 100% stroke. An integrator is used to hold the desired position of a servo motor which is only 0% to 100%. What will happen when this integrator accumulates a position of 10000% servo stroke? It will take a long time to unwind the integrator. What will the process be doing with the servo motor pegged at 100% while the integrator unwinds? Hopefully not damaging the rest of the plant!

In using integrators, the programmer is interested in both the output value and the rate the integrator output changes for a given input. The input to integrators used in control systems is often a process error. The output of an integrator is often used to control a device that controls the physical process such as a valve-servo motor combination.

fig14 Fig. 14

Fig. 14, shows comparison block wiring to limit integrator windup.

fig15 Fig. 15

Using MOVE Blocks

Fig. 15 shows the selection of a MOVE block. MOVE blocks are curiously found in the Arithmetic group. The MOVE block can move just about any type of data to another location. MOVE blocks are generic instances that take the type of the first assigned input. As mentioned previously this assignment of a variable to a MOVE block input also assigns the type of the move. This assignment is sticky.

fig16 Fig. 16

Hidden Enable Pins

Fig. 16 shows double clicking on the MOVE block bringing up an information window. By clicking the Show EN/ENO check box, the enable pin becomes visible. The enable pin makes the execution of a function block conditional. If the enable pin is 1, then the block will be executed. Conversely, if it is 0 the function will not execute. Concept works this way, however I have found considerable differences in PLC programing software. The MOVE block is particularly subject to varying functionality as found in other programming packages in regards to Enable pin function. For example, Rockwell RSLogix implements this functionality quite differently. There is often a difference in the functionality of the MOVE block between function block programs and ladder programs in the same programming package. Be sure to write test programs to determine exactly how a block such as the Move block works when switching between manufacturers programming packages or programming languages within the same package.

fig17 Fig. 17

Multiple Assignment Warnings

Multiple function blocks can assign outputs to the same variable. In fig. 17, this is shown. Without using Enable pins this could be an error and cause unpredictable results. Concept generates a warning about multiple assignments.

fig18 Fig. 18

Coordinating Enable Pins

The two MOVE blocks in fig. 18 effectively clip the output of the integrator to be between the limits specified in the input parameters. A Move block is needed to pass the integrator output when it is not at one of the limits. To do this, I insert an OR block to control a yet to be inserted MOVE block.

Coordinating enable pins can be tough because of execution order. In fig. 18 the function block execution order is listed in parentheses above the block. When editing sheets it is sometimes necessary to change execution order. I have found this trick: design the sheet to execute left to right ignoring the actual execution order. Select the whole sheet with a Ctrl-A, cut the whole sheet to the clip board with Ctrl-X, then paste clip board to sheet with Ctrl-V. The execution order will be reordered left to right and top to bottom. Pasting preserves the layout of the sheet but reorders execution.

fig19 Fig. 19

In fig. 19 the wired OR block is shown, however the output of the OR block needs to be inverted for the .1.26 MOVE block function to pass the integrator output to out when the integrator is not limited out.

fig20 Fig. 20

Invert Bool Pin Tool

Fig. 20 shows the use of the invert Bool tool. The upper pointer shows clicking on the invert icon on the tool bar. The cursor will change to the one shown just above MOVE block .1.26. Moving the cursor to the pin you would like to invert will show a check mark when the cursor is in the correct position to be applied. Inversion can be applied to BOOL input or output pins of functions. After inversion, the pin will show a small circle indicating its inversion.

fig21 Fig. 21

How the Integrator Works

The integrator works by multiplying the input times gain times time interval in seconds. The result is added to the output of the last scan. The SEL block provides for the resetting of the integrator to a new value init_ref when set_ref is 1. The final result is compared to the integration output limits: out_max and out_min.

fig22 Fig. 22

More How the Integrator Works

The inverted output of the OR_BOOL enables the upper most MOVE block to pass the integrator output to the out pin of the integrator block when the integrator is within limits. Otherwise, the other two MOVE blocks replace the output with their respective integrator limit.

fig23 Fig. 23

Concept CONT_CTL Library Integrator

Concept CONT_CTL library has an integrator block that is similar to the one constructed in this article. Select the library as shown in fig. 23.

fig24 Fig. 24

Concept Integrator Block

The continuous control library has a block named INTEGRATOR. I pasted the block on to the work sheet for comparison purposes in fig. 25.

fig25 Fig. 25

Concept INTEGRATOR Block

The INTEGRATOR block has the same inputs as the one I constructed as shown in fig. 25. Double clicking on the INTEGRATOR block will bring up the information window. There is a help on type button on the information window. Clicking on this button brings up a substantial written description on this block. The next article in this series will be on derivative blocks and will include more about the help on type information.

The INTEGRATOR block is interesting because it has a self contained notion of time that appears to my testing to be independent of scan time. The integrator developed in this article used my function block Scan_time as a time base. This use is not very satisfactory but served the purpose of describing integrator function. The Concept library function INTEGRATOR in my experience works very well. The integrator developed in this article would be more robust if the scan time were passed as an argument on an input pin.

fig26 Fig. 26

Using the Comment Tool

In fig. 26, I use the Comment Tool. Clicking on it brings up a text dialog box in which you can enter comments. After clicking OK, the cursor will change to the comment placement cursor. Place the cursor where you would like the comment to appear and click again to drop it on the sheet. The comment cursor is sticky and allows additional comments to be dropped where needed. Pressing ESC key will return the cursor to normal. Comments can be moved by placing the cursor on it, hold down the left mouse key, and drag it to the new location. They can be cut/pasted to the clipboard as well.

This completes the integrator article. As previously mentioned, the next article will be on derivative blocks. Both derivative and integrator blocks are used in the PID block. The PID block will be covered in a future article.

Modbus FAQ

General

1. What is MODBUS?

MODBUS is a commonly used industrial communications protocol. It allows the exchange of data between PLCs and computers. It was originally designed for Modicon (Schneider Electric) PLCs but has become widely used by many PLC manufacturers and industrial networks.

2. Why would I use MODBUS?

MODBUS is a common means of gathering data from many different sources for viewing operations, archiving and troubleshooting from a central remote location. It is widely used and a fairly simple protocol. Depending on the application a newer protocol may have more advantage.

Typically a PC is set up running such programs as Wonderware, Intellution or LabVIEW in one location to gather data from various processes around the factory. Another application is for setting up remote factory process controllers (such as other PLCs like Allen-Bradley, Siemens, PLCDirect, etc.) to respond to different levels or modes that are being transmitted from the device.

3. How does it work?

Devices using MODBUS communicate using a master-slave technique, in which only one device (the master) can initiate transactions (queries). The other devices (the slaves) respond by supplying the requested data to the master, or by taking the action requested in the query. The master can address individual slaves, or can initiate a broadcast message to all slaves. Slaves return a message (response) to queries that are addressed to them individually.

The History | Specifications | Modbus Organization">Modbus protocol establishes the format for the master's query by placing into it the device (or broadcast) address, a function code defining the requested action, any data to be sent, and an error-checking field. The slave's response message is also constructed using Modbus protocol. It contains fields confirming the action taken, any data to be returned, and an error-checking field. If an error occurred in receipt of the message, or if the slave is unable to perform the requested action, the slave will construct an error message and send it as its response.

4. Is MODBUS Plus the same as MODBUS?

No, they are different protocols and not compatible. To link the two protocols a converter like Panel-Tec’s MD3000 is needed. This FAQ only applies to Modbus serial communications.

5. Is MODBUS TCP/IP the same as MODBUS?

No, they are different protocols and not compatible. A converter from MODBUS serial to MODBUS TCP/IP Ethernet is needed (for instance the EIS-2B Series Industrial MicroServers from Omega Engineering). This FAQ only applies to Modbus serial communications.

6. Where can I find out more about MODBUS?

Networking

7. What is a master-slave network?

A master-slave technique is one in which only one device (the master) can initiate transactions (queries). The other devices (the slaves) respond by supplying the requested data to the master, or by taking the action requested in the query. Typical master devices include touch screens or PCs running Wonderware, Intellution or LabVIEW while slaves include PLCs and smart devices such as PID controllers or meters.

8. How can I connect MODBUS devices together in a network?

RS-232 outputs cannot be connected together. To create a network the devices must use a RS-485 network and have a unique slave address.

References:

9. What are RS-232, RS-422 and RS-485 and how are they different?

These are standards for serial communications that define the pin outs, cabling, signal levels, transmission baud rates and parity checking.

A common mistake is to confuse the electrical standard with the protocol. Protocols define how the data is structured while the electrical standards determine how the data is physically transmitted. There are many different protocols (i.e. Modbus, DF1, AS511) that can be used on RS-232, RS-422 or RS-485 wired systems.

References:

10. How many slaves can there be?

The address can be a unique number between 1 and 247 for all these systems.

11. How do I change the slave address?

This is unique to each device. Consult the manufacturer’s manual.

Wiring

12. Where do I connect the communication wires?

This is unique to each device. Consult the manufacturer’s manual.

Here’s a typical example of a PC connected directly to a PLC Direct DL05.

 

Modbus PC to PLC direct connection

 

 

RS485 connections can be wired in a 2- wire or 4-wire arrangement. It is preferable to use the 2-wire multidrop network. The change can typically be made between both by use of two jumpers. The diagrams below show the wiring connections for the Dataforth and AutomationDirect RS485 to RS232 connectors.

Dataforth Converters

Modbus Dataforth four wire RS485 network

 

Modbus Dataforth two wire RS485 network

 

AutomationDirect (Facts) Converters

Modbus Automation Direct four wire RS485 network

 

Modbus Automation Direct two wire RS485 network

 

References:

AutomationDirect FA-ISOCON manual: http://www.facts-eng.com/manuals/faisoconm.pdf

RS-485 connection example see Dataforth Application Note AN202 http://www.dataforth.com/catalog/pdf/an202.pdf

12a. What are the dip switch settings for the Dataforth DPC485?

 

Modbus Dataforth dip switch settings

 

12b. What are the dip switch settings for the AutomationDirect (Facts Engineering) FA-ISOCON?

Modbus Automation Direct dip switch settings

 

 

13. Will I damage something if I get the wires swapped?

No, the RS-232/422/485 standards are designed to withstand short circuits and swapped wires. Damage may occur if a voltage greater than 25 volts is placed on one of the lines.

14. Do I have to turn off the PLC and other devices to connect the wires?

This is the only recommended safe way to install wiring.

15. How far away can devices be away from each other?

For an RS-232 connection the maximum distance is 15 meters.

For RS-422 and RS485 connections the maximum distance is 4000 meters.

Repeaters can be used to increase the distance.

16. What sort of cable should I use?

A shielded #18AWG cable with twisted pairs is recommended. The shield should be grounded on one end only.

Communicating

17. What are the communication settings?

This is unique to each device. Consult the manufacturer’s manual. A typical setup has

Baud Rate:

9600

Parity:

Even

Data Bits:

8

Stop Bits:

1

18. What are ASCII Chart ">ASCII and RTU modes?

ASCII (American Standard Code for Information Interchange) uses 10 bits of data comprised of 7 data bits, 1 parity bit, 1 start bit and 1 stop bit. It uses LRC (Longitudinal Redundancy Check) for error checking. The advantage of ASCII is it allows up to 1 second time intervals to occur between character transmissions without generating an error. It's most useful when communication is slow.

RTU mode (Remote Terminal Unit) contains 4 bit hex characters divided up into 8 data bits, 1 parity bit, 1 start bit, and 1 stop bit. It uses http://en.wikipedia.org/wiki/Cyclic_redundancy_check for more detailed information.">CRC (Cyclical Redundancy Check) for error checking. RTU has the advantage that it can send more data in the same amount of time but it has to be in a continuous stream (no delays between characters).

19. OK, that was too much information for me. Should I use RTU or ASCII?

RTU is the most commonly used.

Addressing

20. Where do I find information on identifying the addresses?

This is unique to each device. Consult the manufacturer’s manual.

21. What is a coil?

This is a single bit of information indicating either an ON (1) or OFF (0) state. Types of coils include valve states, alarms/warnings and status.

22. What is a register?

This is a 16-bit data field. The data can be in binary (decimal), hex or BCD format. Types of register data include temperatures, pressures, times and PID variables.

23. Why do some addresses have only four digits when I expect five?

Typically there are two ways that MODBUS can address the PLC:

#1 - Most software packages allow you to specify the MODBUS data type and address. This is the easiest method and most often used.

#2 - If your host software package specifies an address only then you will need to determine the addressing mode as either 484 or 584/984. If the address is supposed to be four digits then it is 484 mode. If the address is to be five digits then it is 584/984 mode. The following table shows what will need to be added to the existing address:

 

484 mode

584/984 mode

Coils

+ 1

+ 1

Registers

+ 4001

+ 40001

24. Why is the addressing off by one?

Some Modbus master devices compute register locations differently so the actual address might be shifted by one. This is often referred to as “adding the offset”.

25. Can I write a value to the PLC?

Yes there are both read and write functions.

26. Can I control the PLC remotely through MODBUS?

Only if the PLC program is programmed to do it.

Troubleshooting

27. How can I test the MODBUS connection?

The best way to do this is to have a separate computer/laptop with the ability to monitor MODBUS by acting as a Master station.

Vendors that have stand alone MODBUS testing software include:

The only cable required to test MODBUS is a three conductor, wired to one end with a standard 9 pin connector for the computer com port and the other end loose to tie into the customer interface terminalsThe 9 pin terminal 2 is Rx, terminal 3 is Tx, and 5 is GND (or Common). So the Rx on one end goes to the Tx on the other and vice versa, and the GND goes to GND.

To test an RS485 connection first establish that the RS232 side is working by disconnecting the RS232/485 converter and testing by the above method. Once the RS232 side is confirmed as working the only way to verify the RS485 connection with a PC is to use another RS232/485 converter to convert the signal back into a RS232 signal that the PC can read. A converter on another PLC can be used for testing but the RS232 side of the converter must be disconnected first before using the PC.

28. I’m getting communication time out errors and I can’t get the device to communicate with my software? What could be wrong?

29. The MODBUS data does not match what is on the screen. What is wrong?

 

 

Modbus Plus Traffic Issues in Bridge Plus Devices

Courtesy of: Delta Automation, Inc.

It is important to keep in mind when deciding the routing paths for your data transmissions which utilize more than one Modicon Bridge Plus device, the amount of traffic which may attempt to flow through it.

While a "backbone" of bridges on the main trunk of a History | Specifications | Modbus Organization">Modbus Plus network is generally the most efficient design for larger systems, problems can arise when data is requested from nodes that route over more than one bridge. A bridge plus device has eight master and eight slave paths for utilization of data transmissions. Additionally, there are paths reserved for programming use only. When all of the data paths are busy in the bridge, the incoming transaction will be queued in the first bridge plus device. Once a path becomes available, the queued transaction is removed from the queue and given a path. A response is only returned to the origin when a complete path is made to the destination. Since a bridge must open ports on both sides and maintain the proper timing, a transaction will only be queued in the first bridge and not in subsequent bridges for transactions that utilize multiple bridges. This will result in lost data or data not getting to or from the proper nodes, with no logical indications.

Utilizing the MBPSTAT program supplied with your computer Modbus Plus network card, monitor the traffic on each side of each bridge located on your network, to determine how many paths are being utilized at one time. If traffic is indicated on all eight paths, it is possible that some messages may be queued for transmission. In fact, it has been the experience of Delta's Engineers, that if the traffic exceeds an average of about 75% (six paths), that this bridge is beginning to get overloaded and may pose future problems. The ultimate solution is to add an additional bridge in "parallel" (with different addressing of course), and re route some of the traffic over the new bridge.

Modbus Plus MPBSTAT program screen shot: Modbus Plus MPBSTAT

These are the types of issues and problems that can be avoided by utilizing the network services of Delta Automation Inc. for all of your network design and support needs. A complete written report is generated with a network certification which includes distances, token rotation time, cable resistance, and a graphic display. All of this information is important for future planning for expansion, maintenance and servicing. Delta Automation Inc. certifies Modbus Plus, Modbus 11 and Remote I/0 networks in metallic and fiber optics.

Modicon Redundancy System I/O Hold-up Time

Courtesy of: Delta Automation, Inc.

The default setting for the remote I/O hold up time (HUT) on a Modicon PLC system, is 300 milliseconds. This determines the amount of time that the discrete outputs associated with a particular drop will remain in the "on" state once communication with the processor is lost. This loss can be due to a power loss at the drop or a cabling problem for example. With the default setting of 300, the discreet outputs will de-energize after 300 milliseconds (0.3 seconds).

Analog modules behave differently. The analog modules options are: go to zero, hold last value, or go to a preset value. These options are all chosen in the traffic cop (I/O map) area of the configuration screen. This default time setting is usually adequate for most stand alone systems.

The purpose of a redundant PLC system is to allow the application or process to continue to operate in the event of a PLC processor type failure. This is accomplished by "moving" the I/O points from the control of one processor to another if a failure should occur. This switch-over takes a finite amount of time, during which the I/O is not communicating to the processor. Typically, on Modicon systems it can take several scans of the processor to complete the switch-over. On large applications, at 0.3 to 1.4 milliseconds per K of logic, this can be longer than the default setting of 300 milliseconds. If the switch-over time takes longer than the hold-up time, the I/O will have lost communications with the "failed" processor and began its timing sequence and will ultimately drop out or de-energize. This would cause an application or process to stop.

In these types of systems Delta Automation, Inc. suggests that the time be set to 1500 milliseconds (1.5 seconds). This setting is accessed on the traffic cop or I/O map screen associated with each drop. There are several items to be very careful of when changing this value. First, the value that you enter is already in hundreds of milliseconds, for example 300 milliseconds is entered as just "3", and 1500 milliseconds is just "15". Secondly, the PLC software will allow you to enter an enormous value.

This can be extremely dangerous as the I/O will remain on and active even with the processor turned off! With NO CONTROL!
It is advised that the time never be set greater than 15 (1500 milliseconds).

Also, in some versions of the PLC programming software, you cannot just highlight the "3" and replace it with a "15". If you attempt to do this you will get an error message. A work-around is to enter a "5" after the "3", then type over the "3" with a "1" to get a "15".

 

Modicon Traffic Cop Redundant Hold Up Time Setting