Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

Compact Control Builder Training

Chapter 15 Communication

TABLE OF CONTENTS

Chapter 15 Communication .................................................................................................................................................... 1


15.1 General Information.................................................................................................................................................... 2
15.1.1 Objectives ............................................................................................................................................................ 2
15.1.2 Legend................................................................................................................................................................. 2
15.1.3 Reference Documentation .................................................................................................................................... 2
15.2 MMS Communication between Applications............................................................................................................... 3
15.2.1 General ................................................................................................................................................................ 3
15.2.2 MMS Communication Principle ........................................................................................................................... 3
15.2.3 Access Variables.................................................................................................................................................. 4
15.2.4 MMS Variable Naming Rules............................................................................................................................... 5
15.2.5 Variable Attributes............................................................................................................................................... 5
15.2.6 Reading Data from an Access Variable ................................................................................................................. 6
15.2.7 Performance Considerations and Structured Access Variables............................................................................... 7
15.3 Setting up MMS Communication ................................................................................................................................ 8
15.3.1 How to Configure the Access Data Type............................................................................................................... 8
15.3.2 How to Define the Access Variable .................................................................................................................... 10
15.3.3 How to Read Access Variables from Another Application................................................................................... 11
15.3.4 How to Extend Parameters ................................................................................................................................. 13
15.3.5 Other Function Blocks in the MMS CommLib.................................................................................................... 14
15.4 Communication to Other Devices.............................................................................................................................. 15
15.4.1 Overview ........................................................................................................................................................... 15
15.4.2 COMLICommLib .............................................................................................................................................. 16
15.4.3 FFH1CommLib.................................................................................................................................................. 17
15.4.4 FFHSECommLib ............................................................................................................................................... 17
15.4.5 INSUMCommLib .............................................................................................................................................. 18
15.4.6 MB300CommLib ............................................................................................................................................... 18
15.4.7 ModbusCommLib .............................................................................................................................................. 19
15.4.8 ModBusTCPCommLib....................................................................................................................................... 19
15.4.9 ModemCommLib............................................................................................................................................... 20
15.4.10 S3964CommLib ............................................................................................................................................... 20
15.4.11 SattBusCommLib............................................................................................................................................. 21
15.4.12 SerialCommLib................................................................................................................................................ 21
15.5 General Configuration of any Protocol ...................................................................................................................... 22
15.5.1 Main Steps......................................................................................................................................................... 22
15.5.2 How to Configure COM3 on a Controller ........................................................................................................... 23
15.5.3 Software Configuration ...................................................................................................................................... 25
15.5.4 Address Syntax .................................................................................................................................................. 27
15.6 Configure a Generic Serial Communication Channel ................................................................................................. 28
15.6.1 Example Bar Code Reader.................................................................................................................................. 28

Chapter 15 - 1
T530-15 Communication - RevG.doc

15.1 General Information

15.1.1 Objectives
On completion of this chapter you will be able to:
Describe the principle of MMS communication
Create and define access variables
Configure MMS communication between controllers
Tell the available communication protocols and libraries
Explain the principles of serial communication

15.1.2 Legend
> Indicates when you go from one menu to a sub-menu
Italic Indicates object and file names
“ “ Indicates dialog box buttons, tabs, menus etc.
Bold Indicates important topics
Indicates start/explanation of student activity

15.1.3 Reference Documentation


3BSE041434 Industrial IT 800xA - System
System Guide – Technical Data
3BSE040935 Industrial IT – Compact Control Builder AC 800M
Basic Control Software – Introduction and Configuration
3BSE041488 Industrial IT – Compact Control Builder AC 800M
Extended Control Software - Binary and Analog Handling
3BSE035982 Industrial IT – Compact Control Builder AC 800M
Communication – Protocols and Design

Chapter 15 - 2
Compact Control Builder Training

15.2 MMS Communication between Applications

15.2.1 General
MMS stands for Manufacturing Message Specification. It is the protocol used to
communicate on the control network between AC 800M applications.
MMS supports transfer of simple and structured variables, program download and
alarm handling. MMS is also used to define and make data available as access
variables.
Generally the MMS communication between AC 800M controllers should be limited
if possible because it will use the controller’s CPU capacity.

