Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To send and receive data on Master side we need to use 2 channels:

...

  • TO RECEIVE DATA - Read Input Registers (Function Code

...

  • 04)

...

  • TO SEND DATA - Write Multiple Registers (Function Code

...

  • 16)

Step 1. Modbus Slave Channel - Add channel - FC

...

04 - Length 10

To send get or write read data we need to use channel 0 with access type Write Multiple Read Input Registers (Function Code 1604).

Since we have decided to use approximately 8 variables, the length will be set to 10 (this value can be changed).

Image RemovedImage Added

Step 2. Modbus Slave Channel - Add channel - FC

...

16 - Length 10

To receive sent or read write data we need to use channel 1 with access type Read Holding Write Multiple Registers (Function Code 0316).

Since we have decided to use approximately 8 variables, the length will be set to 10 (this value can be changed).

NB! We need to change Offset from 0011, because of values from 0 to 10 are allready assigned to Channel 0. 

Image Removed

...

Image Added

NB!

As a result:
Image Added

Step3. ModbusTCP Slave I/O Mapping

...

- Enabled 2 (always in bus cycle task)

Image Added

Step4. In this step we need to define our variables.

NB! The register 0 we have for BOOL variables. 

En example for Reading registers - INPUT

Image Added

En example for Writing registers - OUTPUT

Image Added


Now we need to map the server/slave side

Sending and receiving of data on the Server/Slave side