readCoils

Top 

readCoils


read Modbus Server coil registers values (Hardware: Modbus dual Masters Adaptor from Dafulai Electronic Inc )

Since R2019b

 

Library: Modbus Client ( Dafulai Electronics) /readCoils

 

readCoils

 

 


 

Description


 

This block reads coil registers values. Start Address is from Input port "StartAddr" (1-based address without 0x prefix), Read Quantities are equal to the dimension of Input port "Data Var" . Why do we use the dimension of Input port "Data Var" instead of "coil  Data QTY" scalar?  The reason is for "Embedded Code generator", in this way, embedded code will know variable 's coil  register address easily.

 

 

If any error (CRC, Timeout, Not supported FC, address range,....) occurs,  Outport "Data" will keep previous value, and Outport "Success" will be false.

 

Parameters


 

Please double click this block to open parameters dialog below:

 

readCoils_Param

 

 

Let us explain parameters.

 

 

Object ID for multiple masters — In one PC, we may use multiple "Modbus dual masters adaptor" hardware, this is for identifying each one.

 

Modbus Server ID or node address —  The address of the server to send this "read coil registers" command to.

 

 

Ports


 

Input

 


 

StartAddr — "double" data type's scalar. It is coil  Regs start address (1 based without 0X prefix) you want to read.

 

Data Var — "logical" data type's vector.  The dimension of vector is coil  Regs QTY you want to read.

 

 

Outport


 

Success — "logical" data type's scalar. true means read out successfully. false means that failure in reading out data.

 

Data — "logical" data type's vector. It is all Data you read out. If  we didn't read out any data, the output port Data will keep previous values. Initial value is false vector.