15.2.2 MMS Communication Principle


MMS communication handles communication between applications within one
AC 800M controller and between applications allocated to two controllers.
The applications may exist in the same controller:

Controller

Application 1 Application 2

Or in different controllers on the control network:

Controller 1 Controller 2

Application 1 Application 2

It is possible to execute two applications within the same controller. Even in this case
though, we need to use MMS communication with access variables if we want
exchange data between the two applications.

NOTE! Applications should be designed so that the data passed


between them is minimized. The MMS communication
should be limited and not be used for a lot of data.
For example: don’t write an application in one controller and use the I/Os of another
controller for this application.

Chapter 15 - 3
T530-15 Communication - RevG.doc

15.2.3 Access Variables


For communication between two applications, access variables are defined. An access
variable is a variable that is shared on the network. By sharing a local (or global)
variable as an access variable, it is accessible by any system on the network, as long
as the two systems in question share a common protocol, such as MMS, COMLI etc.
Access variables are defined in the controller hardware part of the Project Explorer.
The variable may be of any type and this means that it might be a simple variable or
else a complex (structured data type).

One or more access variables are defined in a particular controller. Such variables are
mapped into variables existing in the applications running in that controller. This
mapping is done in the Access Variable Editor.

Variable Name Path maps a variable


is a string in the application to
the Access Variable

Controller Access Variable

Application
Path to Variable

Variable

The variable in the application which is mapped can be any variable existing
anywhere in the whole application:
Variable in a program or control module
Variable (global or local) in the application

Chapter 15 - 4
Compact Control Builder Training

15.2.4 MMS Variable Naming Rules


MMS variables can only be accessed by their name which is a string. The naming
rules are defined in MMS rather than as part of Control Builder, therefore there are
some differences in these rules compared to the standard naming rules for variables in
programs etc.
An MMS access variable name can be up to 32 characters long and contain letters,
digits and the characters dollar ($) and underscore( _ ).
No spaces are permitted in the name of an MMS variable
MMS variable names are case sensitive, i.e. TANK4 is not the same variable as
tank4.
The access variable name cannot begin with a digit or the dollar ($) character.
The access variable may be mapped to any type of simple variable or (more
importantly) to any type of structured variable.
A structured variable can have mixed data type components

15.2.5 Variable Attributes


By default access variables are Read/Write. If you want to make the variable Read
Only then set the attribute in the access variable table to ‘ReadOnly’.
If the attribute field is left blank then the variable will be Read and Write.

Chapter 15 - 5
T530-15 Communication - RevG.doc

15.2.6 Reading Data from an Access Variable


Access variables are declared in the controller that acts as a server. The access variable
is a reference to a variable in an application.
The client application has to be configured with at least one Connect function block
and one Read or Write function block addressing the access variable.

In the above diagram an access variable has been defined and mapped to a variable in
the application called Application1.
Now the objective is to read the values stored in it from Application2. This is done
with function blocks instances placed in a program in Application2.

A minimum of two function blocks are required.


Connect function block
The purpose of this function block is to make the connection to the controller
which holds the access variable (referred to as the Remote System or Partner)
Read function block
The Read function block reads the values of the access variable in the remote
controller and transfers them into a local variable (Control Builder variable) in the
application that is reading (Application2 above)

Chapter 15 - 6
Compact Control Builder Training

15.2.7 Performance Considerations and Structured Access Variables


Each and every read or write operation from/to an access variable requires a
transmission across the network. Therefore it makes sense to pack as much data into
the access variable as possible.
It is possible to define access variables for each and every simple variable in the
application and then to access them individually. But this is not recommended because
it results in many telegrams on the network.
NOTE! It is far better to create a structured data type
specifically for the purpose of MMS communication.

Such a structured data type can have many components and may be accessed in one
transaction:
For MMS there is a limit of 1 Kbyte of data per telegram. This means that several
hundred real values may be packed into a structured variable and accessed in one
‘lump’. Variables require different amounts of message space depending on the
variable type.

In the accessing system the data in the structured variable may then be extracted by
code block looking at the components of the variable.

