readDiscretes | Top

readDiscretes read Modbus Server discrete input registers values (Hardware: Modbus dual Masters Adaptor from Dafulai Electronic Inc ) Since R2019b Library: Modbus Client ( Dafulai Electronics) /readDiscretes Description This block reads discrete input registers values. Start Address is from Input port "StartAddr" (1-based address without 1x 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 "discrete input Data QTY" scalar? The reason is for "Embedded Code generator", in this way, embedded code will know variable 's discrete input 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: 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 discrete input registers" command to.
Ports Input
• | StartAddr — "double" data type's scalar. It is discrete input Regs start address (1 based without 1X prefix) you want to read.
• | Data Var — "logical" data type's vector. The dimension of vector is discrete input 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.