Subject to change without notification.
This document responds to the frequently asked questions concerning the Engiby Modbus 1 Driver (versions 1.xx).
Attention : The Modbus 1 library is acually obsolete and replaced by a Modbus 2 package.
For more info, go to Modbus 2 Driver and Comparison Modbus 1 - Modbus 2 - Modbus Saia.
This page is still available for existing application using Modbus 1.
Further useful information about Modbus
If you are looking for more information about the various Modbus protocol visit the Modbus organization sites at http://www.modbus.org.
When you will build up your first Modbus installation, you may whish to test the Modbus driver in the PCD first. You can find very useful test software, called ModScan32, for little money by Wintech at http://www.win-tech.com. Further tools are available from the Modbus sites indexed above.
PG4 and PG5 licenses
PG3, PG4 version 1.4 and PG4 version 1.0.80:
These tools are not anymore supported with the versions 1.5x, and the following. IL programs from PG3 and PG4 are not anymore supported with these versions. We recommend updating all old tools to PG5 1.4. Contact Engiby if one of these old programming tools must be used.
Modbus drivers 1.4x:
These versions was designed and licensed for the PG4 Tool and can be used with the version 2.0.2xx of PG4. You need an update to use the Modbus driver on PG5.
Modbus driver 1.50 and 1.51:
These versions were an intermediate step for PG5 versions 1.0.xxx. You should not use it anymore and update it to the latest 1.7x version.
Modbus driver from 1.52 on:
These versions can be used in PG4 versions 2.0.2xx as well as PG5 versions 1.0.xxx and 1.1.xxx.
Modbus driver from 1.60 on:
These versions can be used in PG5 versions 1.0, 1.1, 1.2 and 1.3 but not anymore on PG4. Once you have updated your PG4 to PG5 and installed the Modbus driver version 1.6x you can move your Fupla programs into a PG5 project and continue to use it. Refer to the SAIA's instructions to import PG4 projects into PG5.
For IL programs in PG5 and old programs imported from PG3 or PG4, you need to adapt the source file according to the new examples. You also need a Modbus driver version 1.55 at least. See below.
Modbus driver 1.7x:
These versions can be used in PG5 versions 1.2, 1.3, and 1.4.
Modbus driver 1.8x:
These versions can be used in PG5 versions 2.0. In this case a Modbus 2 package must first be installed. Modbus 1.8x will use the same license key as Modbus 2.
Trouble shooting
This document may help you for trouble shooting of the Modbus 1 Driver: Modbus Trouble shooting
Programming tool and programming languages
Fupla and IL programs can be realized. However, the user's manual is mainly based on the Fupla FBoxes. Remember that the best comfort is reached when using Fupla. You need at least the following Modbus driver versions for IL programs:
PG5 1.0 and 1.1 |
don't use it anymore |
PG5 1.2 and 1.3 |
Modbus driver version 1.55 |
PG5 1.4 |
Modbus driver version 1.73 |
PG5 2.0 |
Modbus driver version 1.80 |
PG5 2.1 |
Modbus driver version 1.84 |
An example of IL programs for Master and Slave can be downloaded here (modbusil.zip). The project is made for PG5 1.2 and can also be used in PG5 1.3 and 1.4. After the download, use the File-Restore command in PG5 to add the example in your projects.
Protocol version
The two modes of Modbus are supported by the Driver: the ASCII and RTU modes. J-Bus is another name for Modbus and is fully compatible with Modbus ASCII or RTU. Note that the RTU is two times more efficient as the ASCII. RTU needs a 8 data bits transmission.
Modbus-TCP (or UDP) is supported by the new Modbus 2 Driver.
Modbus plus cannot be supported. This version need special hardware and can only be connected via a gateway.
Master / Slave
The Driver supports both, Master and Slave functions. However it is important to know if the PCD will be master or slave. Only the Master can (must) initiate Write and Read requests. Therefore a slave cannot directly communicate to another device on the network.
Support of several line with Modbus driver in the same PCD
The Master and Slave Driver FBoxes are made to support one serial line only. If multiple lines are to be used in Master and/or in Slave, a new file must be created in the same project for each serial line. For the lines in Master mode, the reception and transmission Fboxes have to be programmed in the file corresponding to the serial line being used. The fact that multiple lines are used with the same PCD must be taken into account for evaluating the admissible load on the CPU. The reaction time will also be longer.
Supported functions as Master
Function 1 |
Receive Binary |
Check that the required functions are supported. Contact Engiby if further functions are desired.
Supported functions as Slave and interpretation
Function 1 |
Reading flags |
Check that the required functions are supported. Contact Engiby if further functions are desired.
Hardware connection
RS232
RS422 can be used for point to point (one master, one slave only) connection without restriction. Remember that the maximum cable length is 15m. Tx and Rx wires must be crossed over. Hardware handshake is not needed for the driver. The CTS and the DTR outputs are set to High and can be used if required by the partner device.
RS485
RS485 must be used for multi-drop connections (one master, several slaves). The RS485 bus must be installed respecting the recommendation standing for an S-Bus network. See the SAIA S-Bus manual. The 2 Tx/Rx+ and Tx/Rx- wires must all be strain connected (not crossed over). Terminals can also be marked A and B. In this case B is the Tx/Rx- wire and A is the Tx/Rx+.
External converters (RS232<->RS485) from SAIA cannot be used. Only converters with automatic switching can be used.
RS422
RS422 can be used for longer point to point connections (one master and one slave only) without restriction. The cable length can be up to 1000m. In a multi-drop topology, RS422 can only be used if the PCD is Master. The Tx+ and Tx- wires must be strait connected while the Tx+Tx- pare must be crossed with Rx+Rx- pare.
Using the PGU port
The PGU port is the port 0 on PCD 1, 2, 3 and 4. It is the port 4 on PCD6.M3.
Since version 1.56, the option 'Channel 0 PGU' is available for PCD1, 2, 3 and 4. With this option, the Modbus driver is automatically restarted when the PGU cable is unplugged.
On PCD3, you can check the option 'Full RS232 handshaking on Port 0' in the hardware configuration and use the port 0 without restriction (with the normal option 'Channel 0').
For former versions and other PCD systems the PGU port can be used with the following restrictions: the line must not be configured for S-Bus PGU. No PGU cable must be plugged in when the PCD starts. If a PGU cable is connected, the driver is disabled and the line is forced in PGU mode. This may cause error at the Modbus Driver Fbox. To re-enable the Modbus driver, the PCD must be restarted after disconnecting the PGU cable.
Port 10 as port 3 on PCD3.M5xxx
The PCD3.M5xxx systems have two D-Sub connectors on the left side. The right side connector is equipped as RS485 port. It can be configured for Profibus communication as port 10. If not configured, this port can be used for Modbus (or other protocols) communication but as port 3, in this case.
Firmware version
To determine if an old CPU will support the Modbus driver, you have to check the following:
The FW must support the SYSRD and the SYSCMP instructions for the so called 'free running counter'. If you have a Modbus version 1.41 or higher and you exchange Floating point values, it must also support the SYSWR K 7000 instruction. The table of CPU and firmware related to each instruction is delivered by SAIA.
Value format
Basically the Modbus protocol supports 16 bits values only. The PCD has 32 bits registers. 16 bits values are converted to 32 bits signed values when received in the PCD.
Integer 32 bit values
Using double word combination, 32 bits integer values can be exchanged. This is supported since version 1.43 of the driver. The position of the higher and the lower word in the telegrams must be checked and adjusted in the driver Fbox. Then in the RCV Fboxes select the format 32->32.
Floating point values
Floating point values (32 bits) can also be exchanged using double word combination. The position of the higher and the lower word in the telegrams must be checked and adjusted in the driver Fbox. You must use the Float Fbox to read floating point values.
Depending on the manufacturer, various terms are used to specify the word order for 32 bits values.
Fbox option: Modicon = LSW-MSW = Big Endian = Intel
Fbox option: IEEE = MSW-LSW = Little Endian = Motorola
Addressing
For a PCD Master, the address of the available values in the Slaves must be known. In the SEND and RCV Fbox, addresses are given in integer format. Convert Hex format to integer if necessary.
For a PCD Slave, all resources are available by the Master. Be sure the Master doesn't access the dynamic allocated resources.
The standard Modicon notation uses the '4x' and the '3x' reference. The 4x reference concerns the Holding registers while the 3x reference stands for the Input registers (Timers and counters in PCD). The addresses are then given in form 40'001 or 30'123 which means Holding register 1 and Input registers 123. Don't mix it up with the function code. Reading the 4x reference is made with function 3 while 3x references are read with the function 4.
The Modicon implementation supports address ranges starting from 1 (instead of 0). In this case the offset of one element can be corrected by the driver by selecting the corresponding option.
Difficulties can appear with Supervisors using the addressing scheme of Modicon devices with 32 bits values. Modicon uses two 16 bits registers for one 32 bits value. Therefore each second register address is skipped. The SAIA-PCD has 32 bits registers and by default, all registers are used (no skip). Since driver version 1.46, this particular addressing (Skip each 2nd register) can be set in the Slave driver.
Performance
The performances of the driver depend on the transmission speed and the reaction time of the CPU.
The reaction time of the CPU is affected by:
- The number of values asked or sent in each MODBUS requests: fewer values = faster response.
- Other applications: each application extends the cycle and the reaction time.
- The other serial connections: Each active serial line will reduce the performance.
- The protocol version: The performance is reduced by half with the ASCII protocol.
Load on the CPU
The maximum load on the CPU is reached during data reception and depends on the amount of transferred values. The following measurements have been made with the Driver version 1.43.
Conditions:
- System PCD2.M120 with Firmware 007
- Protocol RTU, 9600 Bauds
- Serial line 1, PGU active on line 0
- No other program in the PCD
- The Master is a PCD with the same Modbus driver
- No other system on the bus (pear to pear)
- Telegrams: Master reading (RCV) 16 bits integer values from the Slave
Maximum cycle time measured on the Slave:
|
232 ms |
|
123 ms |
|
69 ms |
|
42 ms |
|
29 ms |
When the Master is writing (SEND) values into the Slave, the load is about the half of the above values.
Critical speed
In an uniform and balanced topology (means similar systems on the bus) the request-response principle will ensure a correct synchronization of all slaves. Critical situation and synchronization problem can occur in extreme circumstances. Mixing PCD Slaves with other very fast devices should be avoided. Fast broadcasting is also a critical practice. In case of problems, the polling loop must be balanced between devices, the speed must be reduced or the telegrams size must be reduced.
Timing problem can occur on systems with a Web application. In this case, reduce the CPU time allocated to the Web-Server to the minimum. If possible use the option: Firmware generation = With CSF.
The CPU load of the driver may also be adjusted through an option in the Fbox MBUS-Mst and MBUS-Slv. The CPU power used by the driver can be increase but will slow down the other applications. Note that communication task fully supported by the firmware have higher priority: PGU port, S-Bus protocol, Profibus or LON module.
Public Line Modem
Connection over public line modem is supported by Master and Slave since version 1.42. The SAIA Modem library, version $ 2.1.253 or higher must be used.
Leased Line Modem
Leased line modem is possible. However test and adjustment with each device may be needed. Please contact Engiby.
Gateway
Modbus Slave to S-Bus Master gateway is available with the new Modbus 2 Driver.
Prices of licenses and update : Modbus main page