Chapter 15 - 7
T530-15 Communication - RevG.doc

15.3 Setting up MMS Communication


In this section we will show how an application can read data from another using an
access variable. Application1 will contain data that is to be made available to others.
Application2 will read the data cyclically.
To establish the link three stages are required:
1. Define a structured data type to hold the data. Create a variable of this type in
Application1 and write the values into the components from code in Application1
2. Define an access variable and set the path to the variable containing the data in
Application1.
3. In Application2, create an instance of the MMSConnect function block type and
another of (say) the MMSReadCyclic function block type. Configure these to read
the access variable at the controller in which Application1 is executing and to
transfer the values into a local variable in Application2.

15.3.1 How to Configure the Access Data Type


The data type should be defined in a project library which is connected to both
applications. This is so that each application can declare a variable of this type. The
original variable (in Application1) must have the same structure as the final variable
(in Application2) so that the data matches component for component.
The data type is structured to contain any combination of variables of any type. The
choice of structure depends on the data to be made available.
Imagine that Application1 has the new data type MMS_Data_App1_Type with the
following structure:
MMS_Data_App1_Type
Bool1 Boolean
Bool2 Boolean
Integer1 Dint
Integer2 Dint
Real1 Real
Real2 Real
String1 String
String2 String

Chapter 15 - 8
Compact Control Builder Training

1. Create a new data type in a project library.

2. Declare a variable in Application1 of this type. Call it, say, App1_Data.

It is convenient to declare this as a global variable in the application, because then


it is available to all control module instances and all programs in the application.
These objects may then write into the components.

Chapter 15 - 9
T530-15 Communication - RevG.doc

15.3.2 How to Define the Access Variable


1. In the controller in which Application1 will run double-click on “Access
Variables” and select then the tab “MMS”.
2. Declare an access variable whose name is, say, Controller1_App1_Data.
NOTE! It is useful to name the controller and the application to
which the data refers in the name you choose.

3. Set up the path from Controller1_App1_Data to the variable in the application or


program using the path button:

Be very clear in your mind about what is going on here.


In the above example, the access variable is called Controller1_App1_Data – it is this
variable that is ‘made available’ on the network.

The variable in the application or program is called App1_Data – your application


program will write values into the components of this variable which is of type
MMS_Data_App1_Type. The path column links this variable in the application or
program to the access variable.
NOTE! Refer to the diagram at the beginning of this chapter to
ensure you have the right idea.

If the values in the components of the variable App1_Data change, then the values in
the components of the access variable called Controller1_App1_Data will also
change.
Similarly if a remote system writes to the values in Controller1_App1_Data then the
components of App1_Data in the application or program will also change.

Chapter 15 - 10
Compact Control Builder Training

15.3.3 How to Read Access Variables from Another Application


Now Application2 should read the access variable Controller1_App1_Data. This is a
first simple example which reads the data cyclically (we discuss other possibilities
later). Two function blocks are needed, both from MMSCommLib:
- MMSConnect
- MSReadCyc

1. Create an instance of each type in a program (or a control module) in


Application2.

2. Declare the following (minimum) set of variables in the program.

Note that the variables AccessVarName and PartnerAddress have been given
initial values.

3. Connect these variables as shown below:

Chapter 15 - 11
T530-15 Communication - RevG.doc

Valid, Error and Status


Each of the function blocks has these outputs which may be connected to variables for
status indication:
Valid is true when everything is working correctly.
Status is a Dint output whose value indicates in detail a fault or otherwise. It
should have a value of 1 under normal circumstances. Any negative value means
an error. Use the search facility in the On-line help to look up the meaning of a
particular value.
Error is true if the communications link is in error.

MMSConnect
The ConnectID variable is connected between the MMSConnect and the
MMSReadCyc function block. It passes signals which co-ordinate the activity of the
two.
The MMSConnect needs to know which controller to connect to (you need to know
someones mobile number in order to connect to them). This information is given by
the variable PartnerAddress. It is always a string data type and it has an initial value
equal to the IP address of the controller where the access variable required has been
defined.

