Configuring MicroSCADA For Modbus Slave Protocol
Configuring MicroSCADA For Modbus Slave Protocol
Notice 1
The information in this document is subject to change without notice and should not
be construed as a commitment by ABB. ABB assumes no responsibility for any error
that may occur in this document.
Notice 2
This document complies with the program revision 4.0.
Notice 3
Additional information such as Release Notes and Last Minute Remarks can be
found on the program distribution media.
Trademarks
1 Introduction 1
2 Safety information 2
3 Instructions 3
4 Technical description 4
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide Contents
Contents:
1. Introduction ...............................................................................1
2. Safety information .....................................................................3
2.1. Backup copies ...............................................................................3
2.2. Fatal errors ....................................................................................3
3. Instructions ................................................................................5
3.1. General .........................................................................................5
3.2. Configuration .................................................................................5
3.2.1. Base system configuration .................................................5
3.2.2. Communication system configuration ................................8
3.3. After configuration .......................................................................11
3.4. Start-up .......................................................................................12
3.5. How to test the configuration .......................................................12
4. Technical description .............................................................15
4.1. Modbus protocol ..........................................................................15
4.2. Communication ...........................................................................15
4.2.1. CPI application program ..................................................15
4.2.2. Connection to a MicroSCADA base system ....................15
4.2.3. Data flow ..........................................................................16
4.2.4. Addressing schematics with Modbus protocol .................17
4.2.5. Device communication attributes .....................................18
4.3. Command procedures .................................................................21
4.3.1. Command procedures in COM 500 .................................21
4.3.2. Command procedures in SYS 500 ..................................22
4.3.2.1. Command procedures for process data .............22
4.3.2.2. Command procedures for commands ................24
4.4. Function codes ............................................................................26
4.4.1. Function codes for process data ......................................27
4.4.1.1. Function code 01 - Read coil status ...................27
4.4.1.2. Function code 02 - Read input status ................28
4.4.1.3. Function code 03 - Read holding registers ........28
4.4.1.4. Function code 04 - Read input registers ............29
4.4.2. Function codes for commands .........................................29
4.4.2.1. Function code 05 - Forcing a coil .......................29
4.4.2.2. Function code 06 - Modify register content ........30
4.4.2.3. Function code 08 - Diagnostics ..........................30
4.4.2.4. Function code 11 - Fetch communication event
counter ...............................................................32
4.4.2.5. Function code 15 - Force multiple coils ..............33
4.4.2.6. Function code 16 - Modify multiple registers ......33
4.5. Status codes ...............................................................................33
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 1. Introduction
1. Introduction 1
Using this manual
This manual should be read when you want to use the Modbus slave protocol and
need information related to it. It describes how to configure the base system and the
Modbus slave application for communication between them and with the Modbus
master.
In addition to this configuration, the base system needs to be configured for the
process communication. For information about this subject, refer to other manuals,
for example the Application Objects manual or the COM 500 Engineering manual.
The Modbus master needs to be configured as well.
Referenced manuals
The following MicroSCADA manuals should be available for reference during the
use of this manual:
• System Configuration manual
• System Objects manual
• Application Objects manual
Modbus slave
The Modbus slave protocol is mainly used for upper level communication between
COM 500 or SYS 500 and a network control system as illustrated by Figure 1.-1. In
MicroSCADA the Modbus slave protocol is implemented by using the CPI protocol
development environment.
)LJ 7KH0RGEXVPDVWHUVHHVWKH1(7XQLWDQGWKHSURFHVVEHKLQGLWDVDVODYH
The data from the process activates a certain event channel and command procedure
in the base system. This command procedure sends the information forward to the
Modbus slave CPI application program and the Modbus master.
1
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
1. Introduction Configuration Guide
In COM 500 all protocol specific objects are created automatically (e.g. command
procedure, event channels). If SYS 500 is used, the user have to create an
application, which forwards the data between the process device and the Modbus
protocol.
2
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 2. Safety information
2. Safety information
This chapter gives information about the prevention of hazards.
2
2.1. Backup copies
We suggest that you take backup copies before making any changes, especially the
ones that might have side effects. Software and data need to be copied to another
place, usually to a CD or a backup tape. A writable CD and DAT tape are commonly
used.
Backup copies make it easier to restore application software in case of a disk crash
or any other serious failure when the stored data is lost. Therefore, it is
recommended that backup copies are taken regularly.
There should be at least two system backup copies and two application copies. A
new backup is copied over the oldest backup. This way the latest version is always
available, even if the backup procedure fails.
Detailed information on how to take backup copies should be delivered to the
customer with the application.
System backup
Usually a system backup is taken after the application is made. A backup should be
taken again when changes are made to the MicroSCADA system. For example, if
the driver configuration or the network set-up is changed.
Application backup
An application backup is taken simultaneously with the system backup after the
application is made. A backup should be taken again when changes are made to the
application. For example, if pictures or databases are edited or new pictures are
added.
Shut down the MicroSCADA main program. If this cannot be done in the
MicroSCADA Control Panel, try to end the task in Windows NT™1 Task
Manager.
3
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
2. Safety information Configuration Guide
Shutting down the base system computers by switching off the power might damage
the files.
In Windows NT, the data kept in the main memory at the moment of a fatal error
is placed in the drwtsn32.log file. It is placed in a system folder, for example,
Winnt. Analyse and copy the data in this file.
4
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 3. Instructions
3. Instructions
3.1. General
Requirements
The following software is required:
• MicroSCADA Software revision 8.4.1 or newer
• Operating system - Windows NT
• CPI Modbus slave CPI application program revision 1.0
The Modbus slave application can be installed either into the same computer as the
MicroSCADA base system or into a separate computer.
Installation
Modbus Slave software is installed, when SYS 500 or COM 500 is installed.
Modbus_Slave.exe and configuration file config.ini are installed to /sc/prog/
modbus_slave directory. If an older config.ini file is found, it will not be
overwritten. Config$ini file is created from a new installation file.
3.2. Configuration
General
The configuration can be divided into two parts:
• Base system configuration
• Communication system configuration
The base system configuration can be made by using SCIL statements. The
communication system configuration is made by configuring the Modbus slave CPI
application program. The configuration must be done this way when the used
application is COM 500 or SYS 500.
General
Each base system has a set of objects that specify the base system and its
environment, hardware and software, as well as the physical and logical connections
of the base system and its applications.
The base system objects are defined with SCIL commands in the
SYS_BASCON.COM file, which is executed every time the base system is started.
5
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
3. Instructions Configuration Guide
With a few limitations, you can also define and modify the base system objects any
time when MicroSCADA is running. During the operation, the base system objects
are in the primary memory of the base system computer.
The Modbus slave CPI application program emulates an RTU type station which
means that the interface towards the base system is similar as with an RTU station.
The CPI application program requires a node of its own. Communication between
this node and the base system takes place via a LAN link.
Configuration steps
To configure SYS_BASCON.COM:
Define a node.
Define a monitor.
Define an application.
Define the RTU stations. The number of RTU stations can be the same as the
number of the connected process units. This way the information related to a
certain process unit can be routed to the corresponding station in the NET unit.
Thus, the Modbus master can differentiate the information from different
process units. In the COM 500 configuration it is possible to use a maximum of
4 NCC stations.
The definitions are made in the example below. For more information on the system
objects, see the System Objects manual.
Example
The following is an example of the SYS_BASCON.COM file for communication
with the Modbus slave protocol. An application CPI_TEST is defined. In this
example two stations are configured.
;***********************************************************************
;
; SYS_BASCON.COM
; BASE SYSTEM CONFIGURATION TEMPLATE
;
;***********************************************************************
;***********************************************************************
;
; COMMUNICATION LINKS
#CREATE LIN:V = LIST(- ;REQUIRES TCP/IP
LT = "LAN" ;FOR SYS-SYS AND LAN FRONTEND
6
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 3. Instructions
;***********************************************************************
;
; COMMUNICATION NODES
#LOOP_WITH I = 1..5
#CREATE MON’I’:B = LIST(-
TT = "LOCAL",- ;TRANSLATION TYPE
DT = "X") ;X MONITOR
@MON_MAP(%I) = -1
#LOOP_END
#LOOP_WITH I = 6..10
#CREATE MON’I’:B = LIST(-
TT = "LOCAL",- ;TRANSLATION TYPE
DT = "VS") ;VISUAL SCIL MONITOR
@MON_MAP(%I) = -1
#LOOP_END
;***********************************************************************
;
; APPLICATIONS
;***********************************************************************
; STATIONS
;***********************************************************************
7
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
3. Instructions Configuration Guide
General
Unlike configuring a protocol implemented in PC-NET, configuring the
communication system for the Modbus slave protocol takes place by configuring the
CPI application program. This can be done by setting the configuration parameters
of the file config.ini located in the prog\Modbus_Slave directory. Config.ini can be
edited by using a text editor, for example, Notepad. The parameters should be set
before you start the CPI application program.
The communication parameters of a Modbus slave CPI application program can be
divided into four groups:
• Own Node Parameters
• Base System Parameters
• Serial Port Communication Parameters
• Modbus Slave Parameters
Parameters are grouped in the configuration file into sections, which are separated
by section headers written inside square brackets. For example, the serial port
communication parameters are listed below the section header
[SerialPortCommPar]. The names of the sections and parameters should not be
modified. If these names are modified, the program will use default values.
8
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 3. Instructions
The Stop_bit parameter value is not the actual amount of stop bits.
In case of problems with the COM port, try to set the COM port configuration of the
Windows NT to be the same as in the Initialisation file.
9
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
3. Instructions Configuration Guide
stn_no_1 determines the station number of the first station and stn_no_2 the
number of the second station. The station numbers do not need to be sequential.
• Format_analog. The format of analog values. Valid values 5, 6 and 7 as shown in
Table 3.2.2-1 below.
* The most significant byte - the least significant byte order (and vice versa).
Debug parameters
• Debug_info. This parameter is only for debugging purposes and should be given
the value zero.
If the user wants to see the communication handling of the Modbus slave, value
20714 must be set to this parameter. We recommend only temporary use of this
debug mode.
Examples
This example shows the communication system configuration related to the example
of base system configuration earlier in this document. Two Modbus stations are
configured in this example.
[OwnNodeParameters]
own_node_no = 3
own_station_no = 203
[BaseSystem1]
basesystem_node_no = 9
basesystem_station_no = 209
tcp_ipadd = 194.142.148.36
application_number = 1
[SerialPortCommPar]
port_name = COM1
baud_rate = 1200 parity = 0
stop_bit = 0
data_bits = 8 flow_control = 0
[ModbusSlavePar]
address_offset = 0
modbus_master = 1
no_of_stns = 2
10
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 3. Instructions
stn_no_1 = 1
stn_no_2 = 2
format_analog = 5
[Debug]
debug_info = 0 3
In order to add one more station with address 10 under the Modbus slave parameter,
add the following information:
no_of_stns = 3
stn_no_1 = 1
stn_no_2 = 2
stn_no_3 = 10
Create and define input and output process objects for the process
communication. This is usually done when creating the station picture by using
standard functions from an application library.
Define command procedures for the event channels. For more information about
how to program the command procedures and values of the attributes, refer to
Chapter 4 of this document.
If COM 500 is used, the cross-references between the process objects and the
Modbus slave will be made in the COMTool. COM 500 creates the needed event
channels and command procedures automatically. For more information, refer to the
COM 500 Engineering manual.
11
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
3. Instructions Configuration Guide
3.4. Start-up
The Modbus Slave protocol runs in an external executable program and it must be
started separately. An automatic start of Modbus_Slave.exe can be done by
attaching a program link to the Start Menu, Programs, Startup menu in Windows.
Define the base system, monitors and application, if they are not the same as
defined for the Modbus slave.
Define the station type for the PLC stations (STY object number 28).
Define a PLC station for each station configured in the Modbus slave.
The following communication system configuration is required:
Define the PLC stations with the same logical address as the RTU stations.
The station addresses (SA attribute) of the PLC stations should equal to the stn_no_*
parameters of the Modbus slave stations. Other attributes of the Modbus master line
and PLC stations should also match the configuration of the Modbus slave. For more
information on the attributes, see the System Objects manual.
([DPSOH
Listed below is an example for defining the station type and two PLC stations.
;Define station type
#CREATE STY:V = LIST(-
NA = "PLC",-
DB = "RTU" )
#CREATE STY28:B = %STY
12
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 3. Instructions
13
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 4. Technical description
4. Technical description
4.2. Communication
15
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
4. Technical description Configuration Guide
)LJ 'DWDIORZEHWZHHQWKHSURFHVVGHYLFHVDQGWKH0RGEXVPDVWHU
Input data
When input data, for example, indications and measured values are sent from the
process devices to the Modbus master, the following steps are taken:
The process devices sent the data to the MicroSCADA process database.
The event channel executes a command procedure. Some of the attributes of the
process object are given as arguments to the command procedure.
The command procedure sends the data to the database of the CPI application
program based on specific cross-reference information.
The CPI application program sends the data to the Modbus master.
The cross-reference information is needed to deliver data to the database of the CPI
application program, for example, object address and message type. The number of
event channels and command procedures needed to deliver data to the master
depends on the application. One solution is to have one command procedure for each
process object type. Examples of the command procedures are given later in this
16
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 4. Technical description
document. If COM 500 is used, all the needed command procedures and event
channels will be created automatically.
Output data
When output data, for example, object commands and analog setpoints are sent
from the Modbus master to the process devices, the following steps are taken:
The event channel executes a command procedure. Some of the attributes of the
process object are given as arguments to the command procedure.
The command procedure sends commands to the process devices by setting the
corresponding output process object(s) and, if required, sends a confirmation to
the Modbus master via the CPI application program.
Cross-reference data can also be used with commands. It can contain, for example,
information of the logical names and indices of the output process objects. Examples
of the command procedures are given later in this document.
17
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
4. Technical description Configuration Guide
)LJ 7KHDGGUHVVLQJVFKHPDZLWKDQDORJYDOXHVLQWKH0RGEXVSURWRFRO
Offset parameter is also used with binary data. In MicroSCADA the discrete inputs
and coils of the Modbus slave are mapped to RTU like blocks. Possible block
address values are 1...125 and bit values 0...15. The Modbus protocol does not have
block definition for binary data, it only uses data grouping of 8 bits bytes in query
responses. Used memory area in protocol definition is 0xxxx. Coils and inputs are
addressed beginning from 1. However, in protocol queries the addressing begins
from bit 0.
If MicroSCADA is used as a master, the bit 0 in query and master database
configuration means block 1, bit 0 address in COM 500. In case of a 3rd party
master, the bit address is 1 in the slave, if the offset parameter is used. This schema
is used, if the master can define only binary addresses beginning from 00001.
It must be remembered that the defined topic base address in MicroSCADA master
affects the used bit address in the process object. For example, if the used base
address is 1 and bit 4 is wanted from the slave database, the BI process object bit
address is 4 (block 1). However, if the base address is 2 and the wanted input bit is
4, the used bit address must be 3. In this case block 1 begins from bit 2 instead of 1.
18
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 4. Technical description
$9 $QDORJ9DOXH
Changes in analog measured values that are to be sent to the Modbus master are
written to this attribute. A vector is assigned to the AV attribute consisting of a time
stamp and analog value. The current value of the AV attribute with a certain address
(block number) can also be read back. Note that a read operation only returns the
VALUE of the attribute (not a vector).
Data type: Vector
Value: A vector of three elements: 4
(TIME, VALUE, STATUS)
TIME Time stamp for the process object whose
value is sent
Time as RTU_ATIME format
VALUE Analog value (scaled to -32768…32768)
STATUS Status code as reported to the master.
Index range: 1…2000
Access: Write only
([DPSOH
;set AV block nr. 100 to 1234, status = OK (= 0 )
#SET STA99:SAV(100) = (RTU_ATIME(%RT,%RM),1234,0)
,' ,Q'LFDWLRQV
Indication changes that are to be sent to the Modbus master are written to this
attribute. The content of the attribute can be read back to a SCIL variable. Note that
the result of a read operation is a single integer rather than a vector. The integer
variable is a 16-bit bitmask that represents the state of all bits in this block.
Data type: Vector
Value: A vector with 4 … 6 elements as follows:
(TIME, BIT_NR, BIT_VAL, STATUS
[,ERMI_ENABLED[,TIME_QUALITY]])
TIME Time stamp for the process object whose value is
sent.
Time is given in RTU_ATIME format
BIT_NR The bit number for the changed bit (0...15)
BIT_VAL 0...1
[Note that the bit can be converted to a double-
indication by adding 12810 to BIT_NR, which is
the number of the lower bit (0,2,4,...14). This
feature is included for compatibility with older
(ADLP-180) slave protocols. It is not
recommended to use it in new applications.]
19
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
4. Technical description Configuration Guide
,8 ,Q8VH
The IU attribute indicates whether the station is in use or not.
Data type: Integer
Value: 0 = not in use
1 = in use
Default value: 0
Access: No limitations
', 'DWDEDVH,QLWLDOLVHG
The CPI application program sets DI to 0 at start-up. When MicroSCADA has
updated all the values in the CPI database, it sets this attribute to 1.The CPI
application program does not process any commands from the Modbus master
before DI equals 1.
Data type: Integer
Value: 0 or 1
Access: No limitations
3& 3XOVH&RXQWHU
Pulse counter values that are to be sent to Modbus master are written to this attribute.
The PC attribute is assigned a vector consisting of a time stamp, an end of period
flag and a pulse counter value.
The content of the attribute can be read back to a SCIL variable. Note that the result
of a read operation is a single integer rather than a vector. The integer variable
contains the last PC-value that was written to this block.
The pulse counter values are be stored as analog values in the CPI database. There
should not be any address clash between analog and pulse counter values.
Data type: Vector
Value: Vector (TIME, VALUE, STATUS)
Parameters are as in the AV attribute.
Index range: 1...2000
Access: Write only
20
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 4. Technical description
'' 'RXEOH,QGLFDWLRQ
Double indications are sent to the CPI database using this attribute.
Data type: Vector
Value: (TIME, BIT_NR, BIT_VAL, STATUS
[,ERMI_ENABLED[,TIME_QUALITY]])
BIT_NR is 0, 2, 4, 6, 8, 10, 12 or 14
BIT_VAL is 0,1,2 or 3
4
Other parameters as in the ID attribute
Index: 1…125 (indication block number)
Access: Write only
)LJ &20UHURXWHVWKHVLJQDOV
If Modbus slave protocol is used with COM 500, the command procedures available
for COM 500 are used. The cross-reference information is entered in the Signal
Cross-Reference Tool. For more information, refer to the COM 500 Engineering
manual. Table 4.3.1-1 shows the used COM 500 command procedures and event
channels.
21
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
4. Technical description Configuration Guide
22
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 4. Technical description
The FI attribute is used for storing the object index. Modbus commands activate
digital and analog process input objects in MicroSCADA. The "real" output process
object has the same logical name as this input (i.e. it belongs to the same group), but
a different index. This index is kept in the FI attribute of the input object.
Analog inputs
Analog values are sent to the Modbus master as integers in the range -32768…
32768. All the analog signals must be scaled to this range (or part of it).
Analog values are sent to the Modbus master by using the AV attribute. The value
4
set to the AV attribute is:
(TIME, VALUE, STATUS)
The block number of the analog input is set to the index of the AV attribute.
Time and status information is not supported in the Modbus protocol and therefore
it is not sent to the master. However, status information will be stored in the CPI
application program and the analog value will be sent to the master only if the status
is OK.
All the analog values are connected to the same event channel/command procedure
combination. The command procedure is activated each time the process object is
updated. It reads the updated value, scales it and sends it to the CPI application
program. An example of the command procedure is listed below:
;read cross-reference data
@STA_NR = DEC_SCAN(SUBSTR(’LN’:PFX(’IX’),1,3))
@BLK_NR = DEC_SCAN(SUBSTR(’LN’:PFX(’IX’),4,3))
@VAL = ’LN’:POV(’IX’)
@T = RTU_ATIME(%RT,%RM)
Single indications
All the binary inputs are connected to an event channel/command procedure
combination. The command procedure is activated each time the process object is
updated. It reads the updated value and sends it to the CPI application program.
Single indications are sent to the Modbus master by using the ID attribute. The
value set to the ID attribute is:
(TIME, BIT_NUMBER, BIT_VALUE, STATUS)
The block number of the single indication is set to the index of the ID attribute.
An example of a command procedure handling single indications is listed below.
Note that zero status is assumed.
;read cross-reference data
@STA_NR = DEC_SCAN(SUBSTR(’LN’:PFX(’IX’),1,3))
@BLK_NR = DEC_SCAN(SUBSTR(’LN’:PFX(’IX’),4,3))
@BIT_NR = DEC_SCAN(SUBSTR(’LN’:PFX(’IX’),7,2))
@T = RTU_ATIME(%RT,%RM)
23
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
4. Technical description Configuration Guide
It is not possible to send time stamp and status information in Modbus messages.
The CPI application program ignores time stamp information. Status information,
however, is handled by the CPI application program to some extent.
Double indications
Double indications are not supported directly in the Modbus protocol. Double
indications are converted into two single indication messages by the CPI application
program.
Double indications are sent to the Modbus master by using the DD attribute. The
value set to the DD attribute is:
(TIME, BIT_NUMBER, BIT_VALUE, STATUS)
The block number of the single indication is set to the index of the DD attribute.
;read cross-reference data
@STA_NR = DEC_SCAN(SUBSTR(’LN’:PFX(’IX’),1,3))
@BLK_NR = DEC_SCAN(SUBSTR(’LN’:PFX(’IX’),4,3))
@BIT_NR = DEC_SCAN(SUBSTR(’LN’:PFX(’IX’),7,2))
It is not possible to send time stamp and status information in Modbus messages.
The CPI application program ignores time stamp information. Status information,
however, is handled by the CPI application program to some extent.
Pulse counters
The pulse counter values are treated as analog values by the Modbus slave. The
pulse counter values are sent to the Modbus master by using the PC attribute. The
value set to the PC attribute is:
(TIME, VALUE, STATUS)
The block numbers of analog and pulse counter objects should be different since
they are both treated as analog values.
;read cross-reference data
@STA_NR = DEC_SCAN(SUBSTR('LN':PFX('IX'),1,3))
@BLK_NR = DEC_SCAN(SUBSTR('LN':PFX('IX'),4,3))
24
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 4. Technical description
It is also possible to utilise input data to perform arbitrary internal operations in the
application program.
The procedures that are presented below cover the basic cases, when SINCDAC
commands and setpoints are mapped directly to the corresponding output objects. If
a more complex relationship between the input and output objects is needed, it will
be necessary to build application specific command procedures.
Process commands
Process commands from the Modbus master are handled as digital inputs, with
4
object address (OA attribute) in the range 0…2000 (object commands). When the
CPI application program receives a process command message, it reads the object
number (register address) from the message. It also activates a MicroSCADA
process object with the corresponding object address and sets its value according to
the command (1 = ON, 0 = OFF).
The command is transferred to a binary output process object with a command
procedure. The cross-reference between the input and output object is accomplished
by using the same logical name, but different indexes, for the input and output
objects. Input objects hold the index of the corresponding output object in their FI
attribute. This makes it possible to use a common command procedure for most
process commands. Only those commands that require validity checking or other
special processing will need individual SCIL procedures.
Below is a command procedure that is used when no special processing is needed.
;read cross-reference data
@OBJ_IX = ’LN’:PFI(%IX)
Analog setpoints
Analog commands from the Modbus master can be received by analog input process
objects. The object address range start from 3000 (decimal). The block number
(register address) is added to get the address that is used for a particular setpoint.
Analog setpoints are received as integers in the range -32768… 32768 and may have
to be scaled.
An example of a command procedure for handling analog setpoints:
;read cross-reference data
@OBJ_IX = ’LN’:PFI(%IX)
;scale value
@VAL = %AI-’SC’:XSC(1)
@VAL = %VAL / (’SC’:XSC(2)-’SC’:XSC(1))
@VAL = %VAL * (’SC’:XSC(4)-’SC’:XSC(3))
@VAL = %VAL + ’SC’:XSC(3)
25
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
4. Technical description Configuration Guide
These memory areas can be accessed by using different function codes as shown in
Table 4.4.-2
26
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 4. Technical description
Table 4.4.-3 Function codes and the corresponding process object types
Function Code Description Process Object Type
Table 4.4.-4 shows the subfunction codes of the function code 8. This function does
not affect the CPI database, which means that the process database is not affected.
Some subfunction codes update the diagnostic counters in the CPI database.
27
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
4. Technical description Configuration Guide
28
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 4. Technical description
* The most significant byte - the least significant byte order (and vice versa). 4
The format of analog data is defined in Modbus_Slave with the Format_analog
parameter in the config.ini. This parameter affects all the analog values.
The format configured in the configuration will be used. If format 5 is used each data
will be two bytes long. The format has to be chosen based on the master. All the
above formats are implemented in the MicroSCADA master.
If format 6 or 7 is used, it must be remembered that a single value takes two blocks
from the address base.
The query message contains the following information:
• Slave address
• Function code
• Start register address high
• Start register address low
• Number of registers high
• Number of registers low
• CRC - error check
Slave address is the logical station address from which the data is requested. The
start register address is same as the block number of the first process object. For
example, if the block number of a process object is 10, the register address will be
10 as well.
The address range is 1…2000. Any request of data outside this range will result in
exception response.
The number of bytes that can be requested in one message depends on the master.
The slave has no limitation on this.
29
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
4. Technical description Configuration Guide
will forward these commands to the process side. For more information about this
subject, see the Process commands in Section 4.3.2.2.
The query message contains the following information:
• Slave address
• Function code
• Coil address high
• Coil address low
• Forcing value high (00 or FF hexadecimal)
• Forcing Value low (00 hexadecimal)
• CRC - error check
The slave address is the logical address of a station to which the command is sent.
The coil address is the object number of the process object. For example, if the block
number of an object command is 100, the coil address will be 100 as well. The
normal response message to this query is an echo of the query itself.
At the slave’s side this command will modify the corresponding analog input
process object with the object address 3000 analog offset + register address.
30
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 4. Technical description
This message sent to any of the slaves in MicroSCADA forces all the stations
connected to it out of the Listen Only mode. However, restart will be considered as
a station-specific message.
31
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
4. Technical description Configuration Guide
• Slave number
• Function code
• Subfunction code high
• Subfunction code low
• Data field high
• Data field low
• CRC - error check
Subfunction code 13 - Return bus communication error count
The response data field returns the quantity of Modbus exception responses. The
query and return fields are the same as in code 12.
Subfunction code 14 - Return slave message count
The response data field returns the quantity of messages addressed to the slave
which the slave has processed since start-up. The query and response fields are the
same as in code 12.
Subfunction code 15 - Return slave no response count
The response data field returns the quantity of messages addressed to the slave for
which no response has been returned. The query and response fields are the same as
in code 12.
For subfunction codes 03, 16, 17, 18, 19 and 20the data field of the response will be
filled with zeros because these function codes are either hardware dependent or not
relevant.
32
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide 4. Technical description
• Status high
• Status low
• Event count high
• Event count low
• CRC - error check
There is no individual counter for each station connected to MicroSCADA but only
one event counter common to all the stations.
4
4.4.2.5. Function code 15 - Force multiple coils
This function code sets a number of commands in one Modbus message. The current
version of MicroSCADA Modbus master does not support this function code. The
slave treats these commands as digital inputs and stores them also as such. This
function code is equivalent to function code 5 described earlier.
The maximum number of commands that can be sent in one message is limited to
50. If the master tries to send more than 50 commands in one message, an exception
response with an error code will be sent to the master. The valid address range is
1…2000. Any value outside this range will result in an exception response.
Status codes
The following status codes are defined:
13450 SPIC_INVALID_INDEX_RANGE
13451 SPIC_UNKNOWN_SPI_ATTRIBUTE_VALUE
13455 SPIC_UNKNOWN_SPI_ATTRIBUTE
13459 SPIC_FCOM_COLDSTART_RECEIVED
13469 SPIC_ARGUMENT_EXPECTED
13470 SPIC_TOO_MANY_ARGUMENTS
13484 SPIP_COMMUNICATION_WITH_CS_LOST
13485 SPIP_COMMUNICATION_WITH_CS_ESTABLISHED
14016 NETW_UNKNOWN_DESTINATION_DEVICE
When used with COM 500, only the following error codes are available:
13459 SPIC_FCOM_COLDSTART_RECEIVED
13484 SPIP_COMMUNICATION_WITH_CS_LOST
13485 SPIP_COMMUNICATION_WITH_CS_ESTABLISHED
33
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide Index
Index
Page
$
Address_offset ...........................................................................................................9, 17
Addressing schematics .................................................................................................. 17
Analog
&RPPDQGV ............................................................................................................22, 25
,QSXWV ....................................................................................................................22, 27
2IIVHWV ......................................................................................................................... 30
6HWSRLQWV ........................................................................................................ 17, 25, 30
9DOXHV ............................................................................................... 17, 18, 20, 23, 29
Analog Value ................................................................................................................. 19
AV ..................................................................................................................... 19, 20, 23
%
Base system as Modbus master ..................................................................................... 12
Binary inputs ................................................................................................................. 23
Bit number ..................................................................................................................... 22
Block number ..........................................................................................................17, 22
Broadcast mode ............................................................................................................. 27
&
Clear counters and diagnostic register ........................................................................... 31
Coil address .............................................................................................................28, 30
COM 500 ......................................................................................................1, 17, 21, 33
Command procedures .................................................................................................... 24
Communication attributes ............................................................................................. 18
Communication frontend ............................................................................................... 15
Communication Programming Interface (CPI) ............................................................. 15
Config.ini ...................................................................................................................8, 29
Configuration ................................................................................................................... 5
Configuration test .......................................................................................................... 12
CPI application .............................................................................................................. 15
CPI database ............................................................................................................20, 26
CRC error ................................................................................................................28, 31
Cross-reference information .......................................................................................... 16
'
Data flow ....................................................................................................................... 16
Database Initialised ....................................................................................................... 20
DD ...........................................................................................................................21, 24
Debug parameters .......................................................................................................... 10
DI ................................................................................................................................... 20
Diagnostics .................................................................................................................... 30
Digital
&RPPDQGV .................................................................................................................. 22
,QSXWV ............................................................................................................. 25, 27, 33
Directory
?SURJ?0RGEXVB6ODYH ................................................................................................5, 8
Discrete inputs ............................................................................................................... 18
Double Indication .......................................................................................21, 22, 24, 27
COM 500 Configuring MicroSCADA for Modbus 1MRS751864-MEN
Slave Protocol
Index Configuration Guide
(
Error codes .................................................................................................................... 33
)
Fatal error ........................................................................................................................ 3
Fetch communication event counter ............................................................................. 32
FFFF .............................................................................................................................. 32
FI .......................................................................................................................22, 23, 25
Force multiple coils ................................................................................................. 26, 33
Force single coil ............................................................................................................ 26
Forcing a coil ................................................................................................................ 29
Free Integer ................................................................................................................... 22
Free teXt ........................................................................................................................ 22
Function codes ........................................................................................................ 26, 27
FX .................................................................................................................................. 22
*
General parameters ......................................................................................................... 9
,
ID ......................................................................................................................19, 21, 23
In Use ............................................................................................................................ 20
InDications .................................................................................................................... 19
Input data ....................................................................................................................... 16
Intelligent Electronic Devices (IEDs) ........................................................................... 15
IU .................................................................................................................................. 20
/
LAN link ......................................................................................................................... 6
0
Modbus slave .......................................................................................................... 15, 21
Modbus slave application program ................................................................................. 8
Modbus_slave.exe ........................................................................................................... 5
Modicon Modbus protocol ...................................................................................... 15, 26
Modify multiple registers .............................................................................................. 33
Modify register content ................................................................................................. 30
1
ND ................................................................................................................................... 8
2
OA ................................................................................................................................. 25
Object address ...................................................................................................16, 25, 30
Object index .................................................................................................................. 23
Offset parameter ............................................................................................................ 18
Output data .................................................................................................................... 17
3
PC ............................................................................................................................ 20, 24
PC-NET ..................................................................................................................... 8, 12
PLC stations .................................................................................................................. 12
1MRS751864-MEN Configuring MicroSCADA for Modbus COM 500
Slave Protocol
Configuration Guide Index
5
Read coil status ........................................................................................................26, 27
Read holding register ..................................................................................................... 26
Read holding registers ................................................................................................... 28
Read input registers .................................................................................................26, 29
Read input status .....................................................................................................26, 28
Register number ............................................................................................................ 17
Remote Terminal Units (RTUs) ..................................................................................... 15
Response message ......................................................................................................... 28
Restart communication option ....................................................................................... 31
Return bus communication error count ...................................................................31, 32
Return bus message count ............................................................................................. 31
Return query data .......................................................................................................... 31
Return slave message count .......................................................................................... 32
Return slave no response count ..................................................................................... 32
RP 570 station .........................................................................................................18, 22
RTU station ................................................................................................................6, 12
6
SA ..............................................................................................................................8, 12
Serial port communication parameters ............................................................................ 8
Signals ........................................................................................................................... 21
SINCDAC ..................................................................................................................... 25
Single indications ....................................................................................................22, 27
SPI station ................................................................................................................18, 22
Status codes ...............................................................................................................4, 33
Status information ......................................................................................................... 24
SYS 500 ........................................................................................................................... 1
SYS_BASCON.COM ..................................................................................................... 5
7
TCP/IP ........................................................................................................................... 15
Time stamp ....................................................................................................... 19, 20, 24
:
Write multiple registers ................................................................................................. 26
Write single register ....................................................................................................... 26