Modbus 2 Driver

The Modbus 2 driver is available in form of a Fbox library for S-Fup. It supports Master and Slave functions with all communication modes: RTU, ASCII, TCP and UDP. The Slave function allows master devices to read and write all Inputs, Flags, Registers and Counters in the PCD. The Master function allows you to read and write Binary, Integer 16 and 32 bits as well as Float values from slave devices. The library is delivered with an installation program and includes its description in a Windows help file.

Supported functions as Slave and interpretation.

Function 1
Function 2
Function 3
Function 4
Function 7
Function 8
Function 20
Function 5
Function 6
Function 15
Function 16
Function 21
Function 23

Reading flags
Reading inputs/outputs
Reading registers
Reading timers/counters
Reading Status Flag (Flag 0 to 7)
(Diagnostics) On request
(Reading data blocs) On request
Writing one flag
Writing one register
Writing flags
Writing registers
(Writing data blocs) On request
Writing+Reading registers in one transaction

Supported functions as Master.

Function 1
Function 2
Function 3
Function 4
Function 7
Function 8
Function 20
Function 5
Function 6
Function 15
Function 16
Function 21
Function 23

Reading binary
Reading inputs/outputs
Reading registers
Reading input registers
Reading Status Flag (Flag 0 to 7)
(Diagnostics) On request
(Reading data blocs) On request
Writing one bit
Writing one register
Writing bits
Writing registers
(Writing data blocs) On request
(Writing+Reading registers) On request

Check that the required functions are supported. Contact Engiby if further functions are desired.

You can read more details about the driver in the help file of the library. Click here to downloading the help file. Unzip the file on your PC and open the Modbus2.hlp file.

Test version
For test purpose, the Modbus TCP Driver is available on request. The library will includes all described functionalities but a time limited password is delivered. We would be glad to have also a feedback of the result of your test with this package like tested devices, problem found and general conclusion. Thanks in advance.

Project example
For a first test and a good start, you can download a project example:
For PG5 1.4
For PG5 2.0
For PG5 2.1
Use the 'Project-Restore…' command in PG5 to restore it.
Choose the CPU corresponding to your application (Master or Slave, RS or TCP). To adapt it to your CPU type, proceed as follow:
- Adjust the Online setting
- Go to the Hardware settings
- Upload the settings
- For Modbus TCP check the IP settings
- For RS ensure that the port in NOT configured as S-Bus PGU
- Download the settings if you made a change
- Go to the Software settings
- Set all to default
- Then, adapt the Modbus driver parameters in the Fboxes (Serial channel, speed, IP-address, Modbus station, etc…) according to your device.
- Build, download and run the CPU.
For a PCD slave, the master should be able to read and write flags and registers.
For a PCD master, open the Send and Receive Fbox and click the buttons to execute single requests or set the enable inputs for permanent communication.
Please read also the help of each Fbox for more details.

Starting up
The best test to do when you startup working with the Modbus Driver is to build a Master-Slave connection using 2 PCD's. You will avoid problem of different terminology and connection pin-out. Connect RS485 terminals in parallel or RS232 terminals crossed over (Tx<->Rx). Use the demo project above. Check the serial lines or TCP channel settings in the Master and Slave Fboxes, build, load and start the programs. It must work.
When you then connect another system, you must adapt yourself to its terminology, check all communication parameters and prepare a suitable connection.

Trouble shooting
If you are using a serial connection, please read this document: www.engiby.ch/modbus/modtrb.htm.
For trouble with TCP or UDP connection please read this document: www.engiby.ch/modbus/tcptrb.htm.

System and Firmware version
As well, the PCD1, 2, 4 and 6 with PCD7.F65x module as the PCD3 systems with embedded Ethernet are supported. For PCD3 ensure you have a suitable firmware version:
FW 1.10.42 or higher for HW A to C.
FW 1.14.02 or higher for HW D or higher.
Please contact SAIA for the best Firmware for your system.

Modbus version : RTU, ASCII and J-Bus
The Modbus 2 driver supports both the Modbus RTU and ASCII on RSxxx lines.
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 an 8 data bits transmission.
Modbus plus cannot be supported. This version need special hardware and can only be connected via a gateway.

Modbus/TCP or UDP
The Modbus protocol over IP originally specified by Schneider uses the TCP protocol. Almost all implementations of Modbus over IP use actually TCP. Although, small data exchange as used by Modbus are faster with UDP packages. Some manufacturers have chosen to implement the UDP/IP as alternative. With our driver you can choose between TCP and UDP. For a PCD Slave, you can even activate both TCP and UDP. With this option you don’t care on which mode the master uses or you can even accept a mix up of Masters using TCP and UDP on the same system. Remember that UDP communication is much simpler and more efficient than TCP. Therefore, you will have much less trouble by using UDP.