MMSReadCyc
The AccessVarName variable is a string data type with an initial value equal to the
name of the access variable Controller1_App1_Data defined at the remote controller.
NOTE! MMS variable names are case sensitive!
The App1Data variable is the local variable in this program into which the remote data
will be placed. The components of this variable get written with the data that is in the
components of App1_Data in Application1.
The MMSReadCyc block determined the poll time for the read operation it defaults to
5s but may be changed either during configuration or by the code at run time.

Communication Check
It is a good idea to check first whether the communication is okay. Check the status of
the MMSConnect block and use that as an input for the Enable parameter on the
MMSReadCyc block.

Chapter 15 - 12
Compact Control Builder Training

15.3.4 How to Extend Parameters


Some function block types have extensible parameters. This means that the number of
input/output parameters is variable and may be specified when you declare the
function block.
By default the editor automatically inserts [1] when you specify a function block type
with extensible parameters. The programmer changes the number within the brackets
to the required number of parameters.

1. In the “Insert Function/Function Block” dialog set the size to the number you
require. Alternatively, change the number in square brackets in the function block
declaration pane.

2. A function block with three pairs of VarName and Rd parameters is generated.

This read cyclic block can now read three access variables from the same remote
system in one execution
NOTE! In Function Block Diagram (FBD) and Ladder Diagram
(LD), a maximum of 32 extensible parameters per
function block can be shown.

The MMSReadCyc determines the polling interval. If some variables need to be read
every 5s and a second set every 10s, then a second MMSReadCyc block can be
connected via the ConnectID variable. The first one set at 5s and the second set at 10s.

Chapter 15 - 13
T530-15 Communication - RevG.doc

15.3.5 Other Function Blocks in the MMS CommLib


MMSRead
This module performs an event driven read of an access variable from the remote
system. This allows a programmer to trigger a read operation on from code. It is
connected in a similar way to the MMSReadCyc.

MMSWrite
This module writes values into an access variable at a remote system. It is event driven
on the rising edge of the Req parameter.
Note that if the access variable at the remote system has been given the attribute
‘ReadOnly’, this module will fail!

MMSWriteDT
This module writes a Date and Time into an access variable in the remote system. The
access variable should be linked to a single Date_And_Time type variable. Note that
this block does not write to the actual system time in the remote system. If you wish to
do that, then addition code is required at the destination system.

MMSDefAccVar
This module allows the definition of an access variable from application code. In
many circumstances you wish to create access variables in a controller at run time.

Chapter 15 - 14
Compact Control Builder Training

15.4 Communication to Other Devices


In this part we look at communication to other devices which may be on proprietary
buses or via a serial link using RS232 or RS485.
Such devices might be instruments, other controllers from other manufacturers or any
other devices which have communication protocols defined. It is also possible to have
a raw serial link and to build function blocks to interpret from devices which use no
specific protocol, printers, bar code readers etc.

The AC 800M controller has one single RS232 port available on the CPU itself, this is
COM3 and has an RJ45 connection point. If more RS232 ports are needed then the
Communication Interface module CI853 provides two ports per module. Several such
modules could be mounted on the CEX bus of the controller.
For other devices there may be specific Communication Interface modules provided
for installation on the CEX bus.

15.4.1 Overview
The principle of Connect and Read and Write blocks applies broadly to both access
variable and communication to other devices.
A series of communication libraries contain the function block types used to make
connections either to devices connected over a serial link using an RS232 port on the
controller or via a hardware communication interface module.

Hardware Libraries
For most communication it will be necessary to connect the appropriate hardware
libraries both to the project and then to the individual controllers. The ‘software’
library provides the function blocks and/or control modules, the Hardware Library
provides the definition for the Hardware Type of the connection device.
The communication interface CI853 requires the hardware library
CI853SerialComHwLib to be connected to the project and also to the controller
concerned.

Chapter 15 - 15
T530-15 Communication - RevG.doc

15.4.2 COMLICommLib
COMLI is a proprietary Master/Slave protocol implemented from the 1970’s by
SattControl/Alfa Laval Automation. It supports RS232 and RS485 transmission.
This library is used to communicate from AC800M to legacy SattControl systems.
Early SattControl PLCs include SattCon31, SattCon 05, SattCon 15, and SattCon200.

