readMyCoils | Top

readMyCoils read Modbus Server Coils register value Since R2019b Library: Modbus Server ( Dafulai Electronics) /readMyCoils Description This block reads Coils register values. Start Address is from Input port "StartAddr" (1-based address without 0X prefix), Read Quantities are from Input port "RegQTY". Those Coils register values are controlled by "Outside Modbus Master", Simulator cannot control these values. If any error (CRC, Timeout, Not supported FC, address range,....) occurs, Outport "Data" will return "Empty" Parameters Please double click this block to open parameters dialog below: Let us explain parameters.
• | Object ID for multiple Modbus slave Simulator Hardware — In one PC, we may use multiple Modbus slave simulators, this is for identifying each one.
• | Which device? (Only for RTU/ASCii) — This is useful for Modbus RTU/ASCii useful. it denotes which device we read from. For Modbus TCP Server, just ignore it.
Ports Input
• | StartAddr — "double" data type's scalar. It is Coil Regs start address (1 based without 0X prefix) you want to read.
• | RegQTY — "double" data type's scalar. It is coil Regs QTY you want to read
Outport
• | 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 become empty
Examples Example: Every 800ms (Wait 0.8 sec block), We are reading coil registers address from 1 to 8 of Modbus TCP Server. Please open "your Modbus Server library folder"/examples/example2_readCoils.slx (You must change USB serial Port number in Modbus Server Setup block according to your physical USB port number). For "Modbus Server Setup" block, the parameters are set up below: For "Read my Coils address 1 to 8 " block, the parameters are set up below: You can run general Modbus master software such as Modbus Poll or ModScan32 to change coil registers values addressing 1 to 8, you will see its result in Simulink Display block.