Several TCP channels
A PCD Slave can support more than one TCP/UDP connection simultaneously. The maximum number of channels is given by the PCD type. See the PCD manual for this information. When using UDP, the number of connected Master is not limited.
Up to 10 PCD Master TCP/UDP functions can be used in the same application.
For each Master function, only one TCP connection is open by the Driver. When several slaves are polled, the TCP connection is closed and re-open for each successive slave (not for each successive request). This might be considered as inefficient in some cases. To improve it you have the possibility to place one Driver per slave (up to 10). In this case, each driver will have its own channel and will not need to open-close the TCP connection cyclically.

Multi-protocol over the same IP-Module
The S-Bus protocol can be activated and used at the same time as Modbus on the PCD. The S-Bus protocol is handled by the firmware in parallel with the Modbus Driver. The driver can also share the IP-module with other drivers as long as all respect the principle of 'Shared ODM'. Please contact Saia or Engiby in case of questions.

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.

Value formats

Basically the Modbus protocol supports 16 bits values. The PCD has 32 bits registers in integer and floating point formats. Therefore, special options have been implemented in order to exchange 32 bits integer and float values. The implemented method is similar to the most PLCs and slave devices on the market. It means 2 16 bit registers are used to transfer one 32 bit value.
Depending on the manufacturer, various terms are used to specify the word order for 32 bits values.
Fbox option: Big Endian = LSW-MSW = Intel, e.g. used by Modicon
Fbox option: MSW-LSW = Little Endian = Motorola, e.g. specified by IEEE

PCD as Slave : Without special care, 16 bits values are converted into 32 bits signed values when received in the PCD. To be able to exchange 32bit values, you must
a)select the suitable option (Little/Big endian) in the Slave Application Fbox
b) define an address offset for 32 bit integer and one for float values
c) the master must apply this offset to the register base address when reading or writing 32 bit values.

PCD as Master : Without special care, PCD 32 bit values are truncated to 16 bits. This means that the values must be limited in range from -32'536 to +32'535. To be able to exchange 32 bit values, you must
a) select the suitable option (Little/Big endian) in the Driver Fbox
b) use the suitable conversion option in RCV Fbox.
To exchange float values, use the Float Fbox (you will receive float values in PCD format) or use the Integer RCV Fbox and select the conversion option 'Float*10->Int 32'.

Last modifications of the driver

Here you can find the list of the last modifications of the Modbus 2 driver.

Prices of licenses and update

The driver is delivered with a license valid for PG5 version 1.4, 2.0 and 2.1. The number of realized applications is not limited.
The old license for Modbus 1 package, version 1.0x, to 1.7x, cannot anymore be upgraded to Modbus 2.
If you have such a version, you must buy a new Modbus 2 license.

Existing Modbus 1 application on PG5 2.0
The Modbus 1 driver is now obsolete. If you start a new application with Modbus use the Modbus 2 package.
For upward compatibility of existing applications on PG5 2.x, you can install a Modbus 1 package as extension to Modbus 2 and keep your applications unchanged.
Proceed as follow:
- Order, download and install an upgrade of Modbus 2 package for PG5 2.0.
- Download and install this Modbus 1 package on PG5 2.x (no key is required)
            www.engiby.ch/modbus/modbus183.exe
- Import your application in PG5 2.x
- Build your application as usual under PG5 2.x
The same principle is also backward applicable on PG5 1.4 but only if you have also installed Modbus 2 on this PG5 !

Further useful information about Modbus
If you search for more information about the various Modbus protocol visit the Modbus organization sites at www.modbus.org and www.Modbus-IDA.org.

When you will build up your first Modbus installation, you may wish to test the Modbus driver in the PCD first. You can find very useful test software, called ModScan32, for little money by WinTech at www.win-tech.com. Further tools are available from the Modbus sites indexed above.

Planed features and actual state:

  • Multi Master, Multi Slave for several RSxxx lines

Available

  • Multi Master, Multi Slave for TCP or UDP channels

Available

  • Support of 2 IP-Modules on PCD2.M480

Available

  • Adjustable baudrate and Bits setting in runtime

Available

  • Multicast function

Available for Master

  • Read+Auto Send on change mechanism

Available

  • Support of high baudrates 57,6 and 115,2 kbds

Available

  • Supports of extended ranges.
    Registers up to 16383
    Flag up to 16383 (with option 16 bit addressing)

Available

  • Support of extended flag range 8192 to 14335

Available

  • FB calls for IL programming

Available

  • Engiby configurator (Excel and OpenOffice files)

On Request

  • Virtual Slave with up to 16k registers in DBs

Available

  • S-Bus Master Gateway

Available

  • Modbus-Modbus Gateway

On Request

  • Implementation of particular application or gateway

On request

 

Back to Engiby main page

Engiby / 22.03.2013