COMLIConnect makes the channel connection to the remote slave.


COMLIRead reads bit values or register values in the slave PLC on an event.
OMLIReadCyc reads bit values or register values in the slave PLC at regular
intervals (cyclically)
COMLIReadPhys reads scaling values and engineering units, for registers and analog
signals in the PLC
COMLIWrite writes bits or registers to the Slave PLC memory
COMLIWriteDT writes date and time to the Slave PLC

The COMLI protocol is established at a serial port using the COMLIHWLib:

The port will act as a COMLI Master and connected devices will be COMLI Slaves.

Chapter 15 - 16
Compact Control Builder Training

15.4.3 FFH1CommLib
FOUNDATION Fieldbus H1 is used to communicate to FOUNDATION Fieldbus
devices using the H1 protocol.

The Communication Interface module CI852 is mounted on the CEX bus to provide
physical connection to FFH1 devices. The hardware definition for this device is found
in the hardware library CI852FFh1HwLib:

The library has a definition for the CI852 and also for a FF device.

15.4.4 FFHSECommLib
Foundation Fieldbus HSE (High Speed Ethernet) interconnects measurement and
control equipment such as sensors, actuators and controllers. It serves as a Local Area
Network (LAN) for instruments used in process control and has a built-in capability to
distribute the control application across the network.

The Communication Interface module CI860 is mounted on the CEX bus to provide
physical connection to FFHSE devices. The hardware definition for this device is
found in the hardware library CI860FFHSEHwLib:

Chapter 15 - 17
T530-15 Communication - RevG.doc

15.4.5 INSUMCommLib
INSUMCommLib is used to communicate to the ABB INSUM Motor Control Centre.

INSUMConnect establishes a connection to an INSUM TCP/IP gateway.


INSUMRecieve subscribes to updates of measurement or status information from a
network variable in an INSUM device.
INSUMWrite writes to a network variable in an INSUM device on request.

The Communication Interface module CI857 is mounted on the CEX bus to provide
physical connection to INSUM system. The hardware definition for this device is
found in the hardware library CI857InsumHwLib:

15.4.6 MB300CommLib
MB300CommLib is used to communicate to Advant Master AC400 series controllers.
These have a proprietary bus called Masterbus300.

The communication interface module CI855 is mounted on the CEX bus to provide
physical connection to MB300 Network. The hardware definition for this device is
found in the hardware library CI855MB300HwLib:

Chapter 15 - 18
Compact Control Builder Training

15.4.7 ModbusCommLib
ModbusCommLib provides function block types which use the Modbus protocol.
Modbus is a serial communication protocol and uses a standard RS232 serial port.

Modbus might be implemented via COM 3 on the AC 800M controller or else


additional serial ports may be provided using the CI853 module mounted on the CEX
bus. In order to add the Modbus protocol to a serial port the hardware library
ModbusHWLib is used:

15.4.8 ModBusTCPCommLib
The ModBusTCPCommLib contains function blocks types to establish
communication with a system supporting the Modbus TCP protocol via Ethernet.

The communication interface module CI867 is mounted on the CEX bus to provide
physical connection to a Modbus TCP network. The hardware definition for this
device is found in the hardware library CI855MB300HwLib:

Chapter 15 - 19
T530-15 Communication - RevG.doc

15.4.9 ModemCommLib
This library is used to connect to a Modem via a serial port on the controller.

The function blocks may be used to dial up a remote system via a telephone link. Once
a connection has been established function blocks from the other communication
libraries may be used to transmit data over the phone line.
ModemDialUp establishes a connection.
ModemHangUp drops the connected line (hangs up).
ModemConnStat examines the status of the connection – (Connecting, Connected,
Disconnecting, and Disconnected)

Modem communication might be implemented via COM 3 on the AC 800M controller


or else additional serial ports may be provided using the CI853 module mounted on
the CEX bus.
Only the COMLI protocol supports modem dial-up facilities. In order to add the
COMLI protocol to a serial port the hardware library COMLIHWLib is used:

