Skip to main content

Example: Modbus

Product: CODESYS Modbus

The examples show how to use the ModbusFB.compiled-library Modbus function block library to create Modbus TCP/Serial servers and clients.

Description

The examples are based on the ModbusFB.compiled-library and ModbusFB non standard extensions.compiled-library libraries. The ModbusFB.compiled-library library is included in the CODESYS Modbus product. The ModbusFB non standard extensions.compiled-library library is included in the sample package.

ModbusFB_examples.project shows how to use the ModbusFB.compiled-library to create standard Modbus TCP/Serial servers and clients.

ModbusFB_non_standard_extensions_examples.project shows how to use of the ModbusFB non standard extensions.compiled-library to create Modbus TCP/Serial servers and clients with an extended "data model" (wide registers >=16bit), which is not covered by the Modbus standard, but is used in real Modbus devices.

Additional information

ModbusFB_examples.project includes three applications on separate PLCs:

  • Example_BasicOverview gives you an overview of the available function blocks and how to use and combine them in ST / CFC

  • Example_Serial shows how to create serial Modbus servers and clients

  • ExampleTCP shows how to create Modbus TCP servers and clients

System requirements and restrictions

Programming system

CODESYS Development System (version 3.5.16.0 or higher)

Runtime system

CODESYS Control Win (version 3.5.16.0)

Add-on components

The serial examples use two serial ports on the PLC so that you have to connect them.

With a CODESYS Control Win, you can use the virtual serial port driver.

Note

_example_icon.png DOWNLOAD Project