|
readMyHoldings |
Top |
|
readMyHoldings read Modbus Server Read-write Holding register value Since R2019b
Library: Modbus Server ( Dafulai Electronics) /readMyHoldings
Description
This block reads Read-Write Holding register value. Start Address is from Input port "StartAddr" (1-based address without 4x prefix), Read Quantities are from Input port "QTY in Spec DT". However this Quantities is in unit of Destination Data type. For example, if Destination Data type is "uint32", and Input port "QTY in Spec DT" is 5. Actually the words Quantities will be 5 x 2 =10. (From "StartAddr" to "StartAddr"+9)
Those Read-Write Holding register values are controlled by "Outside Modbus Master", Simulator cannot control these values except Read-Write watchdog and watchdog type=1 or 2
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.
Ports
Input
Outport
Examples
Example:
Every 500ms (Wait 0.5 sec block), We are reading read-write holding registers address from 1 to 3 of Modbus RTU Server Device1.
Please open "your Modbus Server library folder"/examples/example1_readHolding.slx (You must change USB serial Port number in CAN_setup block according to your physical USB port number).
For "Modbus Server Setup" block, the parameters are set up below:
For "Read Holding 1 to 3 " block, the parameters are set up below:
You can run general Modbus master software such as Modbus Poll or ModScan32 to change Holding registers values addressing 1 to 3, you will see its result in Simulink Display block.
|