15.4.10 S3964CommLib
S3964 is a point-to-point serial protocol used in Siemens control systems and
products. It is applicable when integrating System 800xA with existing Siemens
installations.

S3964 might be implemented via COM 3 on the AC 800M controller or else


additional serial ports may be provided using the CI853 module mounted on the CEX
bus. In order to add the S3964 protocol to a serial port the hardware library
S3964HwLib is used:

Chapter 15 - 20
Compact Control Builder Training

15.4.11 SattBusCommLib
SattBus is a proprietary token passing bus, designed and implemented by
SattControl/Alfa Laval Automation during the early 1990’s.
Most applications which used it are found in the food industry where it was used to
support the control high density valve matrices (SattTop)
SattBus is also used in some SattControl PLC systems as the preferred serial
communications method. Unlike COMLI which is Master/Slave, SattBus gives peer-
to-peer communication with up to 124 nodes on one bus.

The functions blocks here use COMLI over SattBus. This enhances the message types
available and the throughput.

15.4.12 SerialCommLib
SerialCommLib may be used to establish communication over an RS232 serial port.
This library allows the user to write code for any serial protocol and then to
transmit/receive data over the serial port.

The serial communication might be implemented via COM 3 on the AC 800M


controller or else additional serial ports may be provided using the CI853 module
mounted on the CEX bus. In order to add the Generic Serial protocol to a serial port
the hardware library SerialHwLib is used:

Chapter 15 - 21
T530-15 Communication - RevG.doc

15.5 General Configuration of any Protocol


Given that there is so much flexibility in the medium and protocols available, it is
difficult in this document to describe each and every possibility. This section describes
the general methods for any types of connection.

15.5.1 Main Steps


1. Decide on the protocol required
2. Identify any Communication Interface hardware modules required and load the
appropriate hardware library for the unit.
(If the communication is via an RS232 serial port then either use COM 3 on the
AC 800M controller or else load the CI853 serial interface unit hardware library.)
3. Connect the hardware library to the controller.
4. Build the hardware on the controller.
5. Connect the protocol library to the controller (if required)
6. Configure the ports as needed.

Configure the connection using the function blocks or control modules provided by
the protocol library. For most arrangements:
Use a Connect module to make the connection to the appropriate port
Use a Read module to read data from the remote device via the connections
Use a Write module to write data to the remote device via the connection
The addressing rules for each device will differ, so it is necessary to be familiar with
the protocol being used and the method of addressing memory or variables in the
remote device.

Chapter 15 - 22
Compact Control Builder Training

15.5.2 How to Configure COM3 on a Controller


The channel may be defined at COM3 as follows:
1. Determine the serial protocol to use at this port and load the appropriate hardware
library. Right click on Hardware and select “Insert Library”:

2. Select the correct hardware library and click “Insert” (in this example COMLI)

3. Connect the hardware library to the controller:

4. Right click on Com 3 and select “Insert Unit”.

Chapter 15 - 23
T530-15 Communication - RevG.doc

5. Select the protocol from the list and click “Insert”.

6. Right click on Com 3 and select “Editor” to configure the port as necessary (e.g.
Baud, Stop Bits, Start Bits etc.)

7. Right click on the protocol (COMLI) and select “Editor” to configure the protocol
as necessary (e.g Master Address etc.)

Chapter 15 - 24
Compact Control Builder Training

15.5.3 Software Configuration


Communication function blocks may be used directly in programs. Some prefer to
encapsulate them in a control module and then use the control module.
1. Load the appropriate library for the protocol required.

2. Connect the library to the application that will contain the function blocks for the
Connect and Read/Write operations.

3. Insert the required function blocks into the program in a similar way to that for
access variable communication.

The Connect function block will require a channel address. This is the position of the
comms channel in the hardware. It is in the form “HardwareUnitNumber.Channel”.

The Modbus channel above is designated ‘0.3’ because it is on hardware unit no 0 and
position 3 (this is labelled COM3 on the physical CPU casing).

Chapter 15 - 25
T530-15 Communication - RevG.doc

Here are some further examples:

ModBus on Channel 0.3

COMLI on Channel 1.1

