Documentation search search close
CONTENTS
https://www.speedgoat.com/help/slrt/page/icon_documentation.jpg
v10.0.1.x for R2026a
View other versions

Modbus - Server Write

Modbus - Server Write — Writes data to local Modbus data tables

Library

Simulink Real-Time - Speedgoat

Description

This block is used to write data to the local Modbus data tables such as coils and registers. Your model can contain multiple Modbus TCP Server Write blocks for each Modbus server in your target machine.

Ports

Inputs
Input

Array of length Quantity that is written to the given Data Table for the data range specified by the Index and Quantity parameters. The data type depends on the selected data table.

  • For Coils and Discrete Inputs, the input port is a vector of the BOOLEAN data type where the length of the vector is defined by the Quantity parameter. Each BOOLEAN element of the vector represents one bit.

  • For Holding Registers and Input Registers, the input port is a vector of the UINT16 data type where the length of the vector is defined by the Quantity parameter. Each UINT16 element of the vector represents one word/register.

Use Byte Pack blocks to convert to signed values or floating-point numbers. You can pack one double value to a vector of type uint16 and length 4.

Outputs

This block does not have any output ports.

Parameters

Server Station ID

Apply the Server Station ID of the corresponding Setup block. Must range between 0 and 65535.

Unit ID

Apply one of the Unit IDs which were defined in the Setup block. You can assign multiple Read blocks to the same Modbus unit. Must range between 0 and 255.

Data Table

Select the Modbus data table you want to write data to. The options are:

  • Coils

  • Discrete Inputs

  • Holding Registers

  • Input Registers

Data Index

The first index of the data range you want to write. Must range between 0 and 65535.

  • For Coils and Discrete Inputs, the parameter defines the start bit.

  • For Holding Registers and Input Registers, the value defines the start word.

Data Quantity

The length of the data range you want to write. Index + Quantity must not exceed 65536.

Sample Time

Defines the base sample time at which this driver block gets its sample hit. This parameter can also be set to -1 for inherited sample time. The units are in seconds.