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 Read

Modbus - Server Read — Reads data from local Modbus data tables

Library

Simulink Real-Time - Speedgoat

Description

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

Ports

Inputs

This block does not have any input ports.

Outputs
Output

Array of length Quantity that includes the values read from 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 output 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 output 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 Unpack blocks to convert to signed values or floating-point numbers. You can unpack a vector of type uint16 and length 4 to one double value.

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 read data from. The options are:

  • Coils

  • Discrete Inputs

  • Holding Registers

  • Input Registers

Data Index

The first index of the data range you want to read. 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 read. 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.