VisiLogic - Function - Blocks
VisiLogic - Function - Blocks
RE
MANUAL
AL
Note • You must use a condition (RLO) to activate any FB that requires
Configuration in your application, such as MODBUS or SMS.
Note • To enable Live Update, you can select to use a proxy server in
Project Properties.
Versions Used
The condition that activates the Configuration must turn ON for a single
program cycle (positive transition recommended). However, the
MODBUS Configuration must be scanned during every program
cycle--after the Configuration is activated. One way to ensure this
is by placing the Configuration in the first subroutine of the main
module.
Note that the operand addresses in slave PLCs are indirect addresses
(pointers).
A MODBUS Configuration FB. Within the Configuration, the port you select
must be the same port selected in the COM Port Init FB.
Note • The condition that activates the Configuration must turn ON for a
single program cycle (positive transition recommended). However, the
MODBUS configuration must be scanned during every program
cycle--after the Configuration is activated. One way to ensure this
is by placing the configuration in the first subroutine of the main
module.
A Scan_EX FB
Note • The operand addresses in slave PLCs are indirect addresses (pointers).
Note that it is possible to broadcast to the MODBUS network by writing to
Slave ID # 0. To do this indirectly addressing the Slave ID to a register, and
write 0 to that register.
Slaves: Consecutive References
Whether the MODBUS master is a Unitronics PLC or another device, if the
master application size and system requirements allow, it is recommended to
add a delay between consecutive references to slaves according to the table
below.
FB Operations
Operations are grouped under MODBUS on the FB's menu.
MODBUS: Configuration
MODBUS: Scan
MODBUS: Configuration
A MODBUS Configuration FB must be included in both master and slave Ladder
applications as shown below.
Port Number Constant Click the drop-down arrows to view available ports; click the port you
want to use.
Network ID Constant This number identifies the device on the network. You can either assign
an ID via an MI, or directly via a constant number. The unit ID range is
from 0-255. Do not assign the same ID number to more than one
device.
Time out Constant This is the amount of time a master device will wait for an answer from
or MI a slave. Time out units are defined in 10 msecs; a Time out value of
100 is equal to 1 second.
Retries Constant This is the number of times a device will try to send a message.
or MI
Function in MB This bit is ON when MODBUS is active. Use this as a condition bit for
Progress MODBUS operations to avoid communication conflicts.
The Ladder application below enables the controller act as a MODBUS master
and read coils in a slave PLC. The Scan_EX operation shown below enables
the controller to also act as a slave.
Status Operands
When you place MODBUS operations in your application (Force, Read, Preset,
and Loopback commands), you link operands that show the status of MODBUS
sessions. Use these to troubleshoot problems.
Slave ID Constant The ID of the slave device containing the coils to be read (data
or MI source).
Slave: Start of Const, The start of the vector of coils to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables
DW
Master: Start of MB This is the start of a vector of MBs that will contain the coils'
Vector status in the master (data destination).
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
Use this command to read the status of a selected group of inputs in a slave
device and write them into a vector. The inputs' status is written into a vector
of MBs in the master PLC.
Slave ID Constant The ID of the slave device containing the inputs to be read (data
or MI source).
Slave: Start of Const, The start of the vector of inputs to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables
DW
Master: Start of MB This is the start of a vector of MBs that will contain the inputs'
Vector status in the master (data destination).
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
Slave ID Constant The ID of the device containing the registers to be read (data
or MI source).
Slave: Start of Const, The start of the vector of registers to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables
DW
Master: Start of MI This is the start of a vector of MIs that will contain the registers'
Vector values in the master (data destination).
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
Slave ID Constant The ID of the device containing the registers to be read (data
or MI source).
Slave: Start of Const, The start of the vector of registers to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables
DW
Master: Start of MI This is the start of a vector of MIs that will contain the registers'
Vector values in the master (data destination).
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
Slave ID Constant The ID of the device containing the registers to be read (data
or MI source).
Slave: Start of Const, The start of the vector of registers to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables
DW
Master: Start of MI This is the start of a vector of MIs that will contain the registers'
Vector values in the master (data destination).
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
Slave ID Constant The ID of the device containing the registers to be read (data source).
or MI
Slave: Start of Const, The start of the vector of registers to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables
DW
Master: Start of MI This is the start of a vector of MIs that will contain the registers'
Vector values in the master (data destination).
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to access the
slave device. Note that this is a simple incremental counter. Initialize
it by storing 0 into the selected DW.
Slave ID Constant The ID of the device containing the coil to be forced (data
or MI source).
Slave Address Const, The address of the coil to be forced (data target).
MI, ML, Note • Check topic Slave Address Tables
DW
Value to Force M, SB, I, This MB is located in the master PLC; this MB contains the
O,T status to be forced ( data source). If, for example, the status of
this MB is OFF, the status of the coil in the slave will be forced to
OFF.
Note • A MODBUS command cannot read/write more than 1900
bit operands at one time. In addition, 0 is not a legal length.
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
Value to Preset Constant, This is the address of the register containing the value in the
MI, SI, master PLC (source). This value will be written into the slave's
ML, SL, register, the register that is to be preset.
DW,
SDW or T
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to access
the slave device. Note that this is a simple incremental counter.
Initialize it by storing 0 into the selected DW.
Slave ID Constant The ID of the slave device containing the coils to be forced
or MI (target).
Slave:Start of Const, The start of the vector of coils to be forced (data target).
Vector MI, ML, Note • Check topic Slave Address Tables
DW
Master: Start of MI, SB, I, This is the start of a vector of MBs that will contain the coils'
Vector O,T status in the master (data source).
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
Slave: Start of Const, The start of the vector of registers to be preset (target).
Vector MI, ML, Note • Check topic Slave Address Tables
DW
Master: Start of Constant, This is the start of a vector of MIs that will contain the registers'
Vector MI, SI, values in the master (data source).
ML, SL,
DW,
SDW or T
Preset: Vector Const, The length of the vector of registers in both master and slave.
Length MI, ML, Note • A MODBUS command cannot read more than 124 16-bit
DW integers, 62 double registers, or 64 float registers at one time.
In addition, 0 is not a legal length.
• If, within the Slave: Start of Vector parameter, the
selected register type is a 32-bit double register (slave
addresses 5100 and greater)the preset vector length must be
doubled as well.
If, for example:
- Slave: Start of Vector parameter is set to 6300, and
- You wish to preset 4 registers, for a total of 16 bytes
- You must set the Preset Vector length to 8.
Note that this means that, in these cases, the Preset: Vector
Length parameter will always be an even number.
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
Master: Start of MI, SI, This is the address of the register containing the value in the
Vector ML, SL, master PLC (source). This value will be written into the slave's
DW, register, the register that is to be preset.
SDW or T
Preset: Vector Const, The length of the vector of registers in both master and slave.
Length MI, ML, Note • A MODBUS command cannot read more than 124 16-bit
DW integers, 62 double registers, or 64 float registers at one time.
In addition, 0 is not a legal length.
• If, within the Slave: Start of Vector parameter, the
selected register type is a 32-bit double register (slave
addresses 5100 and greater)the preset vector length must be
doubled as well.
If, for example:
- Slave: Start of Vector parameter is set to 6300, and
- You wish to preset 4 registers, for a total of 16 bytes
- You must set the Preset Vector length to 8.
Note that this means that, in these cases, the Preset: Vector
Length parameter will always be an even number.
Status Messages MI Shows a message number. To check status and diagnose errors,
check the MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
To determine the byte number of a data table cell, hold the cursor over the
data table cell. A Tooltip opens, displaying the byte number.
Note • A MODBUS command cannot read/write more than 242 DT bytes at
one time.
In addition, 0 is not a legal length.
Slave ID Constant The ID of the slave device containing the coils to be read (data
or MI source).
Slave: DT Start of Const, MI, The start of the vector of bytes to be read (data source).
Vector ML, DW
Slave: DT Offset in Const, MI, Offset from the Slave: DT Start of Vector
Vector ML, DW
Master: DT Start Const, MI, This is the start of a vector of bytes that will contain the data
of Vector ML, DW read from the slave.
Master: DT Offset Const, MI, Offset from the Master: DT Start of Vector
in Vector ML, DW
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
Slave ID Constant The ID of the slave device to which the data will be written
or MI (data target).
Slave: DT Start of Const, MI, The start of the vector of bytes to be written into (data target).
Vector ML, DW
Slave: DT Offset in Const, MI, Offset from the Slave: DT Start of Vector
Vector ML, DW
Master: DT Start Const, MI, This is the start of a vector of bytes, in the master, that will
of Vector ML, DW contain the data to be written to the slave (data source)
Master: DT Offset Const, MI, Offset from the Master: DT Start of Vector
in Vector ML, DW
Total Sessions DW This is the number of times the master PLC will attempt to
access the slave device. Note that this is a simple incremental
counter. Initialize it by storing 0 into the selected DW.
Note that this function is compatible with O/S 401 and higher, and is not
supported for V120-12-xxx.
Each function can contain both Read and Write Mix Requests. Each request
may be for a different data type. Your data request must include:
Master and Slave operand addresses
Length of vector
Direction: Read or Write
After you add a request, the OK button is disabled. Click the Compile button to
see current buffer status; if the buffer contains less than the maximum
number of bytes, the OK is enabled.
Slave Addressing
Monochrome / Color PLCs
The memory structure of monochrome screen PLCs is different from that of
color screen PLCs. This is why each series has its own slave addressing
scheme.
Note • The slave addresses given for the monochrome series are decimal
values.
The slave addresses given for the color series are hexadecimal
values.
Slave Addresses
Standard Vision Division
Coils MODBUS Command Number
8000 MB 3000-4095
Note • Note that in order to access MBs 3000-4095, you address as follows:
5100 ML 32 bit
6100 SL 32 bit
7700 MF 32 bit
5000h SB Read-only
9000h SI 16 bit
5000h XL
6000h XDW
7000h ML 32 bit
A000h SL 32 bit
4000h MF 32 bit
Examples
The examples below show that:
MODBUS addressing systems start at 1.
Vision addressing starts at 0.
Bit Operands
Read a 10-bit vector of inputs in a slave Vision controller, starting at
Input 20, via Read Coils (MODBUS COMMAND #1)
Vision PLC as the MODBUS master to Monochrome PLC
In VisiLogic's Read Coils FB, set the Slave: Start of Vector
parameter to 4020 (DEC), and the Read: Vector Length parameter
to 10. Within the slave Vision controller, VisiLogic will read I 20 - I
29.
Registers
Read a 9-register long vector of 16-bit integers in a slave Vision
controller, starting at MI 32, via Read Holding Registers (MODBUS
COMMAND #03)
Note • If, within the Slave: Start of Vector parameter, the selected register
type is a 32-bit double register (slave addresses 5100 and greater)
the preset vector length must be doubled as well.
If, for example in the VisiLogic Preset Holding Registers FB:
Slave: Start of Vector parameter is set to 6300, and
You wish to preset 4 registers, for a total of 16 bytes
You must set the Preset Vector length to 8.
Note that this means that, in these cases, the Preset: Vector
Length parameter will always be an even number.
Read a 9-register long vector of 32 -bit integers in a slave Vision
controller, starting at SL 32, via Preset Holding Registers (MODBUS
COMMAND #16)
Vision PLC as the MODBUS master
In VisiLogic's Preset Holding Registers FB, set the Slave: Preset
Vector parameter to 6132, and the Read: Vector Length parameter
to 18 ( 2x9, in order to fit the 32-bit SL registers ). Within the slave
Vision controller, VisiLogic will read SL 32 - SL 41.
SCADA as the MODBUS master
In the SCADA application, set the Slave: Start of Vector parameter
to 406133, and the Read: Vector Length parameter to 18, enabling
the Master device to read SL 32 - SL 41 within the slave Vision
controller.
# Status Message
0 Status OK
4 Master--Time Out
This occurs if the master has been waiting for a slave response for an amount of time
exceeding the Time-out set in the Configuration.
If this error occurs, check Time Out, Baud Rate, and Distance
5 No Communication
The MODBUS session cannot be established.
Note • Messages 4 & 5. TimeOut and Number of Retries are defined in the Configuration. A
Retry is an attempt to establish a MODBUS session.
If, for example, TimeOut is defined as 2 seconds, and number of Retries as 3:
- the controller will try to establish the session once, and will continue to try for 2 seconds.
- If the first attempt fails, the Status Message value will be 4, Master TimeOut.
-The controller will try twice more, for a total of 3 retries over 6 seconds.
- If all attempts fail, the Status Message value will be 5.
-If any attempt succeeds, the Status Message will be 0.
9 Slave ID =0
An attempt does to communicate with Slave ID 0.
10 Incorrect CRC
* Messages 6, 7, and 11mean that the master has found incompatible elements in the data sent
between master and slave.
Total Sessions DW This is the total number of times the master PLC attempts to access
the slave device, whether the attempt is successful or not, including
Retries. Note that this is a simple incremental counter.
• This must be initialized by the user, by storing 0 into the
selected DW.
SI Description Value
100 Maximum Time When MODBUS (Serial) is configured to a port linked to a modem, the
Delay between MODBUS function checks SI 100. If SI 100 = 1, a time interval of up
characters to 2.5 msecs is permitted between characters, if SI 100 contains 2,
(units 2.5ms) the permitted interval is 5 msecs ( n x 2.5 =interval.
MODBUS + Note that:
Modem - The power-up value is 1,
- the application must update SI 100 before the MODBUS
configuration is activated.
MODBUS IP Overview
Converting Projects: Vision Divisions
The memory structure of Standard Vision controllers is different from
that of Enhanced. Note that if you convert projects, you must make
changes according to the information given in the Slave Address tables.
Within a MODBUS network, you can use standard MODBUS commands to read
and write bit and register data; you can also read and write data to Vision
controller Data Tables.
Unitronics currently supports both TCP and UDP, as explained in the topic About
Ethernet. This topic also contains general information about Ethernet, IP
addressing, sockets, and ports.
Using MODBUS
Before using a MODBUS IP operation in your application, you must:
Assign IP addresses to both master and slave devices. This is done by
placing Ethernet Card Init FBs in the ladder application of both master and
slave.
Include at least 1 MODBUS Configuration FB in the ladder application of
both master and slave.
The condition that activates the Configuration must turn ON for a single
program cycle (positive transition recommended)
However, the MODBUS configuration must be scanned during every
program cycle--after the Configuration is activated. One way to
ensure this is by placing the configuration in the first subroutine of the
main module.
Enable slave devices to be accessed by placing a Scan FB in the slave's
Ladder application.
The figure below shows the elements required to carry out a Read Coils
Operation.
Note that the operand addresses in slave PLCs are indirect addresses
(pointers).
Note that a MODBUS master can broadcast to the MODBUS network by writing
to Slave ID # 0. To do this, indirectly address the Slave ID to a register, and
write 0 to that register.
FB Operations
MODBUS IP Operations are located on the FBs menu.
MODBUS: Configuration
MODBUS: Scan
MODBUS: Configuration
A MODBUS Configuration FB must be included in both master and slave Ladder
applications as shown below. MODBUS IP Operations are located on the FBs
menu.
Port Number Constant Click the drop-down arrows to view available ports; click the port you want to use.
Network ID Constant This number identifies the device on the network. You can either assign an ID via an MI, or
directly via a constant number. The unit ID range is from 0-255. Do not assign the same ID
number to more than one device.
Time out Constant This is the amount of time a master device will wait for an answer from a slave. Time out
or MI units are defined in 10 msecs; a Time out value of 100 is equal to 1 second.
Retries Constant This is the number of times a device will try to send a message.
or MI
Function in MB This bit is ON when MODBUS is active. Use this as a condition bit for MODBUS operations
Progress to avoid communication conflicts.
Vision Slaves
In order to access Vision Controllers as slave devices and implement MODBUS
commands, you must enter the IP addresses of the slave devices in the MODBUS
IP configuration. This means that you must first assign IP addresses to each
slave. This is done via the Ethernet Card Init FB, which must be configured as
described in the topic Using_Ethernet.
Note • Slave IP addresses can also be linked to an MI vector, note that the
vector is 4 MIs long. The low byte of each MI provides the number
for an octet within the IP address.
If, for example, the IP address is linked to MI 0, and the low bytes of
MI 0 to MI 3 contain the values 192, 198, 192, 45, the IP address
The Ladder application below enables the controller act as a MODBUS master
and read coils in a slave PLC. The same PLC can also act as a slave, if a
Scan_EX operation is included in the application.
Status Operands
When you place MODBUS operations in your application (Force, Read, Preset,
and Loopback commands), you link operands that show the status of MODBUS
sessions. Use these to troubleshoot problems.
MODBUS Versions previous to V2.01 offered only the Scan FB. Scan is still
supported for older, working applications. When MODBUS operations accessed
double registers (5100 addresses and higher), using odd addresses, such as
5101, there were incompatibility issues.
Scan_EX is recommended for new applications.
When ScanEX receives an input parameter in the 32-bit range (for example,
5100{ML}), it automatically takes double-register values.
If, for example, ScanEX receives a Read Register(6) request for 5100, it
returns the values in 5100 and 5101. If, however, ScanEX receives Read
Register(6) request for 5101, it returns Status Message #2-- since 5101
provides the 'high' bytes of the 32-bit register, it is not a legal address.
Slave ID Constant The IP address of the slave device containing the coils to be read (data source).
or MI
Slave: Start of Const, The start of the vector of coils to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables.
DW
Master: Start of MB Shows a message number. To check status and diagnose errors, check the MODBUS
Vector Status Operands.
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands.
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the selected
DW.
Slave ID Constant The IP address of the slave device containing the inputs to be read (data source).
or MI
Slave: Start of Const, The start of the vector of inputs to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables.
DW
Master: Start of MB This is the start of a vector of MBs that will contain the inputs' status in the master
Vector (data destination).
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands.
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the selected
DW.
Slave ID Constant The IP address of the device containing the registers to be read (data source).
or MI
Slave: Start of Const, The start of the vector of registers to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables.
DW
Master: Start of MI This is the start of a vector of MIs that will contain the registers' values in the master
Vector (data destination).
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands.
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the selected
DW.
Slave ID Constant The IP address of the device containing the registers to be read (data source).
or MI
Slave: Start of Const, The start of the vector of registers to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables.
DW
Master: Start of MI This is the start of a vector of MIs that will contain the registers' values in the master
Vector (data destination).
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands.
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the selected
DW.
Slave ID Constant The IP address of the device containing the registers to be read (data source).
or MI
Slave: Start of Const, The start of the vector of registers to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables.
DW
Master: Start of MI This is the start of a vector of MIs that will contain the registers' values in the master
Vector (data destination).
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands.
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the selected
DW.
Slave ID Constant The IP address of the device containing the registers to be read (data source).
or MI
Slave: Start of Const, The start of the vector of registers to be read (data source).
Vector MI, ML, Note • Check topic Slave Address Tables.
DW
Master: Start of MI This is the start of a vector of MIs that will contain the registers' values in the master
Vector (data destination).
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands.
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the selected
DW.
Slave ID Constant The IP address of the device containing the coil to be forced (data source).
or MI
Slave Address Const, The address of the coil to be forced (data target).
MI, ML, Note • Check topic Slave Address Tables.
DW
Value to Force M, SB, I, This MB is located in the master PLC; this MB contains the status to be forced (data
O,T source). If, for example, the status of this MB is OFF, the status of the coil in the slave
will be forced to OFF.
Note • A MODBUS command cannot read/write more than 1900 bit operands at one
time. In addition, 0 is not a legal length.
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the selected
DW.
Slave ID Constant The IP address of the device containing the register to be preset (target).
or MI
Value to Preset Constant, This is the address of the register containing the value in the master PLC (source).
MI, SI, This value will be written into the slave's register, the register that is to be preset.
ML, SL,
DW,
SDW or T
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the selected
DW.
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands.
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the selected
DW.
Slave ID Constant The IP address of the slave device containing the coils to be forced (target).
or MI
Slave:Start of Const, The start of the vector of coils to be forced (data target).
Vector MI, ML, Note • Check topic Slave Address Tables.
DW
Master: Start of MI, SB, I, This is the start of a vector of MBs that will contain the coils' status in the master (data
Vector O,T source).
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the selected
DW.
Slave ID Constant The IP address of the device containing the registers to be preset (target).
or MI
Slave: Start of Const, The start of the vector of registers to be preset (target).
Vector MI, ML, Note • Check topic Slave Address Tables.
DW
Master: Start of Constant, This is the start of a vector of MIs that will contain the registers' values in the master
Vector MI, SI, (data source).
ML, SL,
DW,
SDW or T
Preset: Vector Const, The length of the vector of registers in both master and slave.
Length MI, ML, Note • A MODBUS command cannot read more than 124 16-bit integers, 62 double
DW registers, or 64 float registers at one time. In addition, 0 is not a legal length.
• If, within the Slave: Start of Vector parameter, the selected register type is a
32-bit double register (slave addresses 5100 and greater)the preset vector length
must be doubled as well.
If, for example:
- Slave: Start of Vector parameter is set to 6300, and
- You wish to preset 4 registers, for a total of 16 bytes
- You must set the Preset Vector length to 8.
Note that this means that, in these cases, the Preset: Vector Length parameter will
always be an even number.
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands.
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note this is a simple incremental counter. Initialize it by storing 0 into the selected DW.
Slave ID Constant The IP address of the device containing the register to be preset (target).
or MI
Master: Start of MI, SI, This is the address of the register containing the value in the master PLC (source).
Vector ML, SL, This value will be written into the slave's register, the register that is to be preset.
DW,
SDW or T
Preset: Vector Const, The length of the vector of registers in both master and slave.
Length MI, ML, Note • A MODBUS command cannot read more than 124 16-bit integers, 62 double
DW registers, or 64 float registers at one time. In addition, 0 is not a legal length.
• If, within the Slave: Start of Vector parameter, the selected register type is a
32-bit double register (slave addresses 5100 and greater)the preset vector length
must be doubled as well.
If, for example:
- Slave: Start of Vector parameter is set to 6300, and
- You wish to preset 4 registers, for a total of 16 bytes
- You must set the Preset Vector length to 8.
Note that this means that, in these cases, the Preset: Vector Length parameter will
always be an even number.
Status Messages MI Shows a message number. To check status and diagnose errors, check the MODBUS
Status Operands.
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the selected
DW.
Note that this function is compatible with O/S 401 and higher, and is not
supported for V120-12-xxx.
Each function can contain both Read and Write Mix Requests. Each request may
be for a different data type. Your data request must include:
I MB, O MI MI
O MB, O ML ML
MB MB, O DW DW
To determine the byte number of a data table cell, hold the cursor over the data
table cell. A Tooltip opens, displaying the byte number.
Slave ID Constant or The ID of the slave device containing the coils to be read (data source).
MI
Slave: DT Start of Const, MI, The start of the vector of bytes to be read (data source).
Vector ML, DW
Slave: DT Offset in Const, MI, Offset from the Slave: DT Start of Vector
Vector ML, DW
Master: DT Start of Const, MI, This is the start of a vector of bytes that will contain the data read from the slave.
Vector ML, DW
Master: DT Offset Const, MI, Offset from the Master: DT Start of Vector
in Vector ML, DW
Status Messages MI Shows a message number. To check status and diagnose errors, check the
MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the
selected DW.
Slave ID Constant or The ID of the slave device to which the data will be written (data target).
MI
Slave: DT Start of Const, MI, The start of the vector of bytes to be written into (data target).
Vector ML, DW
Slave: DT Offset in Const, MI, Offset from the Slave: DT Start of Vector
Vector ML, DW
Master: DT Start of Const, MI, This is the start of a vector of bytes, in the master, that will contain the data to be
Vector ML, DW written to the slave (data source)
Master: DT Offset Const, MI, Offset from the Master: DT Start of Vector
in Vector ML, DW
Status Messages MI Shows a message number. To check status and diagnose errors, check the
MODBUS Status Messages.
Total Sessions DW This is the number of times the master PLC will attempt to access the slave device.
Note that this is a simple incremental counter. Initialize it by storing 0 into the
selected DW.
Note that you must use a condition (RLO) to activate the MODBUS Configuration.
The slave PLC Ladder application must include the elements shown below.
Step 2: Scan
To enable the master PLC to access the slave, include a MODBUS Scan FB in the
slave's application.
Slave Addressing
Monochrome / Color PLCs
The memory structure of monochrome screen PLCs is different from that of color
screen PLCs. This is why each series has its own slave addressing scheme.
Note • The slave addresses given for the monochrome series are decimal
values.
The slave addresses given for the color series are hexadecimal
values.
Slave Addresses
Standard Vision Division
8000 MB 3000-4095
4000 SI 16 bit
5100 ML 32 bit
6100 SL 32 bit
7700 MF 32 bit
5000h SB Read-only
3000h XI
9000h SI 16 bit
5000h XL
6000h XDW
7000h ML 32 bit
A000h SL 32 bit
4000h MF 32 bit
Examples
The examples below show that:
MODBUS addressing systems start at 1.
Vision addressing starts at 0.
Bit Operands
Read a 10-bit vector of inputs in a slave Vision controller, starting at Input 20,
via Read Coils (MODBUS COMMAND #1)
Vision PLC as the MODBUS master to Monochrome PLC
In VisiLogic's Read Coils FB, set the Slave: Start of Vector parameter to 4020
(DEC), and the Read: Vector Length parameter to 10. Within the slave Vision
controller, VisiLogic will read I 20 - I 29.
Vision PLC as the MODBUS master to Color PLC
In VisiLogic's Read Coils FB, set the Slave: Start of Vector parameter to 6014h
(HEX), and the Read: Vector Length parameter to 10. Within the slave Vision
controller, VisiLogic will read I 20 - I 29.
SCADA as the MODBUS master to Monochrome PLC
In the SCADA application, set the Slave: Start of Vector parameter to
34021(30001 + 4000 + 20), and the Read: Vector Length to 10, enabling the
Master device to read I 20 - I 29 within the slave Vision controller.
SCADA as the MODBUS master to Color PLC
Convert the HEX address to DEC
In the SCADA application, set the Slave: Start of Vector parameter to
54597(24576 (6000h) + 20), and the Read: Vector Length to 10, enabling the
Master device to read I 20 - I 29 within the slave Vision controller.
Write a 3-bit vector of outputs in a slave Vision controller, starting at Output 8,
via Force Coils (MODBUS COMMAND #15)
Vision PLC as the MODBUS master to Monochrome PLC
In VisiLogic's Force Coils FB, set the Slave: Start of Vector parameter to 5008,
and the Force: Vector Length parameter to 3. Within the slave Vision
controller, the master will force the status of O 8 - O 10.
Vision PLC as the MODBUS master to Color PLC
In VisiLogic's Force Coils FB, set the Slave: Start of Vector parameter to 4008h
(HEX), and the Force: Vector Length parameter to 3. Within the slave Vision
controller, the master will force the status of O 8 - O 10.
SCADA as the MODBUS master to Monochrome PLC
In the SCADA application, set the Slave: Start of Vector parameter to 35009
(30001 + 5000 + 8) and the Force: Vector Length parameter to 3, enabling
the Master device to write to O 8 - O 10 within the slave Vision controller.
SCADA as the MODBUS master to Color PLC
Convert the HEX address to DEC.
In the SCADA application, set the Slave: Start of Vector parameter to 46393
(30001 + 16384(4000h) + 8) and the Force: Vector Length parameter to 3,
Note • If, within the Slave: Start of Vector parameter, the selected register
type is a 32-bit double register (slave addresses 5100 and greater)
the preset vector length must be doubled as well.
If, for example in the VisiLogic Preset Holding Registers FB:
Slave: Start of Vector parameter is set to 6300, and
You wish to preset 4 registers, for a total of 16 bytes
You must set the Preset Vector length to 8.
Note that this means that, in these cases, the Preset: Vector
Length parameter will always be an even number.
Read a 9-register long vector of 32 -bit integers in a slave Vision controller,
starting at SL 32, via Preset Holding Registers (MODBUS COMMAND #16)
Vision PLC as the MODBUS master
In VisiLogic's Preset Holding Registers FB, set the Slave: Preset Vector
parameter to 6132, and the Read: Vector Length parameter to 18 ( 2x9, in
order to fit the 32-bit SL registers ). Within the slave Vision controller,
VisiLogic will read SL 32 - SL 41.
SCADA as the MODBUS master
In the SCADA application, set the Slave: Start of Vector parameter to 406133,
and the Read: Vector Length parameter to 18, enabling the Master device to
read SL 32 - SL 41 within the slave Vision controller.
Write a 6-register long vector of 16-bit integers in a slave Vision controller,
starting at MI 32, via Preset Holding Registers (MODBUS COMMAND #16)
Vision PLC as the MODBUS master
In VisiLogic's Preset Holding Registers FB, set the Slave: Start of Vector
parameter to 32, and the Preset: Vector Length parameter to 6. Within the
slave Vision controller, VisiLogic will write to MI 32 - MI 37.
SCADA as the MODBUS master
In the SCADA application, set the Slave: Start of Vector parameter to 40033,
and the Read: Vector Length parameter to 6, enabling the Master device to
write to MI 32 - MI 37 within the slave Vision controller.
# Status Message
0 Status OK
4 Master--Time Out
This occurs if the master has been waiting for a slave response for an amount of time exceeding the Time-out set
in the Configuration.
If this error occurs, check Time Out, Baud Rate, and Distance
5 No Communication
The MODBUS session cannot be established.
Note • Messages 4 & 5. TimeOut and Number of Retries are defined in the Configuration. A Retry is an attempt to establish
a MODBUS session.
If, for example, TimeOut is defined as 2 seconds, and number of Retries as 3:
- the controller will try to establish the session once, and will continue to try for 2 seconds.
- If the first attempt fails, the Status Message value will be 4, Master TimeOut.
-The controller will try twice more, for a total of 3 retries over 6 seconds.
- If all attempts fail, the Status Message value will be 5.
-If any attempt succeeds, the Status Message will be 0.
9 Slave ID =0
An attempt does to communicate with Slave ID 0.
10 Incorrect CRC
* Messages 6, 7, and 11mean that the master has found incompatible elements in the data sent between master and slave.
Total Sessions DW This is the total number of times the master PLC attempts to access the slave device,
whether the attempt is successful or not, including Retries. Note that this is a simple
incremental counter.
This must be initialized by the user, by storing 0 into the selected DW.
The default Time Out set in the Configuration is one second. In certain cases,
the length of the network may cause this to be exceeded. You can calculate a
Time Out value by using the following formula, and use it in the Configuration.
The SMS Configuration contains a list of SMS messages and phone numbers.
Note • COM Init and SMS Configuration must appear in the application and
be activated before any SMS operations are activated. If this is not
done, the application will not work.
To enable the controller to receive messages, place an SMS Scan FB in your
application and link it to a Configuration. When activated, this causes the
controller to scan the GSM modem's SIM card for incoming SMS messages
To enable the controller to send SMS messages, place an SMS Send FB in your
application and link it to a Configuration. You can then either send one of the
messages in that Configuration or create one for that specific Send FB.
In either case, the port defined in the Configuration will be used to send the
message.
FB Operations
SMS: Configuration
SMS: Scan
SMS: Send
2. Select SMS Configuration from the FBs menu and place the function in
your application.
Note • The condition that activates the SMS Configuration must turn ON for
a single program scan (positive transition recommended).
• Once an SMS Configuration is activated, it can process SMS
messages.
However, messages are sent or received only when the MB linked to
Modem Busy (GSM) is OFF.
This MB turns ON when the modem is processing a message, or is
communicating data to another application such as VisiLogic.
• The appropriate Modem: Initialized SBs [80 (COM 1), SB 82 (COM
2), SB 84 (COM 3)] must turn ON before activating an SMS
Configuration using that COM port; the SBs should be used as an
activating condition.
The SMS configuration must be scanned during every program cycle--
after the Configuration is activated. One way to ensure this is by
placing the configuration in the first subroutine of the main module.
Note • When the positive transition contact used to activate the Send FB
rises, the MB linked to Modem Busy (GSM) turns ON.
The rest of the logic in the net is processed whether or not the Send
operation is completed.
• Operands linked to SMS FBs, such as Modem Busy (GSM), should be
assigned Power-up Values; bits should be reset, and registers
initialized to 0.
• When an SMS message is sent, the Modem Busy (GSM) MB remains
ON until the message has cleared the SIM card.
• Be careful when using positive transition contacts to activate a Send
operation.
When a Send operation is in progress, the modem is busy. If another
Send operation is activated while the modem is busy, the second
Send operation will not be activated and the message will not be
sent--even after the modem is no longer busy.
SMS: Configuration
An SMS Configuration contains a list of SMS messages with attached variables
and a phone book that is unique to that configuration. SMS Configuration is also
where you define Message Properties.
Binary Variable
This type of variable displays different text in the SMS variable field according
to the status of a bit operand.
Number Variable
A Number Variable enables you to:
Show any numeric value within a message.
Control the format in which that value is shown, including the placement
of a decimal point and leading zeros.
Use Linearization to show a converted value, such as an analog
temperature converted to degrees Celsius.
Message Properties
This defines how the PLC deals with a specific SMS message that is received
by the system. Note that a SMS Scan FB must be placed in the Ladder to
enable the PLC to check a specific SMS Configuration for received messages.
Phone Book
Click on a line to either:
Directly enter a phone number in the phone book, or
Use a vector of registers to indirectly dial a number. HMI Keypad Entry
Variables can then be linked to this vector, enabling a user to dial a number
from the controller keypad via HMI Entry Variables.
Indirect Vector
Each register byte contains 1 character. Note that the byte actually contains
the ASCII value of the desired numeral. For example, the ASCII value of 1 is
049.
In the next figure, the user inserted a line, causing the index number
to increment. However, the user did not edit the Send function, and
message Index # is now blank.
SMS: Scan
To enable the controller to receive messages, place an SMS Scan FB in your
application and link it to a Configuration. When activated, this causes the
controller to scan the GSM modem's SIM card for incoming SMS messages.
Before you can receive an SMS, you must initialize a COM port to use a GSM
modem, create an SMS Configuration, and set conditions as explained in Using
SMS Messaging.
When the PLC receives a message, the Message Properties defined in the SMS
configuration for that message define how it will be processed.
SMS: Send
To send an SMS, place an SMS Send operation in your Ladder application.
Before you can send an SMS, you must initialize a COM port to use a GSM
modem, create an SMS Configuration, and set conditions as explained in Using
SMS Messaging.
Note • You can send only one SMS message at a time, but you may send it
to multiple phone numbers.
• The Send Status MB turns on if there are more than one Send
operations, and the PLC has not finished processing the first Send
before the second Send is activated. In this case, Modem Busy MB of
the SMS: Configuration bit will be ON, causing the Send Fail Bitmap
to contain a value of -1.
Select from Opens the list of messages contained in the linked Configuration.
Configuration To select a message to send, click it; the message will be highlighted.
characters.
• Phone Indexes is based on the Phone Book in the linked SMS
configuration. Index numbers are 0 to 8, note that 0 is the index of
the last number called.
• SB 184 SMS: Transmission Succeeded and 185 SMS: Transmission
Failed are both reset when any message is sent to any phone
number. After the message has been processed, the Relevant SB will
turn ON.
• You can send messages in ASCII text format by turning ON SB 279:
ASCII Text message format,
• If forced display messages are supported by the cell phone receiving
the SMS, you can send a forced display message by turning ON SB
280: Force Message Display on Cell Phone.
SMS Variables
Variables can be included in Configuration or Send FB messages. A single SMS
message can contain both fixed text and up to 10 variables. Note that SMS
variables are not related to HMI variables.
Although the PLC can send Binary Text, Numeric, and List of Texts variables, it
can only receive Numeric variables.
Binary Variable
This type of variable displays different text in the SMS variable field according
to the status of a bit operand. The value currently visible is the last value sent.
Numeric Variable
This type of variable contains numbered lines of text. You link the Variable to
an operand. The value within that operand 'points' to the number of a line
within the list. When the operand value is equal to a particular line number,
the text of that line is shown in the Display.
The fixed text in your cell phone is identical to the message in the PLC's
SMS Configuration in every detail: spaces, characters--and note that
characters are case-sensitive.
You bracket variable values with number signs (#) as shown below. These
signs '#' do not count as spaces.
The variable field in the SMS message is big enough to hold the value.
The figure below shows the same SMS message: as it appears on a cell phone
display, and as it appears in the PLC's SMS Configuration.
When you send this message from your cell phone, the value 110 will be written
into the variable in the PLC.
3. The PLC receives this SMS message; AutoAcknowledge causes the PLC to
immediately return the message to your cell phone, together with the
current variable value.
4. You can now view this SMS message on your cell phone display, together
with changes in the variable value.
Note that although the PLC can send SMS messages that include Numeric,
Binary, and List variables, the PLC can only receive Numeric variables.
SMS Operands
Operands linked to SMS FBs should be assigned Power-up Values; bits should be
reset, and registers initialized to 0.
SMS: Configuration FB
Status Messages MI • Updated at the end of all operations using the SMS: Configuration; Send, Scan,
Initialized to 0 when SMS: and Check GSM Signal FBs.
Configuration is activated. • Indicates error status for Send, Scan, and Check GSM Signal FBs.
• Current value always shows the most recent error status.
Value Message
0 No error
1 Message received from a phone number that is not in the phone book, or the number is
not in the correct format
2 (Send only) Non-existent SMS message index number
3 SMS received from unauthorized phone number
4 (Scan only)The SMS message received does not exist in the SMS configuration
5 Modem TimeOut time exceeded: no reply
6 (Scan only) Received Variable Mismatch.
Variable:
- Does not exist in the SMS configuration, or
- Is not in the correct format, or
- Exceeds the range set for the variable
7 Modem Reply Error
8 Unknown Modem Reply
9 (Send only)Either the phone number or the SMS message is in the incorrect format and
may not be transmitted
SMS Scan FB
SMS: Send FB
Send: Fail Bitmap MI • Provides a bitmap that indicates the index number of a phone number that cannot be
reached.
If, for example, bit #3 in the register is not 0, the 3rd number in the phone book could not be
reached.
• The bits are initialized to 0 when the Send FB is activated. As calls are made, each
failure causes the relevant bit to turn ON.
• Note that:
- Phone Indexes is based on the Phone Book in the linked SMS configuration. Index
numbers are 0 to 8, note that 0 is the index of the last number called.
- a value of -1 indicates that the Modem Busy MB of the SMS: Configuration was ON
when the Send attempt was made.
The status of these SBs changes to reflect the status of each SMS message sent
by the system, including when messages are auto-acknowledged.
When the Send process begins, for each and every message, both SB 184 and
185 are OFF. After the message is sent, the relevant bit turns ON, indicating the
success or failure of that message.
Each port has a Succeed and Fail SB. When the Send process begins from a
particular COM port, for each and every message, both the Succeed and Fail SB
turn OFF.
If the message is sent successfully, the bit turns ON, indicating the success or
failure of that message.
If the message fails, when TimeOut is exceeded or because the modem reports
an error, the bit remains OFF.
Operands that are linked by the user to SMS FBs may be found in the topic SMS
Operands.
Use these together with SI 198 and 199 to write incoming SMS messages to a vector of operands.
This does not affect the function of the SMS message function blocks.
198 Record the Received SMS Message If SB 199 is set, , SB 198 is set User Program
Length when a message is received
Use these together with SB 198 and 199 to write incoming SMS messages to a vector of operands.
This does not affect the function of the SMS message function blocks.
SI Description Value
198 Received SMS Message Length Shows the length of the message in bytes
The data remains until the vector is overwritten
199 SMS to Memory Vector - start of vector The SMS message data is written starting from this address. To write to
a vector of XIs, enter a negative value
GPRS Overview
GPRS is a wireless data transmission service offered by some cellular providers.
When a Unitronics' PLC is connected to a GPRS modem, the PLC can establish a
data connection with a remote PC connected to the Internet and transmit IP
packets of data over the GPRS cellular network.
You can then use your PC to access the PLC via VisiLogic, Remote Access or
other communication .dll, as well as log PLC data via the DataXport utility. You
can also send e-mail via GPRS modem.
Notes • The PLC must be connected to a GPRS modem. GPRS service must be supplied by
the user's cellular service provider.
• To enable any GPRS operations to run, the PLC application must include GPRS
Configuration and GPRS Run FBs.
• Y ou must prepare both the PLC and PC side modems by carrying out the Prepare
PLC-side Modem procedure detailed in the topic PLC-side modems, and the
Initialize PC Modem detailed in the topic PC-side modems.
• To send e-mail via GRPS modem,when you prepare the modem via Modem
Services, set it to a baud rate of 9600.
In additon, the COM Init function should be set to 9600.
• Note that regarding Enhanced Vision models, as of OS 3.1.19 GPRS is no longer
supported for Wavecom and Sony Ericsson modems.
To view the list of supported modems, open the COM Init function and select GSM
modem as shown in the section below, Using GPRS.
• Unitronics has tested the following GPRS modems with Unitronic's PLCs:
• The PLC must initiate the GPRS data link by calling the PC.
A sample application showing how to establish PC-PLC communications via GPRS is
available for currently supported modems. This application is intended to be used
as a template, for you to simply copy and adapt to your own requirements. Sample
applications are located under Help>Examples.
• Wavecom modems do not support the End Call function. In order to end a call, use
the Unregister from Network function, and then re-register if required.
The Sony Ericsson GT47 GPRS modem must be used in conjunction with an
appropriate cable and 5 pin connector.
• Not supported by the V120-12 series.
Using GPRS
The PLC's Ladder application must contain the conditions and elements shown
below.
FB Name Purpose
COM Port Init FB Configure this FB to initialize the PLC COM Port connected to the GPRS-modem. Within
the COM Init FB, select the GSM modem type, and then the actual GPRS modem type,
such as the Sony Ericsson GT47.
COM Port Init is usually a Power-up task.
Note • To learn how to prepare the modem for PLC use, check the topic PLC-side Modems.
GPRS Configuration The Configuration is linked to the serial port initialized via the COM Port Init FB. Note • The
activating conditions should include the appropriate Modem Initialized SB for the COM Port.
GPRS Register must follow the GPRS Configuration. Connect provides the parameters that enable
the PLC to connect to the Internet via the cellular network.
Register to Network
GPRS Run This element enables data communications via GPRS.
Note • The activating conditions should include the appropriate Modem Initialized SB for the
COM Port.
Downloading OS via GPRS
Enhanced Vision controllers using Boot 2.00 and higher support OS download
via GPRS modem.
Notes • The TC65 does not support OS download.
The modem must be connected to COM2.
Once the download begins, the controller enters Boot mode. Any interruption
in communication may result in the controller being 'stuck' in boot mode,
without an installed OS. For this reason, it is it is recommended that
FB Operations
Register to Network
Run
Start/End Call
GPRS Configuration
The GPRS Configuration must be included in all GPRS Ladder applications.
The Configuration is linked to the serial port connected to the GPRS modem and
initialized via the COM Port Init FB.
Port Number Constant Click the drop-down arrows to view available ports; click the port you want to use.
Call Status MB This bit turns ON when the remote device has been accessed and the GPRS connection is
established.
Name Select the name of the GPRS Configuration that Connect will use to connect to the
GPRS network.
Registration MB Turns ON when the PLC is assigned an IP address and registered by the GPRS
Status network.
IP Address MI When the PLC registers on the GPRS network, it is assigned a dynamic IP address.
This is the start of a vector that contains the IP address that is assigned to the modem
when the modem registers with the GPRS network. The vector is 4 MIs long. The low
byte of each MI provides the number for an octet within the IP address.
If, for example, the IP address is linked to MI 0, and the low bytes of MI 0 to MI 3
contain the values 192, 198, 192, 45, the IP address will be 192.198.192. 45.
APN Server Constant or The name of the APN (Access Point Name) Server given by your GPRS service
MI provider.
Dial Number Constant or These parameters are required by some GPRS service providers and GPRS modem
(optional) MI manufacturers.
Password Constant or
(optional) MI
GPRS Run
This element enables data communications via GPRS and must be included in all
GPRS applications. The activating conditions should include the appropriate
Modem Initialized SB for the COM Port.
Name Select the name of the GPRS Configuration that Connect will use to connect to the
GPRS network.
End Call
This FB ends the current data communications sessions with a remote device,
but does not terminate the connection to the GPRS network.
Note • Wavecom modems do not support the End Call function. In order to
end a call, use the Unregister from Network FB, and then re-register
to the network if required.
Name Select the name of the GPRS Configuration that Connect will use to connect to the
GPRS network.
Remote TCP/IP Constant or The port the PLC uses to listen to the remote device.
Port MI
Stop Listening
This FB ends the current data communications sessions with a remote device,
but does not terminate the connection to the GPRS network.
Name Select the name of the GPRS Configuration that Connect will use to connect to the
GPRS network.
Note • Wavecom modems do not support the End Call function. In order to
end a call, use the Unregister from Network FB, and then re-register
to the network if required.
GPRS: Configuration FB
IP Address MI This is the start of a vector that contains the IP address that is assigned to
the modem when the modem registers with the GPRS network. The vector
is 4 MIs long. The low byte of each MI provides the number for an octet
within the IP address.
If, for example, the IP address is linked to MI 0, and the low bytes of MI 0 to
MI 3 contain the values 192, 198, 192, 45, the IP address will be
192.198.192. 45.
SI Description Value
185 GSM Signal Quality The value is written during COM Init of the GSM modem. The value
is updated whenever the user uses the GSM Signal Quality FB.
A value of -1 (FFFF)signifies a modem error. This may be due to a
weak signal; try repositioning the antenna. If this has no effect,
check the modem.
SBs 120-125 register the signals that each port receives from the DTR and DSR pins of a serial communication cable.
The DTR SBs 120, 122, and 124 are also used by the OS to control the DTR signal during RS485 serial communications, and
during GPRS communications using the Sony Ericsson GPRS modem.
SB# Description Turns ON when: Turns OFF when: Reset by:
SB100 GPRS modem Call Remote device begins End Session succeeds OS
connected GPRS incoming call is Disconnect from Network
answered succeeds
SB 120 DTR COM Port 1 DTR signal present DTR signal absent OS, may also be reset by
(signal output from user
PLC)
SB 121 DSR COM Port 1 DSR signal present DSR signal absent OS
(signal input to PLC)
SB 122 DTR COM Port 2 DTR signal present DTR signal absent OS, may also be reset by
(signal output from user
PLC)
SB 123 DSR COM Port 2 DSR signal present DSR signal absent OS
(signal input to PLC)
SB 124 DTR COM Port 3 DTR signal present DTR signal absent OS, may also be reset by
(signal output from user
PLC)
SB 125 DSR COM Port 3 DSR signal present DSR signal absent OS
(signal input to PLC)
Any controller in the network may function as either master or slave via the
controller's Ethernet port.
Remote PLC DataCom runs over UDP. TCP is not supported. Specific
information on implementing Ethernet is provided in the topic Using Ethernet.
The condition that activates the Configuration must turn ON for a single
program scan (positive transition recommended).
However, the Remote PLC DataCom configuration must be scanned
You can also include a DataCom Data Synchronization function in your master's
ladder application. This causes the Write messages to be sent before the Read
messages.
The programs below show how to implement PLC DataCom via Socket 0.
Master Program
Slave Program
Note • Non-Legacy controllers such as the V570 have a fast program scan.
In order to ensure that operations work correctly, ensure that the
program scan is greater than 3 msec. This can be done by
increasing the scan time with the Idle utility.
FB Operations
Update
Master Configuration
The Master Configuration enables you to send data requests to Slave PLCs.
To display the Master parameters, select Master under Master/Slave.
Each Configuration can contain both Read and Write Mix Requests. Each
request may be for a different data type. Your data request must include :
Master and Slave operand addresses
Length of vector
Direction: Read or Write
After you add a request, the OK button is disabled. Click the Compile button to
see current buffer status; if the buffer contains less than the maximum
number of bytes, the OK is enabled.
Read Write Limitations
Only the following data types may be used in Read/Write requests: MI, ML,
DW, MB, I and O.
Registers: may only be read/written to the same data type.
Booleans: Inputs cannot be written to.
I MB, O MI MI
O MB, O ML ML
MB MB, O DW DW
Configuration parameters
Delay Program MI This is the amount of time a Master PLC will halt the program scan in order to wait for an
Scan answer from a Slave. Time out units are defined in 1 msecs; the maximum is 100 msec.
Actual Time of MI This is the amount of time the Master PLC actually waited for a Slave response.
Delay
TCP/IP
Socket In order to support Remote PLC DataCom, the socket you use must be set to UDP, Multicast
mode.
By default, Socket 0 is set to UDP, Unicast.
To enable PLC DataCom, reset SB 159 to change Socket 0 to Multicast.
Memory usage
The function uses two buffers, Send and Receive. Each buffer can contain a maximum of 500 bytes.
Clicking Compile updates the Buffer Usage report.
If the Request fits in the buffer, the OK button is enabled.
Slave Configuration
The Slave Configuration enables the Slave PLC to receive data requests.
Configuration parameters
Delay Program MI This is the amount of time a Slave PLC will halt the program scan in order to wait for a Master
Scan message. Time out units are defined in 1 msecs; the maximum is 10 msec.
Actual Time of MI This is the amount of time the Slave PLC actually waited for a Master message.
Delay
Update
Update enables a PLC to receive Remote PLC DataCom messages. Update must
be included in Slave ladder applications to enable a Slave to receive messages,
and must be included in the Master ladder application to enable the Master to
receive responses from slave PLCs.
Update should be placed on the left-hand ladder rail in the Main routine.
0 - No Error
7 - The Wait Time has been exceeded ( Wait time > 100 in the
Master or Wait time > 10 in Slave).
How the Protocol FB communicates data between Vision controllers and other devices
A device, such as a magnetic card reader, may use its own proprietary protocol.
If you know the protocol's structure, you can use the Protocol FB to structure
messages accordingly. This enables a Vision controller to exchange data with
the device using the device's own protocol.
Note that before you can use Protocol operations, you must configure the COM
port to be connected to the external device in accordance with the device's
requirements. This is done by placing a COM Port Init FB in your Ladder
application.
Basic Example
The example below shows how a Vision controller can, via COM port 2, read
Register 25 within a device that has the ID number of 01. The device uses the
simple protocol shown below.
Device Protocol
STX 1 STX 02(hex) All messages must begin with the STX character
Unit ID 2 ID# range = 0-99 All messages must contain the ID number of the device that the
controller is communicating with
Checksum 2 Sum 8
Checksum
Note that the Scan message contains a Data Response field that is long
enough to contain the contents of a register.
For more information regarding Protocol operations, refer to the topics below.
FB Operations
Configuration
Scan
Send
Reset Buffer
Note • Reset Buffer must be used in the Ladder application to enable new
messages to be received.
• If you want to access a PLC via PC, remember that a PC accesses a
PLC via a serial port. Vision controller ports are served by three
communication buffers. Note that if all three buffers are busy
processing communications, new requests are ignored until a buffer
is free.
Protocol: Configuration
You create messages and attach variable data in Protocol Send and Scan
operations. Each operation is linked to a Protocol Configuration. When a Send
operation is called in your program, the Configuration determines which COM
port is used for outgoing messages; when a Scan operation is activated, the PLC
monitors that COM port for incoming messages.
Note • The Configuration should be placed in the Main Routine, before any
other FB operations. If the configuration is not active, Protocol
operations will not be processed.
• Before you place this FB in your Ladder, you must use a COM Port
INIT FB to configure a COM port.
Parameter Function
Name Identifies the configuration. You use the name to link Protocol Send and Scan operations to a
configuration.
COM Port Determines which port is used for communicating the configured protocol.
Function MB Link an MB; this MB will be ON when the Configuration is processing Scan or Send operations.
in Progress
Status MI If errors occur when the Configuration is used for a Send or Scan operation, the value of the
linked MI indicates which error has occurred.
Protocol: Scan
A Protocol Scan operation contains messages. Activating the Scan causes the
PLC to check if it has received any of the messages contained within the Scan.
The PLC can only receive messages that are contained in a Scan FB.
Scan Length This enables you to define the length of each incoming message, via the drop-down box that follows
Message index #. Scan Length causes the Scan FB to use the length of a message--including
header and terminator--to define whether an incoming message is legal.
The length of an incoming message cannot be less than the length specified in the Scan operation.
Note • This parameter overrides Start Of Text and Terminator settings.
If you use Scan Length, arrange the messages in ascending order, for example, message #0 may
contain 3 bytes, #1 may contain 4 bytes, #2 may contain 6 bytes, etc.
Start of Text (STX) Check Start Of Text to use an STX parameter to indicate the beginning of a message.
Length:
Enter the number of bytes required by the external device's protocol to mark STX.
STX Character: Click a 'byte' box and select an ASCII character.
Terminators Select one of the terminator parameters to indicate where the message ends.
Note • Use Message Length only in cases where the messages are of equal length. If the messages
are of different length, use a different terminator.
Parameter Function
Note •
-If the PLC receives a message which is not defined in the Scan FB, the message is invalid. The
Message Received MB remains OFF.
-If a message in the Scan FB contains a Numeric Variable field', and the PLC receives this message
with non-numerical characters in the field (except for leading spaces), the message is invalid. The
Message Received MB remains OFF.
-An example of leading spaces is if, for example, the Numeric Variable field is 4 boxes long, and the
'number' 22 is received. In this case, the Scan FB will register the number22 preceded by 2 leading
spaces (_ _ 2 2).
Number of MI This holds the number of bytes currently in the buffer. It is initialized by the system when a different
Bytes message is received.
Received
Index of MI This holds the index number of the received message. It changes when another message enters the
Received system.
Message The value in the linked MI is valid only when the Session Complete bit in ON. During this time, the
linked MI contains the index number of the last valid incoming message.
Once an invalid message has been received, the first incoming character of any message causes -
1 to be written in the linked MI.
Protocol Messages
Messages can include:
Fixed Text
This text does not change.
Variables
These variables may be received by the PLC: Numeric, Stream, and Checksum.
Control Characters
These can be added according to protocol requirements.
Example
Note that the Scan message contains a Data Response field that is long
enough to contain the contents of a register.
Note that if a Scan operation contains more than one message with identical
variables that use the same format, the PLC will overwrite the variable values
as they are received.
To enable the PLC to differentiate between the messages and their attached
variables, include fixed text and/or control characters within the message.
Protocol: Send
Each Protocol Send operation is linked to a particular Configuration; outgoing
messages are sent via the COM port selected in that Configuration. Send is
located on the FBs menu.
Start of Check Start Of Text to use an STX parameter to indicate the beginning of a message.
Text Length:
(STX) Enter the number of bytes required by the external device's protocol to mark STX.
STX Character: Click a 'byte' box and select an ASCII character.
Advanced Button
Protocol Messages
Messages can include:
Fixed Text
Fixed text must be included if there is more than one message in a Scan. This
enables the PLC to identify the message.
Control Characters
These can be added according to protocol requirements.
Variables
These variables may be sent by the PLC: Binary, Numeric, Stream, List of
Texts, Checksum, Date, and Time.
Example
Below, the Vision sends a data request to Unit 01. The request is Command
03, Read Register, and the register is Register 25.
This operation copies whatever information is in the buffer at the time the
operation is called.
Note • Note that copying the buffer contents is optional.
• Maximum message length is 500 characters; a message may
include up to 50 variables. Note that with in the body of a message,
no section--whether text or variable--may exceed 255 characters.
Copy Format
2->1
Select this to copy both low and high bytes of each received register value
currently in the buffer to a vector defined in the PLC. Note that this is an
entire 16-bit register, and the first 2 bytes of a 32-bit register.
4->1
Select this to copy all 4 bytes of each 32-bit register currently in the buffer into
a defined vector.
Note • Note that the Session Complete bit turns OFF automatically when
the Reset Buffer operation runs.
• Maximum message length is 500 characters; a message may
include up to 50 variables. Note that with in the body of a message,
no section--whether text or variable--may exceed 255 characters.
Variables
Variables enable you to send and receive a variety of dynamic data from your
process.
The PLC sends messages via the Configuration linked to the Send operation.
These are the types of variables that can be attached to an outgoing message.
Binary text
Use this type of variable to send text based on the status of a linked bit.
Numeric
Use a Numeric variable to send a vector of registers. You can send register
values as Binary, Hex as ASCII, or Decimal ASCII. The variable field
automatically adjusts to fit the size of the data to be sent.
Note • Sending Hex as ASCII: the PLC transfers the value to ASCII, and
sends it byte by byte, beginning from the most significant value.
Thus, the value 8F03BCA1 sent "Hex as ASCII" will be converted to
Hex and sent as follows:
38, 46, 30, 33, 42, 43, 41, 31.
Stream
Use Stream to send a vector of registers to a target device.
Note • Values are sent in binary format, beginning from the LSB. Thus, the
value 8F03BCA1 is sent as follows:
A1, BC, 3, 8F.
• In order to send floating values, select MF and the Convert 4 bytes
into 1 linked element option. Note that the PLC uses the big-endian
system; meaning that the most significant value in the sequence is
stored at the lowest (first)storage address).
1->1
Select this to send the low byte (first 8 bits) of each register in the vector.
2->1
Select this to send both low and high bytes from each register in the vector.
Note that this is an entire 16-bit register, and the first 2 bytes of a 32-bit
register.
4->1
Select this to send all 4 bytes of each 32-bit register in a vector.
List of texts
This type of variable contains a list of numbered lines of text. The value within
the linked operand 'points' to the number of a line within the list. When the
operand value is equal to a particular line number, the text of that line is
included in the variable.
Selecting the Define Length option enables you to make all of the text lines a
uniform length, regardless of the number of characters a specific line may
have. If a text line is shorter than the defined length, empty spaces will be
added; if the text line is longer than the defined length, excess characters will
be cut off.
Checksum
Via this variable, you can calculate a checksum and attach it to a message.
Use the options to configure the checksum according to the requirements of
your particular protocol.
Date
Use this variable to send the current date according to a selected format.
Time
Use this variable to send the current time according to a selected format.
To correctly identify incoming variables, use either Scan Length, or include fixed
text.
Notes • Scan Length can be defined for each message via the drop-down
box that follows Message index #. Scan length causes the Scan FB
to use the length of a message to define whether an incoming
message is legal.
This parameter overrides Start Of Text and Terminator settings.
If you use Scan Length, arrange the messages in ascending order,
for example, message #0 may contain 3 bytes, #1 may contain 4
bytes, #2 may contain 6 bytes, etc.
• If a Scan operation contains more than one message with
identical variables that use the same format, the PLC will
overwrite the variable values as they are received.
To enable the PLC to differentiate between the messages and their attached
variables, include fixed text and/or control characters within the message.
Numeric Receive
Use a Numeric variable to receive a vector of registers. You can receive
register values as Binary, Hex as ASCII, or Decimal ASCII.
Receive Stream
Use Stream to receive a vector of register values from an external device and
copy them into a defined vector of registers within the PLC.
Note • A vector is read either until the end of the defined vector length, or
until a null character is encountered. By adding a null character to
the end of the stream, you can mark the end of a data string. This
can prevent other data, that might be present in a vector, from
being added to the data string when the vector is read.
Checksum
Via this variable, you can process the checksum of an incoming message. Use
the options to configure the checksum according to the requirements of your
particular protocol.
Checksum Configuration
Use the options to configure the checksum according to the requirements of
your particular protocol.
Format Select the data representation method: Decimal ASCII, Hex as ASCII, or Binary.
Calculate The two Offset parameters determine the delimiters of the data to be calculated for
Offset
checksum.
Calculation This is the type of calculation that will be performed on the data defined above.
Type SUM
Adds all of the data bytes in the selected cells into one sum.
XOR
Calculate checksum using exclusive-OR operation.
CRC: acronym for Cyclic Redundancy Check, a procedure used in checking for errors in data transmission. A
complex polynomial is used to generate a number that is based on the transmitted data. The sending device
performs the calculation before transmission, and then sends the result to the receiving device. The receiving
device repeats the same calculation after it receives the data. If both devices arrive at the same result, the
transmission is assumed to be error-free. This is called a redundancy check because each transmission
includes not only data but extra (redundant) error-checking values
CRC-16
Calculates checksum according to CRC-16.
CRC-CCITT
This function computes a Cyclic Redundancy Code of the 8-bit
character string, using X16 + X12 + X5 + 1 as the polynomial. The
optional parameter seed may supply an initial value, which allows
for running CRC calculations on multiple strings. If the parameter
seed is not specified, a default value of 65,535 (216-1) is assumed.
Four types of CRC – CCITT are available:
CRC – CCITT 1: Checksum performed on 16-bit integers, initialized
to zero value.
CRC – CCITT 2:: 16-bit integer, initialized to value 0xFFFF.
CRC – CCITT 3: Checksum performed on bytes, initialized to zero
value.
CRC – CCITT 4: bytes, initialized to 0xFFFF.
C code
//--------------------------------------------------------------------------
------------------------------
word wCalcCRC_CCITT_WordRes( byte * bpBuff, word wBuffLen,
word wInitVal )
{
byte bShifter;
byte bData;
word wCarry;
word wCRC;
word wIndex;
int iIndex2;
wCRC = wInitVal;
for ( wIndex = 0; wIndex < wBuffLen; wIndex+=2 )
{
for ( iIndex2 = 1; iIndex2 > -1 ; iIndex2 --)
{
bShifter = 0x80;
bData = bpBuff[iIndex2];
do
{
wCarry = wCRC & 0x8000;
wCRC <<= 1;
if ( bData & bShifter )
{
wCRC++;
}
if ( wCarry)
{
wCRC ^= 0x1021;
}
bShifter >>= 1;
} while (bShifter);
}
bpBuff+=2;
}
return wCRC;
}
//--------------------------------------------------------------------------
-------------------
word wCalcCRC_CCITT_ByteRes( byte * bpBuff, word wBuffLen,
word wInitVal )
{
byte bShifter;
byte bData;
word wCarry;
word wCRC;
wCRC = wInitVal;
while( wBuffLen--)
{
bShifter = 0x80;
bData = *bpBuff;
bpBuff++;
do
{
wCarry = wCRC & 0x8000;
wCRC <<= 1;
if ( bData & bShifter )
{
wCRC++;
}
if ( wCarry)
{
wCRC ^= 0x1021;
}
bShifter >>= 1;
} while (bShifter);
}
return wCRC;
}
2's complement
This is calculated as follows:
Checksum = 0
For Stardoms to Endorses do
Checksum = Checksum + Netherworlds
End For
Checksum = (Checksum XOR 0xFFFFFFFF) + 1
Checksum This determines the length of the field which will hold the calculated checksum result.
Length Example
If the result is 7563 and the 16-bit modulus method is selected, the
results stored in checksum fields of different lengths as follows:
Length: 1 Length: 2 Length: 3
Binary 63 7563 0075, 63
Advanced: From Value and To Value determine a range for the checksum result ;if the final value falls within these limits,
Set Limits the function can automatically add a set value to the calculated checksum.
All of the Status operands linked to Protocol FBs should be assigned Power-up
Values; bits should be reset, and registers initialized to 0.
Examples
Basic Example
How does the Protocol FB communicate data between Vision controllers and
other devices?
A device, such as a magnetic card reader, may use its own, proprietary
protocol. If you know the protocol's structure, you can use the Protocol FB to
structure messages accordingly. This enables a Vision controller to exchange
data with the device using the device's own protocol.
The example below shows how a Vision controller can, via COM port 2, read
Register 25 within a device that has the ID number of 01. The device uses the
simple protocol shown below.
Device Protocol
STX 1 STX 02(hex) All messages must begin with the STX character
Unit ID 2 ID# range= 0-99 All messages must contain the ID number of the device that the
controller is communicating with
Checksum 2 Sum 8
Checksum
Below, the Vision sends a data request to Unit 01. The request is Command
03, Read Register, and the register is Register 25.
Note that the Scan message contains a Data Response field that is long
enough to contain the contents of a register.
http://www.meau.com/eprise/main/Web_Site_Pages/Public/Documents_Downl
oads/P-DD-Technical-Manuals,
entering SH(NA)3197-B under Title, and then pressing Search. Note that this
manual is in .pdf format and requires you to have Adobe's Acrobat Reader
installed on your system.
The manual includes complete protocol requirements. The elements used in
the sample application to implement the Mitsubishi protocol are presented
below.
Read Commands
Write
Station ID #
Each converter is assigned a station number. Station numbers are transmitted
in hexadecimal.
Scan
The FB shown below is located in Net 3 within subroutine: Check answer after
sending. Note how the messages in the Protocol Send FB are created to
conform to the Mitsubishi message structure.
Error codes
The Mitsubishi protocol uses an error code to determine if data is transmitted
correctly.
When a converter receives a message, it replies by sending a message to the
controller, according to the table below.
You can find general information about Ethernet, IP addressing, sockets, and
ports in the topic About Ethernet.
For more information regarding Protocol operations, refer to the topics below.
The nets below show the elements that are required by a master PLC. Note that
the master application requires Socket Init and a TCP/IP Connect function, and
that when you wish to terminate a session, you must include a Close Socket
function.
The nets below show the basic conditions enabling a TCP/ IP slave to receive
messages.
FB Operations
Configuration
Scan
Send
To learn how the Scan operation works check the Protocol FB chapter. This
chapter also includes information regarding Variables, Status and Error
Messages.
Note • The Configuration should be placed in the Main Routine, before any
other FB operations. If the configuration is not active, Protocol
operations will not be processed.
• Before you place this FB in your Ladder, your application must
include:
- a Set PLC Name function
- a TCP/IP Card Init to configure the Ethernet port
- a Socket Init function, initializing a socket to TCP
- TCP Connect and TCP Close functions
• The Protocol FB does not support UDP.
You can use Socket 0, if you change it to TCP in the Socket Init
Function.
Note that after you make this change, the default text remains
UDP, even though the socket is initialized to TCP.
Parameter Function
Name Identifies the configuration. You use the name to link Protocol Send and Scan operations
to a configuration.
(IN) Socket Determines which socket is used for communicating the messages.
(OUT) Status MI If errors occur when the Configuration is used for a Send or Scan operation, the value of
the linked MI indicates which error has occurred.
Scan Length This enables you to define the length of each incoming message, via the drop-down box that follows
Message index #. Scan Length causes the Scan FB to use the length of a message to define
whether an incoming message is legal.
The length of an incoming message cannot be less than the length specified in the Scan operation.
Note • If you use Scan Length, arrange the messages in ascending order, for example, message #0
may contain 3 bytes, #1 may contain 4 bytes, #2 may contain 6 bytes, etc.
Paramete Function
r
Note •
-If the PLC receives a message which is not defined in the Scan FB, the message is invalid. The Message Received MB
remains OFF.
-If a message in the Scan FB contains a Numeric Variable field', and the PLC receives this message with non-numerical
characters in the field (except for leading spaces), the message is invalid. The Message Received MB remains OFF.
-An example of leading spaces is if, for example, the Numeric Variable field is 4 boxes long, and the 'number' 22 is received. In
this case, the Scan FB will register the number22 preceded by 2 leading spaces (_ _ 2 2).
Number of MI This holds the number of message bytes. It is initialized by the system when a different message is
Bytes received.
Received
Index of MI This holds the index number of the received message. It changes when another message enters the
Received system.
Message The value in the linked MI is valid only when the Session Complete bit in ON. During this time, the
linked MI contains the index number of the last valid incoming message.
Once an invalid message has been received, the first incoming character of any message causes -
1 to be written in the linked MI.
Index of IP MI When you create the Configuration, you create a list of IP addresses of the devices in your TCP/IP
application. Each IP is assigned an index number.
When a message is received, the IP and exit port of the sending device is written to a vector of 5
MIs. The first 4 contain the IP address, and the fifth will contain the port number.
If the IP of the sending device matches an IP in the Configuration list, the index of the IP is written to
this MI.
Note • If the IP of the sending device is not in the Configuration list, the PLC receives the data, but
the value -1 is written to the MI.
.
Note • If the PLC receives a message from a device with an IP that is not in the Configuuse Scan
Length, arrange the messages in ascending order, for example, message #0 may contain 3 bytes,
#1 may contain 4 bytes, #2
Protocol Messages
Messages can include:
Fixed Text
This text does not change.
Variables
These variables may be received by the PLC: Numeric, Stream, and Checksum.
Control Characters
These can be added according to protocol requirements.
Note that if a Scan operation contains more than one message with identical
variables that use the same format, the PLC will overwrite the variable values
as they are received.
To enable the PLC to differentiate between the messages and their attached
variables, include fixed text and/or control characters within the message.
Protocol Messages
Messages can include:
Fixed Text
Fixed text must be included if there is more than one message in a Scan. This
enables the PLC to identify the message.
Control Characters
These can be added according to protocol requirements.
Variables
These variables may be sent by the PLC: Binary, Numeric, Stream, List of
Texts, Checksum, Date, and Time.
Variables
Variables enable you to send and receive a variety of dynamic data from your
process.
The PLC sends messages via the Configuration linked to the Send operation.
These are the types of variables that can be attached to an outgoing message.
Binary text
Use this type of variable to send text based on the status of a linked bit.
Numeric
Use a Numeric variable to send a vector of registers. You can send register
values as Binary, Hex as ASCII, or Decimal ASCII. The variable field
automatically adjusts to fit the size of the data to be sent.
Note • Sending Hex as ASCII: the PLC transfers the value to ASCII, and
sends it byte by byte, beginning from the most significant value.
Thus, the value 8F03BCA1 sent "Hex as ASCII" will be converted to
Hex and sent as follows:
38, 46, 30, 33, 42, 43, 41, 31.
Stream
Use Stream to send a vector of registers to a target device.
Note • Values are sent in binary format, beginning from the LSB. Thus,
the value 8F03BCA1 is sent as follows:
A1, BC, 3, 8F.
• In order to send floating values, select MF and the Convert 4 bytes
into 1 linked element option. Note that the PLC uses the big-
endian system; meaning that the most significant value in the
sequence is stored at the lowest (first)storage address).
1->1
Select this to send the low byte (first 8 bits) of each register in the vector.
2->1
Select this to send both low and high bytes from each register in the vector.
Note that this is an entire 16-bit register, and the first 2 bytes of a 32-bit
register.
4->1
Select this to send all 4 bytes of each 32-bit register in a vector.
List of texts
This type of variable contains a list of numbered lines of text. The value within
the linked operand 'points' to the number of a line within the list. When the
operand value is equal to a particular line number, the text of that line is
included in the variable.
Selecting the Define Length option enables you to make all of the text lines a
uniform length, regardless of the number of characters a specific line may
have. If a text line is shorter than the defined length, empty spaces will be
added; if the text line is longer than the defined length, excess characters will
be cut off.
Checksum
Via this variable, you can calculate a checksum and attach it to a message.
Use the options to configure the checksum according to the requirements of
your particular protocol.
Date
Use this variable to send the current date according to a selected format.
Time
Use this variable to send the current time according to a selected format.
To correctly identify incoming variables, use either Scan Length, or include fixed
text.
Notes • Scan Length can be defined for each message via the drop-down
box that follows Message index #. Scan length causes the Scan FB
to use the length of a message to define whether an incoming
message is legal.
This parameter overrides Start Of Text and Terminator settings.
If you use Scan Length, arrange the messages in ascending order,
for example, message #0 may contain 3 bytes, #1 may contain 4
bytes, #2 may contain 6 bytes, etc.
• If a Scan operation contains more than one message with identical
variables that use the same format, the PLC will overwrite the
variable values as they are received.
To enable the PLC to differentiate between the messages and their attached
variables, include fixed text and/or control characters within the message.
Numeric Receive
Use a Numeric variable to receive a vector of registers. You can receive
register values as Binary, Hex as ASCII, or Decimal ASCII.
Receive Stream
Use Stream to receive a vector of register values from an external device and
copy them into a defined vector of registers within the PLC.
Note • A vector is read either until the end of the defined vector length, or
until a null character is encountered. By adding a null character to
the end of the stream, you can mark the end of a data string. This
Checksum
Via this variable, you can process the checksum of an incoming message. Use
the options to configure the checksum according to the requirements of your
particular protocol.
259 Send: Invalid Message Index The message that is referenced in the Send operation does not exist.
260 Send: Invalid Operand Type The message references an operand type that does not exist in the
system.
261 Send: Invalid Operand Address The message references an operand address that does not exist in
the system.
262 Send: Data Overflow The message data exceeds 512 bytes.
263 Send: Format Error The message contains variable fields that are not long enough for the
514 Receive: Invalid message The received message does not exist in the system.
515 Receive: Checksum Error The message may have been corrupted during transmission.
PID Overview
The PID FB enables you to use system feedback to continuously control a
dynamic process. The purpose of PID control is to keep a process running as
close as possible to a desired Set Point. VisiLogic's PID FB includes auto-tune.
During the Autotune process, the PID function collects certain essential data.
Unitronics' proprietary PID algorithm uses this data to run smooth, accurate PID.
Note that you can use the Read Control Components FB in conjunction with the
PID Server utility to create a data file to send to support@unitronics in the event
that you require technical support for PID applications. Information on how to
create a data file is in the PID Server help file.
FB Operations
PID Configuration
Run PID
Error Integral
PID Autotune
Auto-tuning loops enables the system to set the parameters for PID.
The picture below shows the elements of a basic PID application with Auto-tune.
After Auto-tune runs, the P, I, and D values are automatically written to the
Configuration parameters and the Auto-tune vector is also filled with the Auto-
tune parameters.
Note Note that, once you have run Auto-tune, you can back up the P, I,
•
and D values, the sample time (ST), and the 32 MI-long Auto-tune
vector into a Data Table. You can then transfer these values to
another Vision controlling an identical system, in order to run PID
without tuning the loop.
Examples
PID Tips can help you with certain PID applications, such as those using SSR
switches.
PID Configuration
To place a PID Configuration:
1. Select PID Configuration from the FBs menu, then place the function in
the net; the PID parameter box opens.
2. The Select Operand and Address box opens; prompting you to link
operands to the PID parameters.
Note • To enable PID, values must be provided for:
Set Point
Input Range:PV Low Limit & PV High Limit
Output Range:CV Low Limit & CV High Limit
These values are used to Auto-tune the loop.
After Auto-tune runs, the P, I, D and Sample Time values are automatically
written to the Configuration parameters.
SP: MI SP is the target value for the process. In a heating system, this is the temperature value set
Set Point for the system. Note that the Set Point and Process value must be given in the same type of
units (degrees Celsius, bars, meters per second, etc.)
PV: MI PV is the feedback from the process. PV is output from the process and input to the PID
Process Value function. In a heating system, the temperature measured by a temperature sensor provides the
PV.
Kp: MI Use this parameter to define the proportional band, in units of 0.1%. The proportional band is
Proportional a percentage of the total Process Value (PV). It is a range defined around the Set Point.
Band When the PV is within this range, the PID function is active.
Ti: MI Use this parameter to define the integral time, in units of 1 second. Integral action responds to
Integral Time the rate of change in the controller’s CV output relative to the change in Error. The integral
time you set is the amount of time, as calculated by the controller, required to bring the
process to Set Point.
Note that integral (wind up) error may be initialized via the Force Error Integral operation.
Td: MI Use this parameter to define the derivative time, in units of 1 second. Derivative action
Derivative Time responds to the rate and direction of change in the Error. This means that a fast change in
error causes a strong response from the controller. The derivative action ‘anticipates’ the PV’s
value in relation to the Set Point and adjusts the CV accordingly, thus shortening the PID
function’s response time.
ST: MI Use this parameter to define the intervals between PID function updates, in units of 10mSecs.
Sample Time
Action: MB Select Off to activate Reverse Action (control type = heating), ON to activate Direct Action (
0: Heat, 1: Cool control type = cooling ).
Input Range: MI Use this parameter to define the lower limit for the Process Value.
Process Value
Low limit
Input Range: MI Use this parameter to define the upper limit for the Process Value.
Process Value
High limit
Output Range: MI Use this parameter to define the lower limit for the Control Value.
Control Value
Low limit
Output Range: MI Use this parameter to define the upper limit for the Control Value.
Control Value
High limit
CV: MI CV is the output from the PID function. CV is output from the PID function and input to the
Control Value process. Note that this output signal may be an analog or time-proportional variable value.
Auto-tune
parameters MI The start of a 32 MI-long Auto-tune vector that contains
the Auto-tuned parameters.
Note • Note that, once you have run Auto-tune, you can back up the P, I,
and D values, the sample time (ST), and the 32 MI-long Auto-tune
vector into a Data Table. You can then transfer these values to
another Vision controlling an identical system, in order to run PID
without tuning the loop.
Run Auto-Tune
The Run Auto-tune operation uses the Configuration's parameters:
Set Point
Input Range:PV Low Limit & PV High Limit
Output Range:CV Low Limit & CV High Limit
These values are used to Auto-tune the loop. After Auto-tune is run, the Auto-
tune MB turns ON, and all of the Auto-tune parameters are written into the
Autotune Parameter MI vector that is defined in the PID Configuration.
Note Note that, once you have run Auto-tune, you can back up the P, I,
•
and D values, the sample time (ST), and the 32 MI-long Auto-tune
vector into a Data Table. You can then transfer these values to
another Vision controlling an identical system, in order to run PID
without tuning the loop.
Auto-tune Parameters
Parameters: Type Function
Inputs
Stage # The number of Stages aids the system to determine accurate Auto-tune parameters. The
Default is 3. The higher the number of stages, the longer the Auto-tune time, however
choosing a lower Stage may result in less accurate Auto-tune parameters.
Auto-tune Done MB After Auto-tune is run, the Auto-tune MB turns ON, and all of the Auto-tune parameters are
written into the Auto-tune Parameter MI vector that is defined in the PID Configuration.
Run PID
In order to run a PID loop, the Run operation must be included in the application
following the PID Configuration. In order to Auto-tune the loop, the PID Run
must be suspended.
Use this function in conjunction with the PID Server utility to create a data file to
send to support@unitronics in the event that you require technical support for
PID applications.
Resolution Factor # This is the value used to factor the PID control values.
Error Integral
You can read and write to the Integral Value.
Use this operation to store the current error in the linked ML.
Use this to initialize or change the error value while the application is running.
You can erase wind up error by writing '0' into the linked register.
PID control enables you to minimize overshoot and damp the resulting
oscillations.
Proportional Action
Proportional action begins after the PV enters the proportional band; at this
point, the Error is 100%. The action outputs a value that is in direct linear
proportion to the size of the Error value.
A broad proportional band causes a more gradual initial response from the
controller. Typically, Set Point overshoot is low; but when the system
stabilizes, oscillations around the Set Point tend to be greater.
A narrow band causes a rapid response that typically overshoots the Set Point
by a greater margin. However, the system does tend to stabilize closer to the
set point. Note that a proportional band set at 0.0% actually forces the
controller into On-Off mode.
The drawback of proportional control is that it can cause the system to
stabilize below set point. This occurs because when the system is at set point,
Error is zero and the control value output is therefore pegged at zero as well.
The majority of systems require continuous power to run at set point. This is
achieved by integrating integral and derivative control into the system.
Direct and Reverse Action
Direct action causes the output to change in the same direction as the change
in Error, meaning that a positive change in Error causes a positive change in
the proportional band’s output. Reverse action creates an inverse change in
the output, meaning that a positive change in Error causes a negative change
in output.
Integral Action
Integral action responds to the rate of change in the controller’s CV output
relative to the change in Error. The integral time you set is the amount of
time, as calculated by the controller, required to bring the process to Set Point.
Note that if you set a short integral time, the function will respond very quickly
and may overshoot the Set Point. Setting a larger integral time value will
cause a slower response. Integral time is sometimes called Reset.
The controller’s CV output may reach and remain at 100%, a condition called
saturation. This may occur, for example, if the process is unable to reach Set
Point. This causes the Error signal to remain stuck in either the positive or
negative range. In this situation, the integral action will grow larger and larger
as the Error accumulates over time. This is called integral "wind up", which can
cause the controller to overshoot the set point by a wide margin.
Derivative Action
Derivative action responds to the rate and direction of change in the Error.
This means that a fast change in error causes a strong response from the
controller.
The derivative action ‘anticipates’ the PV’s value in relation to the Set Point
and adjusts the controller’s CV output accordingly, thus shortening the PID
function’s response time.
PID Tips
Background: the Proportional Band and PV
The proportional band is a range defined around the Set Point. It is expressed
as a percentage of the total Process Value (PV). When the PV is within this
range, the PID function is active.
Note • The proportional band may exceed 100%. In this case, PID control
is applied over the entire system range.
• The PV and Setpoint must be the same unit type.
Note • A broad proportional band increases the stability of the system, but
also increases fluctuations during the stable phase.
Note • If you are using a PT100 or Thermocouple input, the values do not
have to be linearized. This is because the input value is already in
degrees Celsius or Fahrenheit ( 0.1 ° resolution) according to the
Hardware Configuration.
Example: If the MI that is linked to a temperature input, set to
Celsius, contains the value 385, the temperature reading is 38.5 ° C.
Although you can set the PV limits to the input range, this may not produce
accurate results.
Example 1: Assume that the 14-bit pressure transducer mentioned above is in
a system with range limits of 0-5 bars. If you set the PV Low to 0 and the PV
high to 1000 (10.00 bars), this is the range that will be used by the PID
function. PID will work properly.
However, you can achieve better PID control by setting the PV Low to 0 and
the PV High to 600 ( 6 bars). Since the error is a function of the PID working
band, Example 2 will run with approximately 40% greater accuracy than
Example 1.
Example 2: Thermocouple type 'J' has as range of -200 to 760 ° C. Assume
that this is the input for a PID system with an ambient temperature that can
reach a low of 10 ° C to a maximum setpoint of 250 ° C. If you set the PV Low
to 0 and the PV High to 300 ° C, PID control will function with approximately 3
times greater accuracy than if you set the PV range to cover the entire -200 to
760 input range.
PID via Digital Output (Contactor, Solenoid Valve, SSR)
You can use the PWM (Pulse Width Modulation) FB to control a PID system.
PWM FB enables you to control the ratio between the ON and OFF status of a
selected MB (Duty Cycle) within the defined cycle time, which is given as ticks
of 2.5 milliseconds. The ratio is given as an ON pulse percentage on the range
of 0-1000 (0-100%).
In order to control PID with the PWM FB, you must set the PID CV range to 0-
1000 (0-100.0%).
Since the PWM cycle time is set in ticks of 2.5 ms, e.g. 1 s = 400. If the output
is a relay/contactor/solenoid valve, the recommended cycle time range is
between 2000 and 12000 (5 to 30 sec).
Example: As the PWM output MB pulses ON and OFF, the pulse ON time is
proportional to the CV. If the cycle time is = 4000 (10 sec), and the CV is 100
(10.0%), the output bit will be ON for 1 second and OFF for 9 seconds, thereby
supplying 10% of the energy to the system.
If the switch is an SSR, the recommended cycle time range is between 200
and 1000 (0.5 to 2.5 sec). Transistor outputs are preferable.
If you use an SSR, you can use a Unitronics PLC that supports a high-speed
output. In Hardware Configuration, set the Frequency (F=1/CT) parameter's
Power-up Value to 5 to 10Hz ( which is 0.2 -0.1s cycle time). Link the PWM
Duty Cycle MI to the CV. Note that in order to activate the output pulses, you
must SET the RUN MB linked to the HSO in Hardware Configuration.
Using Drum
The main routine of a basic drum Ladder application must include a:
Configuration
The Configuration contains the Drum Outputs, arranged in steps. The
duration time of each step is also set in the configuration.
Scan
This should follow the Configuration. The Scan controls the drum; if the
Scan is inactive, the drum is static.
These elements enable the drum to begin at a Start Step, which is specified in
the Configuration. When the duration time set for the first step elapses, the
drum progresses to the next step. When the last step in the drum is complete,
the drum continues with the Start Step.
Scan
Go To Step
Go To Start Step
Go To Next Step
Your program must activate the Drum Sequencer Configuration before running
Drum Sequence operations. You can do this by activating it as a power-up task.
Name Description
# This the Step Index number. Use this together with the Go To Step Index operation, which you use for
determining the Drum operations' functions.
Start When the Drum Sequencer runs, this is the first step in the sequence. Whenever the drum restarts,
whether as a result of power failure or any other reason,
Duration If you do not set a Time, the drum will remain in that step, unless a Jump to Step operation changes
the current step.
Current Step This MI contains the Step Index number of the current drum process step.
Index
Next Step
Use this to immediately progress to the next step, without relation to the current
state of the drum.
Go To Start Step
Use this to jump back to the Start Step set in the Configuration..
Go To Step (Index)
Use this to immediately jump to a particular step, according to its Step Index
number.
Events Overview
Events: Registering MB status change
An Event is the change in status of an MB from OFF (0) to ON (1). Events can be
used, for example, to monitor the status of an array of alarm bits. The Events
FBs are located on the FB's menu.
Event Operations
Event: Scan
Next Event
Previous Event
Clear Current
Clear All
Events: Count
Events: Loopback
Track Events
Events: Scan
Use the Events: Scan to define a vector of MBs and locate the first positive bit
within that vector. Once you have defined a vector of MBs using the Events
Scan FB, you can perform other actions within that vector using Event
operations.
Note • Place the Scan FB directly on the left-hand Ladder rail; this ensures
that all of the Events functions will run continuously.
Active MB MI, Contains the location of the Active MB, relative to the beginning of the defined vector.
Location: ML,DW Note • If no MB is active, the value in the linked register will be -1.
Offset in
Vector
Next Event
Once a vector of MBs is defined using the Event Scan FB, the Scan finds the first
active MB in the vector.
Use the Next Event operation to move to the next active MB in the vector, in the
direction of the Most Significant Bit.
Previous Event
Once a vector of MBs has been defined using the Event Scan FB, the Scan finds
the first active MB in the vector.
Use the Previous Event operation to move to the previously active MB in the
vector, in the direction of the Least Significant Bit.
Clear Current
Use the Clear Current operation to reset a currently active MB.
Clear All
This operation causes all of the active MBs in an Event vector to be reset.
Events: Count
This shows the number of MBs currently ON within the vector defined by the
Events Scan.
Events: Loopback
When Loopback is activated by power flow, the focus of the Events moves to the
beginning of the vector.
Track Events
This FB enables you to keep track of Rise and Fall events as they happen.
Rise Events:
Each time an MB rises in the Events vector, the Rise Event MB in Track
Events turns ON for a single cycle, and the Rise Location MI contains the
location of the active MB, relative to the beginning of the Events vector. If
two MBs rise during a single cycle, the Rise Event Location MI will show
the events in two consecutive cycles.
Fall Events:
Each time an MB falls in the Events vector, the Fall Event MB in Track
Events turns ON for a single cycle, and the Fall Location MI contains the
location of the active MB, relative to the beginning of the Events vector.
If two MBs fall during a single cycle, the Rise Event Location MI will show
the events in two consecutive cycles.
Note that Track events can only monitor an vector that, as defined in the Events
Configuration, does not exceed 255 MBs in length.
PWM FB Overview
The PWM FB enables you to control the change in the status of a selected MB,
causing it to function like a PWM (Pulse Width Modulation) output at a
resolution of 2.5 milliseconds (in relation to the total scan time).
You can place the PWM FB directly on the left Ladder rail to cause it to run
continuously. PWM is located on the FBs menu.
Parameter Function
Cycle Time The total cycle time. One unit of cycle time is equal to 2.5 msec.
Duty Cycle The ratio of the "on" period of a cycle to the total cycle period, expressed as a
tenth of a percent of the total Cycle Time.
Output The MB you select will function as the PWM output. It will be turned ON and OFF
according to the input parameters.
Example
Cycle Time = 800
Duty Cycle = 255
If the Cycle Time parameter is 800; the total PWM cycle time will be
2000mSec (800 x 2.5 = 2000mSec).
If the Duty Cycle parameter is 255; the selected MB will be ON for 25.5% of
the total Cycle Time (25.5% of 2000 = 510mSec), and OFF for 74.5% of
the total Cycle Time (74.5 of 2000= 1490mSec)
Loadcell Overview
Loadcell FBs, located on the FB menu, enable you to include an I/O module
that is connected to a loadcell or strain-gauge in your control application.
Unitronics I/O expansion loadcell modules are intelligent I/O modules that are
capable of receiving analog values directly from loadcells.
IO-LC1 offers 1 Loadcell input; IO-LC3 module offers 3 Loadcell inputs. Each IO-
LCx module is capable of providing excitation for up to 12 loadcells.
The Loadcell FBs enable you to calibrate the loadcell. You can also tare and
zero the loadcell, compensate for deadload and scale movement, and set the
input range.
Once you connect the loadcell and calibrate at least 2 points, you can begin to
run a loadcell application. The loadcell input can be read in 6 different ways:
Gross weight
Net weight
Net Min. Weight
Net Max. Weight
Scaled to uV/V
Raw Value
Most applications will require only the Gross or Net weight. Raw Value and uV/V
readings may be useful for troubleshooting purposes.
Note • Minimum settling times for projects using multiple loadcells are
12.5ms for one active loadcell
675ms for two active loadcells
1,012.5ms for three active loadcells
More information is available in the Setup Help topic, and in the
module's specification sheet..
• Both negative and positive (signed and unsigned) values can be
processed by the I/O-LCx and the support software, enabling a range
of applications.
• This feature is not supported by the V120-12 series.
FB Operations
Configuration
Scan
Calibration
Setup
Advanced
Note • Both negative and positive (signed and unsigned) values can be
processed by the I/O-LCx and the support software, enabling a range
of applications.
• This feature is not supported by the V120-12 series.
In use Select 'In Use' to enable the loadcell for the application.
Note • A loadcell marked 'in use' can be suspended according to application conditions
via the Advanced Calibration function Enable/Disable loadcell. This may be done to
shorten the application's calibration time.
Resolution ML, Selecting High enables you to link the input value to an ML, Normal to an MI.
MI
LC Input Value(s) MI, When the application runs, these registers contain the weight value input to the
ML controller from the I/O LCx.
When you select two values, you link the first value to a single register. The second
value is automatically linked to the next register.
The default representation mode for the first register is Net Weight, and Gross Weight
for the second register.
Excitation AC is the default, recommended Excitation method. You may select the DC option if
your application requires.
Loadcell: Configuration
All Loadcell operations run through a Loadcell Configuration placed in the control
program. Each Configuration is linked to a specific Loadcell input on the I/O
expansion module.
I/O Module Links the Configuration with the correct I/O expansion module according to its DIN rail location
in Hardware Configuration.
DIN
Location
Note • If the module is not located in the entered location, the LC Command Status
Messages MI will display 6, Communication Error (I/O module does not exist)
Note • If the selected Loadcell is not marked 'In Use', the LC Command Status Messages MI
will display 11, Illegal parameter
LC MI
Is reset to 0 when a command is activated.
Command Updated at the end of all operations using the Loadcell Configuration.
Status Indicates error status for all loadcell operations processed by the Configuration
Messages Current value always shows the most recent error status.
Value Message
0 Function in Progress
1 Command carried out successfully
2 I/O Expansion Command Buffer is full, please retry.
Can be avoided by using SB 91, I/O Expansion Module--Command Buffer
Full, as a condition
3 The I/O expansion module linked to the configuration is busy
5 Timeout Exceeded
6 Communication Error (I/O module does not exist)
11 Illegal parameter
13 Power supply not connected
16 Scale is currently in motion (is only relevant if In-Motion function
is applied)
17 Signal is out of range (this value occurs when the Out of Range
bit is ON)
18 Illegal weight (Occurs during calibration, if the raw value of
weight being calibrated is too close to the raw value of an already
calibrated weight; minimum distance is 256 or 100 Hex)
19 Command not supported in uV/V mode
20 Not calibrated (This value appears when less than 2 points have
been calibrated)
21 EEPROM Protection Error (Indicates when too many Save
Calibration FBs are run too frequently. Check the activating conditions for
the Save Calibration FB, and whether your application contains loops)
Function in MB This bit is ON when the module is processing a command. Use this as a condition bit for
Loadcell operations to avoid conflicts.
Progress
Turns ON when: Turns OFF when:
Command is being processed. Configuration is first activated.
Command Status Messages MI is 0. Command Status Messages MI is 1.
LC Function LC
Success in Command Status
Bit Progress Messages
Command 0 1 0
Issued
Success 1 0 1
Error 0 0 >1
Scan
A Scan FB must be included for every Loadcell Configuration in a Loadcell
application. When an application contains more than 1 Loadcell Configuration in
the Ladder, the Scan FB displays the Select Name drop-down list, enabling you
to link the desired Configuration.
Calibration
Calibration parameters include calibrated points, input range settings, tare and
zero values. These may be burned to the module's EEPROM using the Save
Calibration FB. Before you can begin to implement a Loadcell application, you
must calibrate at least two points, although up to 12 points may be calibrated;
all other calibration parameters are optional. However, note that if the
application requires you to set Input Range/Gain, you must make these settings
before you calibrate points. Setting the Input Range/Gain after calibrating
points invalidates these points.
Calibrating Points
A Calibration Point matches a Raw Value with a Weight value. These points are
used to linearize the input value.
To calibrate points, connect the controller to the loadcell via the I/O-LCx.
Initial calibration is generally performed with known weights as shown in the
following figure. After calibration has been performed, advanced calibration
enables points to be added or edited via the ladder without weight being
physically placed on the loadcell.
Notes • If the application requires you to set Input Range/Gain, you must
make these settings before you calibrate points. Setting the Input
Range/Gain after calibrating points invalidates the calibrated
points.
• Zero does not have to be calibrated.
• Points do not have to be calibrated in any particular order.
• All calibrated points must be separated by a raw value minimum of
256 (100 Hex).
• Calibration is an immediate operation; motion is not checked
before the operation is carried out.
• Calibration should be performed with greater accuracy than is
required by the application. For example, in an application that
requires 100g accuracy, calibrate in units of 10g, then round off
the represented value by 10.
• The highest Calibrated Point weight value should 80–100% of the
scale capacity.
• Calibration cannot be performed if the selected representation
mode is uV/V.
• During Calibration, increase filter depth by:
- Increasing Settling Time.
- Disabling other Loadcells.
Calibrate Point FB
The Calibrate Point FB is located on the FB's>Loadcell>Calibration menu.
Point Constant, A Calibration Point matches a weight value with a raw value. The raw value is acquired as an
MI input from the loadcell when the application is run.
Number
Calibrate MI, ML This provides the weight value that is matched to the raw value
to Weight
Save Calibration
When you save the calibration, calibrated points, tare, zero, and input range
are burned into the module's EEPROM memory. This protects the calibration in
the event of a power outage, reset, or power-up. To preserve any changes
made to calibrated points, input range settings, tare and zero values, use Save
Calibration any time these parameters are edited.
When Zero is applied, only the gross weight will be zero at the beginning of a
weighing session.
Acquire Tare and Acquire Zero are both located on the FB's>Loadcell>Tare &
Zero menu.
Acquire Tare: In this method, the tare value is acquired from the scale. The
objects comprising the tare, such as a pallet or materials container, are placed
on the scale, and Acquire Tare is activated.
Acquire Zero: The scale must be empty to acquire Zero. Acquire Zero is not
related to the Auto-Zero Tracking function, which enables the module to
compensate for the accumulation of undesired material on the scale in the
course of operations.
Note • Loadcell Name determines from which loadcell the tare/zero will be
acquired. After the tare has been acquired, the tare value will be
applied to that loadcell.
• Use the Save Calibration FB to save Tare and Zero values to the
module's EEPROM memory.
• Tare and Zero cannot be acquired when running uV/V mode.
• If the Motion Band FB is activated, the tare value cannot be
acquired until the scale is stable.
Although only the FBs relating to tare are pictured in the following figures,
the figure apply to both Tare and Zero FBs.
Tare/Zero MI, ML, Edit Tare/Zero enables the tare value to be acquired from a register or constant value within
or the controller.
Value Constant You can also use Edit Tare/Zero to change a loadcell's existing tare/zero value.
Read MI, Reads the current tare or zero value applied to the linked loadcell input into the linked register.
ML
Tare/Zero
Setup
Setup FBs provide additional parameters that you may require for your
application. Setup FBs include Motion Band, Filter & Rounding, and Auto-Zero,
and are located on the FB's>Loadcell>Setup menu.
Note • The Setup FBs need to be activated only once, at power-up. They
are not saved to EEPROM.
Motion Band
When the weight on the scale changes, the scale needs time to stabilize.
The Motion band determines the amount of weight change the module uses to
decide if the scale is in motion.
As the module reads the signals from the loadcell(s) it calculates the weight
value. If a weight change falls within the Motion Band, Bit 0 turns OFF.
In the figure below, the in-motion indicator (Bit 0) turns ON when the weight
change is below 100 grams, or more than 500 grams. When the weight change
falls within the band (100 to 500), Bit 0 turns OFF.
LC Motion MI, ML, Provides a value for the weight band. A weight change that falls outside this band turns the
or In-motion bit ON. When the weight change is inside the band, the bit turns OFF.
Band Constant
The Filter & Rounding parameters change the default filter parameters and value
rounding. Rounding further smooths the loadcell reading.
Settling MI,or The time, in units of 10msec, that the filter requires to settle to the final reading.
Constant Notes • The default settling time is 1 second, the minimum time 1 is 12.5 milliseconds, and
Time the maximum is 24 seconds.
• A value of zero disables the filter.
• Settling time rises with the number of active loadcells.
The minimum settling times are:
- 12.5ms for one active loadcell.
- 675ms for two active loadcells.
- 1,012.5ms for three active loadcells.
Using a settling time of zero sets the settling time to its minimum value without returning an
error.
Active MI, ML, The band of weight changes in which the filter is active.
or The filter is turned off by weight changes that exceed the active band. This allows a rapid
Band Constant response to large weight changes. When the weight changes become smaller than the active
band, the filter turns on.
An active band of zero forces the filter to be always active.
Notes • If the Motion Band is on, the filter's Active Band must be equal or higher than the
Motion Band.
LC Time: MI, ML The time in which, in units of 10 mSec, the scale must be stable in order to trigger
or Auto-Zero Tracking.
Scale Stable, 10 Constant Notes • Initializing this parameter to 0 will turn off Auto Zero Tracking and clear the
mS units accumulated offset.
• Power-up default: 0 (auto zero tracking is off).
• To clear the auto zero tracking offset, initialize this parameter to 0, and then
enter a new time value.
LC Tracking MI, ML This determines the maximum distance from the point of the last zero (auto or
or manual) in which auto-zero tracking is activated [weight units].
band, Constant
Weight from last
Auto-0
LC Tracking MI, ML This determines the maximum weight from the point of the last calibrated zero in
or which auto-zero is activated.
Range, Weight Constant
from Calib. 0
Note • Bits 6 & 7 are linked to Outputs 0 & 1, located on the I/O module. Bit 6 is related to Output 0, Bit 7 to Output 1.
Bits 6 & 7 can be used to monitor the setpoint output's status from within the Ladder application.
The I/O module itself controls the setpoint function of the outputs. The module turns the outputs ON and OFF when the current
loadcell input value reaches setpoint. Since the function is based in the firmware of the expansion module, when the output's
status changes as a result of reaching/departing from setpoint, the status change is not registered by the Ladder application.
Examples
When setpoint output 1 is assigned to load cell channel 0, Bit 7 of load cell 0 status will indicate the state of output 1.
When setpoint output 0 is assigned to load cell channel 2, Bit 6 of load cell 2 status will indicate the state of output 0.
6 Setpoint Status, Output 0 Output 0 is ON Output 0 is OFF
SB91 I/O Exp. Module--Command buffer is full ON when commands cannot be sent to OFF when commands can be
the I/O module. sent to the I/O module..
Note • The Edit and Read Calibration Point functions contain parameters
which accept the raw and weight values from existing Calibration
Points. These parameters must be linked to the same type of
registers, MI or ML, used to calibrate the original Calibration Point.
Notes • The loadcell will stop functioning if deleting a point causes the
number of Calibration Points to be less than 2.
• To prevent your changes from being lost at power-up, reset, or in
the event of power outage, use the Save Calibration FB to burn the
changes to the module's EEPROM.
LC Raw MI, or This register contains the new raw value for the Calibration Point.
ML
Value
LC MI, or This register contains the new weight value for the Calibration Point.
ML
Calibrate
to Weight
Note • If the point being read is not in use, both returned values will be -
32768 (0x8000) for integer and -8388608 (0x800000) for long.
LC Raw MI, or This register contains the current raw value of the Calibration Pointt.
ML
Value
LC MI, or This register contains the current weight value of the Calibration Point.
ML
Calibrate
to Weight
Notes • The loadcell will stop functioning if a deleted point causes the
number of Calibration Points to be less than 2.
• To prevent your changes from being lost at power-up, reset, or in
the event of power outage, use the Save Calibration FB to burn the
changes to the module's EEPROM.
Clear Calibration
This deletes all calibrated points, tare, zero, and input ranges from the module's
memory. However, Clear Calibration does not erase the values from the
EEPROM. They may be retrieved from the EEPROM by resetting the controller.
To delete all values from the EEPROM, run Clear Calibration followed by Save
Calibration.
During Calibration, the Disable All Other Loadcells FB can be used to increase
filter depth for a specified settling time by eliminating the delay caused by
channel change (approx. 300ms) and thus ensuring faster and more accurate
calibration.
To prevent channel changing from wasting settling time, use this function to
disable all other loadcells except for the one you are currently calibrating.
Enable All Other Loadcells re-enables all loadcells in the expansion module.
Setpoint
Each digital output located on the I/O module is associated with a setpoint. The
I/O module itself controls the setpoint function of the outputs. The module turns
the outputs ON and OFF when the current loadcell input value reaches setpoint.
Setpoint activity is therefore not linked to the program scan. Each output may
be assigned a setpoint.
Since the function is based in the firmware of the expansion module, when the
output's status changes as a result of reaching/departing from setpoint, the
status change is not registered by the Ladder application. To monitor the
outputs' status, this MI provides a bitmap indicating status messages; Bit 6 is
related to Output 0, Bit 7 to Output 1.
Examples
When setpoint output 1 is assigned to load cell channel 0, Bit 7 of load cell
0 status will indicate the state of output 1.
When setpoint output 0 is assigned to load cell channel 2, Bit 6 of load cell
2 status will indicate the state of output 0.
Bit Description Turns ON when: Turns OFF when:
LC Value Constant Set the input value mode for the setpoint:
0 - Net
Mode 1 - Gross
2 - Net Min
3 - Net Max
LC Setpoint MI, ML, or Sets a band in which the output will not chatter due to overshoot or vibrations.
Constant
Hysteresis
Deactivate Setpoint
Use this to suspend the activity of a particular setpoint.
mode for the first register is Net Weight, and Gross Weight for the second
register.
Via Change Representation mode, you can 'read' the value as:
Gross weight
Net weight
Net Min. Weight
Net Max. Weight
Scaled to mV
Raw Value
LC Value to Constant Select the value for which you want to change the representation mode.
Represent
As soon as the scale becomes stable, meaning that the In-motion bit is OFF, the
Net Min and Max values will be set to the net value.
Note • Changing the excitation mode may add an offset to the A/D
measurements. Therefore, the system should be calibrated using
the same excitation mode the loadcell will work with.
• In general, the working excitation mode should be set via
Hardware Configuration.
• The Change Excitation command overrides the hardware
configuration excitation setting until the next system reset /
power-up.
• Changing excitation mode may cause a momentary conversions-
break (about 300msec) due to filter reset.
LC MI or 0=DC
Constant 1=AC
Excitation
mode
Input Range
The Input Gain parameter sets the amplification range for the input signal.
Input Range and Offset are considered part of the loadcell's calibration. To burn
these values into the module's EEPROM memory and protect them in the event
of a power outage, use the Save Calibration FB.
Notes • Changing Gain or Offset requires you to recalibrate and save all
calibrated points.
• If the application requires you to set Input Range/Gain, you must
make these settings before you calibrate points. Setting the Input
Range/Gain after calibrating points invalidates the calibrated
points.
• Offset values out of the ±31 range will be truncated and no error
will be returned.
• The uV/V rep. mode uses its own input range settings and
therefore is not affected by the command.
Set Gain FB
This FB limits the input range. The gain is applied to the signal after offset
compensation.
Setting the Set Gain MB to 0 limits the input range to ±20mV (Default setting),
setting it to 1 (or any other value) limits the input range to ±80mV.
Set Offset
This FB sets the offset compensation, which is applied to the input signal before
the gain. By default, the offset is set to 0mV (no offset).
Possible values are in the range of ±31, where: 1LSB ` 0.5mV/V (= 2.5mV at
exactly 5V excitation). Hence, the maximum offset compensation is ±15.5mV/V
(= ±77.5mV at exactly 5V excitation).
To calculate the offset value, measure the differential voltage at the input,
between the -SG and +SG terminals, and then calculate the offset value
according to 1LSB ` 0.5mV/V.
If, for example, the differential voltage at the input is 10mV, use -4 as the offset
value.
Read Gain
Reads the input range Gain.
Read Offset
Reads the input range Offset.
Filter Overview
Filter, located on the FB menu, enables you to take from 4 to 16 values and
calculate an average. You can influence the average by configuring the function
to:
Note • The values are not allocated memory, but are stored and calculated
independently within the function block.
• Certain analog inputs can also be filtered via Hardware
Configuration settings.
In the figure below, Filter Calculate is linked to the configuration Filter_1. In this
configuration, Parameter 1: Filter type is Dynamic Average; Parameter 2:
Number of Values is 8; and Parameter 3: Discard Values is 2.
ML 0 provides the input values. Each time Filter: Calculate is activated, the
value in ML 0 is copied to the vector of the linked Filter Configuration,. In this
example, 8 values are collected. As each new value is input, the oldest value is
shifted out.
Since Discard Values is 2, the 2 lowest and 2 highest values are discarded. The
remaining values are summed, and then averaged (30+40+50+60=180/4). The
result is 45, which is output to ML 1.
FB Operations
Filter: Configuration
Filter: Calculate
Filter: Configuration
The Filter Configuration holds the parameters that determine how the input
values are averaged, therefore it must be activated before the Filter: Calculate
function is called.
Filter Type: Dynamic Average Each input value is given equal weight.
Calculates the average of
all the current input values
Order-weighted Average More weight is given to the newer input values. (FIFO)
Number of Values 4-16 Defines the values in the vector as well as the divisor for
calculating the average.
Discard Values 0-4 Removes the minimum and maximum input values according
to the selection. For example, selecting the number '3' cause
the 3 lowest and 3 highest values to be discarded before the
average is calculated.
Filter: Calculate
Each time the Calculate function's activating condition is turned ON, the
function's Input parameter is copied to the vector of the linked Filter
Configuration, the average is calculated, and the result is placed in the linked
output operand.
Accelerate Overview
Accelerate causes a register value to increment or decrement within a set range,
at an accelerating or decelerating rate. This rate increases/decreases
exponentially as long as the function receives power flow.
FB Operations
Configuration
Increment/Decrement
Configuration
The Configuration should be called as a Power-up task. The function sets the
parameters which determine the value to increment or decrement, the range for
that value, the initial step size, and the factor of acceleration/deceleration.
Rate of Acceleration = Acceleration factor * Initial Step Size * Time ( where time
is the duration of the time period that Accelerate is active)
Value to MI,ML, This is the register value that is incremented ('accelerated') or decremented
Increment/Decrement DW, or ('decelerated).
Range: Minimum MI,ML, The value being incremented or decremented cannot fall below this value.
Value DW, or Note • Both minimum and maximum values must be assigned to the same operand
Constant type.
Range: Maximum MI,ML, The value being incremented or decremented cannot exceed this value.
Value DW, or
Constant
Initial Step Size MI or When the function is activated, this determines the step size during the first 3
Constant seconds of Increment/Decrement. One step is made each seconds. After three
seconds has elapsed, the function uses the Initial Step Size as a factor in calculating
the rate of acceleration.
Note • This value cannot exceed 255.
Increment/Decrement
Increment
Decrement
The module can be set to work in four different modes via the Set Mode
operation. In addition, the Set Counter operation may be used to store a value
or reset the high-speed counter on the module.
Wait the time span defined for Input 1, then change the state of the
corresponding output.
Register when Input 2 turns ON or OFF.
Wait the time span defined for Input 2, then return the output to its
original state.
If, however, Input 2 does not change state within the time span defined
for the corresponding output, the output state changes.
Configuration
Use this to select the I/O Expansion Module for Fast Response
Set Mode, to select the Fast Response mode and the input or inputs. Note
that selecting an input automatically selects the corresponding output; for
example, selecting Input 35 automatically selects Output 35.
Scan
In the application shown below, I 33 is selected as the input. This means that
O33 is automatically selected, and that O41 is the 'toggle output' that you use to
toggle in and out of Fast Response mode.
Note • Older I/O Expansion Module models may not support Fast
Response.
The module bears a sticker which gives the version number. Versions previous
to V4.00 do not support this function.
FB Operations
Set Mode
Set Counter
Scan
Parameter Function
Status The value in the linked MI indicates the status of the function
Messages
0 - Function in progress.
1 - Complete without error.
2 - Buffer is full (impossible to send the command – please retry.
Note that SB 91 (in M91, Next1 and Vision) is set when the buffer is full.
3 - The expansion module is processing another command – please retry.
6 - Communication Error (fatal) (expansion module does not exist).
Input Address The address of the actual input in the project's Hardware Configuration. When you select an
input, the corresponding output is automatically selected: ex., selecting I0 automatically
selects O0.
Only odd-numbered addresses may be used.
Rise/Fall This is the event that causes the module to begin counting the input's Time Span
Time Span The value in the MI linked to Time Span provides a preset timer value.
- Latch: once the time span is activated, time continues to elapse even if the input changes
status.
- On Delay: If the input changes status while the time span is being counted, the counting
stops. When the input status changes again, the counter reset, and begins again from the
preset value.
Output Address When you select an input, the corresponding output is automatically selected.
Set: Selecting Set means that the output's start state is OFF. After Input 1's Time span has
elapsed, the output turns ON.
Reset Selecting Reset means that the output's start state is ON. After Input 1's Time span has
elapsed, the output turns OFF.
Time Span This is the amount of time the output will be ON or OFF
Notes • Do not place Set Mode directly on the Ladder rail. Your program
should activate Set Mode for a single program scan. If your
application changes modes, activate Set Mode for a single scan at
each change.
• In Two Input modes; note that you can only assign odd addresses
to Input 1.
• When an input is selected, the function controls the corresponding
output. For example, if I35 is selected, O35 will be controlled by
the function.
• In Two Input modes, when the first input address is selected, the
function automatically selects the previous address for the second
input.
Notes • Do not place Set Counter directly on the Ladder rail. Your program
should activate Set Counter for a single program scan, each time
you wish to set the counter.
To use BAS, you must initialise the PLC COM port to 9600, 8n1.
BAS Operations
Configuration
Scan
Open Session
Configuration
The BAS Configuration must be included in the application. In addition, Scan is
required in order to enable the PLC application to receive BAS messages; the
Open Session operation must also be included in the application.
Configuration Parameters
Parameter Type Function
Port # Constant Enter the number of the PLC serial port that connects the PLC to the BAS network.
Router ID Constant If the BAS card is accessed via a router, select the ID number.
Time Out MI or Amount of time the PLC will wait for a reply, units of 10 mS.
Constant
Function in MB Turns ON when the PLC sends a BAS data request, remains ON either until the Time Out is
Progress exceeded or until a message is received in answer to the data request. Use this MB as a
condition to send a message.
Retries Made MI or Number of times the PLC has attempted to send a message.
Constant
The message was received from a router that is not the router named in
the data request message
9 Illegal Command
The command received does not match the command in the data request
message
10 (Receive) Illegal point value
The point received does not match the point in the data request message
11 (Receive) TimeOut
An answer was not received before the timeout set in the BAS
Configuration.
12 (Receive) Checksum error
13 (Receive) Illegal offset for IO type
Open Session
In order to run BAS operations, you must include Open Session in the
application; it may be activated as a power-up task.
Scan
To enable the controller to receive messages, place an BAS Scan FB in your
application and link it to a Configuration. When activated, this causes the
controller to scan the Com port for incoming BAS messages.
Before you can receive a BAS message, you must initialize a COM port.
Point Value MI or
Card Point to be read from/written to.
Constant
Bit offset MI or
Enter the bit offset value.
Constant
Result MB Read: Writes the current status of the I/O to the selected MB.
Write: Writes the current status of the MB to the selected I/O.
Analog I/Os
Point Value MI or
Card Point to be read from/written to.
Constant
Result MF Read: Writes the current value of the I/O to the selected MF.
Write: Writes the current value of the MF to the selected I/O.
FB Operations
Configuration
Draw
Clear
Configuration
The Draw Axis Configuration sets the parameters the controller uses to draw the
axis on the LCD. Each Draw Axis operation is linked to a Configuration.
Axis Type Constant This sets the axis direction. Select between:
X axis (horizontal).
Y axis (vertical).
Constant
Status MI If the axis or ticks are not drawn when the Draw operation is called, check the value of
the Status MI.
The first 4 (LSB) bits of the MI act as a bitmap to indicate the messages listed below.Bit
Message
0 PLC in Info Mode, Axis cannot be drawn
1 PLC in Info Mode, Axis cannot be cleared (erased).
2 The main axis line cannot be drawn because:
- the length of the line exceeds the screen's dimensions.
- the coordinates of the line are not within the screen.
- both of the above.
3 The ticks cannot be drawn because:
- the length of the ticks exceeds the screen's dimensions.
- the ticks are not within the screen.
Each axis, whether x or y, that is drawn on screen requires a separate Draw Axis
Configuration. In addition, note that in order to obtain an axis with different tick
heights, you must superimpose one axis on top of another.
The example below shows a horizontal axis that is composed of 2 separate Draw
Axis Configurations. Note that the parameters supplying coordinates are
identical; the tick height and spacing are different.
Draw
To display the axis on screen:
Clear
To clear the axis from the screen:
Note • The Draw Axis Clear clears the last axis drawn.
This means that if the application:
Draws an axis,
Redraws the same axis, but after changing the Configuration's
parameters, changing the location/appearance of the axis,
Runs Clear Draw Axis
The result is that only the axis drawn in Step 2 will be cleared.
This means that you must run Clear Draw Axis before redrawing
an axis.