Siemens 3964R on Channel 1.2

Modem Dialup on Channel 2.1

Serial (Generic) on Channel 2.2

Serial Printer on Channel 3.1

Point to Point on Channel 3.2

Read/Write Blocks
These function blocks will require a remote system address referred to as the partner.
This is usually the numeric Slave address expressed as a string variable (not an
integer).
They will also require addresses for the data in the remote system.
Again these are string type variables, but the format will depend on the memory
organization and acceptable identifiers defined in the remote system.

Chapter 15 - 26
Compact Control Builder Training

15.5.4 Address Syntax


You may need to refer to the manufacturer’s literature for the addressing syntax.
COMLI
Address Bits in memory with ‘X%nnnn’ wher nnnn is the octal address of the bit
memory location.
Address Register in memory with ‘%Rnnnn’ where nnnn is the decimal register
number.
COMLI can read or write up to 512 Bits and up to 32 Registers in one telegram.
Always read or write in multiples of 8 bits. Do not address across Octade boundaries.
If you’re reading lots of bits then its best that they are contiguous to avoid several
telegrams being generated.

Modbus
%IX8#100 Bit input memory localation octal format
%QX8#100 Bit Output memory location octal format
%IX10#64 (input) Bit input memory localation decimal format
%QX10#64 (output) Bit Output memory location decimal format
%IX16#40 (input) Bit Input memory location Hexadecimal format
%QX16#40 (output) Bit Output memory location hexadecimal format

%MW8#55 Memory Word (Register) Octal format


%IW8#55 Input Word Octal format
%QW8#5 Output Word Octal format
%MW10#45 Memory Word Decimal format
%IW10#45 Input Word Decimal format
%QW10#45 Output Word Decimal format
%MW16#2D Memory Word Hexadecimal format
%IW16#2D Input Word Hexadecimal format
%QW16#2D Output Word Hexadecimal format

Chapter 15 - 27
T530-15 Communication - RevG.doc

15.6 Configure a Generic Serial Communication Channel


It is possible to communicate with other equipment using an open serial channel on
the controller. The following function blocks are defined in the Control Builder:
SerialConnect
To open and close a defined serial communication channel.
SerialListen
For listening, that is receiving a string sent from a sending device.
SerialListenReply
For listening, that is receiving a string sent from a sending device to the <Rd>
parameter. When data is received, a reply of a string type variable is sent to the
sending device.
SerialSetup
To change settings for checksum calculation and echo handling while sending and
receiving strings with any of the following function blocks: SerialWriteWait,
SerialListenReply, SerialWrite and SerialListen.
SerialWrite
To write a string to a receiving device.
SerialWriteWait
To send a string type variable via the <Sd> parameter to a receiving device. The
function block waits for a reply from the receiving device which will be received
through the parameter <Rd>.

15.6.1 Example Bar Code Reader


In this example, imagine a Bar Code Reader is connected via a serial port into the
controller. The Bar Code Reader occasionally sends a transmission with bar code
information to the controller. The controller will receive this message as a string.
To connect to the correct serial channel a SerialConnect function block is used:

Chapter 15 - 28
Compact Control Builder Training

To establish connection, activate the En_C parameter (setting it to True) and specify
the physical channel with the Channel parameter via a connected string variable
having the Channel address as an initial value.

A reference to the connection is put in the Id parameter to be used by other function


blocks in the chain.

Use the SerialListen function block for listening, that is receiving a string sent from a
sending device.

EndChar is used to set which character is to define the end of a message. The
setting of EndChar only applies when the MsgLength parameter is set to 0.
The valid range of EndChar is 0 - 255, where 0 = none and 13 = CR (ASCII).
If MsgLength is set to a value greater than 0, the value defines the length of the
message. If MsgLength is set to 0, the message can be of any length. The end
character defined by the EndChar parameter indicates the end of the message.
NoOfTrailChar sets the number of characters after the end character. This
parameter is ignored if Checksum validation is set using the function block
SerialSetup.

Chapter 15 - 29
T530-15 Communication - RevG.doc

Chapter 15 - 30
Compact Control Builder Training

Exercise 15.1 Setting up MMS Communication

