emModbusMasterRead | Top Next

emModbusMasterRead embedded Modbus Master reading registers Since R2019b Library: embeddedCreatorLib ( Dafulai Electronics) / Embedded Modbus Master / emModbusMasterRead Description This block sends reading register command to a modbus server. You can only send command when modbus master "idle". So input port "En" must connect block "isMB_Idle" output port. Parameters Please double click this block to open parameters dialog below: Let us explain parameters.
• | Server ID — Scalar. It is Modbus server ID or called Server address. Modbus master will read to device with this Server ID. Value range is 1 to 247.
• | Command Seq No — drop list from 1 to 16 which is sequence Number in tab "Read Command Seqs" of block "emModbusMasterSetup". The big sequence number has low writing priority. All reading commands have lower priority than writing commands.
• | Read Operation type — It is selected automatically from block "emModbusMasterSetup" according to "Command Seq No". If you want to change it, please modify in block "emModbusMasterSetup". It can be one of "Read-InputsReg"/"Read-Holdings"/"Read-Discretes"/"Read-Coils".
• | Data Output Type — drop list for output port data type. It can be one of "Logical boolean"/"Unsigned 16 bits int"/"Signed 16 bits int"/"Unsigned 32 bits int"/"Signed 32 bits int "/"32 bits float"
• | Data Output Vector Length — Output port "Data" vector length.
• | Word-Endian when multiple Words — drop list from "Big-endian" and "Little-endian". When read data type is dual words, it tell us word's endian.
Ports Input
• | En — "logical" data type's scalar. Only when it is true will this block executes reading function. So "En" generally connects output port of block "isMB_Idle" in order to make sure reading only when Modbus master is in "Idle" state.
• | StartAddr — "uint16" data type's scalar. It is Modbus Server registers' start address (1-based without prefix "4X","3X", "1X", "0X"). It must be from Constant block or from "emProbe" output because both PC side and embedded side must know its value.
Outport
• | Done — "logical" data type's scalar. It denotes whether communication between PC and Target has finished. "Done" does not mean success. It may success or fail.
• | Success — "logical" data type's scalar. It denotes whether reading success.
• | Data — Scalar or Vector. Data type is set in parameter "Data Output Type" . Vector length is set in parameter "Data Output Vector Length"
Examples