15.1.1 Description
Define access variables in one application and read the data from another application
in a different controller.
Define a structured data type as we did before. This data type will hold all of the
information we wish to pass between applications. We will be passing the values of
Reactor Tank Level and the Reactor Tank Temperature.

15.1.2 Legend
> Indicates when you go from one menu to a sub-menu
Italic Indicates object and file names
“ “ Indicates dialog box buttons, tabs, menus etc.
Bold Indicates important topics
Indicates start/explanation of student activity

Exercise 15.1 - 1
J410-15 Exercise 15.1 - RevA2draft.doc

15.1.3 Exercise Steps


Access variables are declared for an application to allow other applications to read and
write data to/from another – regardless of what controllers the applications are
assigned to. MMS communications occurs over the Control Network.

15.1.3.1 Define the Structured Data Type

Define a new data type called MMSDataType in the Sxx_ProjectLib.


1. Right click the data types icon under the SxxProjectLib 1.1-0, and select “New
Data Type…”

2. In the dialog box type MMSDataType and click “OK”.

Define the component data elements as “Temperature”, “Level”, “Volume”, and


“Message”.
1. Double click the MMSDataType type.

2. Type in the following components:

3. Save and close the Data Type editor.

Exercise 15.1 - 2
Compact Control Builder Training

Create a new global variable in the Sxx_ReactorApp application called gSxx_Product


of your new data type. This variable will hold the information for your system.
1. Double click the Sxx_ReactorApp

2. Create the variable as below:

15.1.3.2 Setup the Communication at the AC800PEC

Create a new code pane in your Tank program of either ST or FBD and name it
“MMS_Comm”.
1. Navigate to the programs icon on the Sxx_ReactorApp, and double click the Tank
program:

2. Right click on the last codeblock tab and select Insert…

3. Type the name of the codeblock(“MMS_Comm”) and select the FBD language:

Exercise 15.1 - 3
J410-15 Exercise 15.1 - RevA2draft.doc

Assign the reactor temperature and the level into your gSxx_Product variable.
Here is one possible solution using FBD using the “move” function:
1. Instantiate 2 “Move” functions.

2. Connect each input to a local variable which holds the desired data values.

Connect the outputs to the correspondent element of the global variable gSxx_Product.

Create one access variable in your controller called aSxx_Product and set the path to
the gSxx_Product global variable.
1. Access variables are defined in Control Builder M under the “Controllers” object.
Double click the Access Variables Icon to open the editor

2. Type the name of the new access variable.

Exercise 15.1 - 4
Compact Control Builder Training

3. To set the path click on the “Insert Path From Tree” button.

4. Set the attribute to ReadOnly.

5. Check for errors, if there is any, fix it.

15.1.3.3 Setup the Communication at the receiving Softcontroller

At the chapter “Task Assignment” we made a softcontroller.


Create a new program “ReadMMS” and connect the MMSCommLib and your
Sxx_ProjectLib to this new application.

Create the following local variables in the program to hold the information required
for MMS communications.

Exercise 15.1 - 5
J410-15 Exercise 15.1 - RevA2draft.doc

Instantiate one instance of an MMSConnect function block and one instance of an


MMSReadCyc function block. Both are located in the MMSCommLib library. Make
the required connections to the function blocks.
Here is one possible solution using FBD.
1. Instantiate an MMSConnect block from the MMSCommLib.

2. Instantiate a MMSReadCyc block from the MMSCommLib.

3. Connect the blocks as shown:

Exercise 15.1 - 6
Compact Control Builder Training

15.1.3.4 Download your project to the controllers

Download your project to the controllers and take Control Builder M to the on-line
mode. Open the ReadMMS program and check your communications.

1. To check if the communication is ok, look at the Valid, Error and Status pins.

2. If there are any communication errors, check the initial values of the variables
involved on communication.

Exercise 15.1 - 7
J410-15 Exercise 15.1 - RevA2draft.doc

15.1.3.5 Add the power to the communication (optional)

When we added the ML/SL interface we calculated the power. Add this power to the
communication. You have to adapted also the MMSDataType

Exercise 15.1 - 8

You might also like