writeCoils

Top 

writeCoils


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

Since R2019b

 

Library: Modbus Client ( Dafulai Electronics) /writeCoils

 

writeCoils

 

 


 

Description


 

This block writes coil registers. Start Address is from Input port "StartAddr" (1-based address without 0x prefix), Read Quantities are equal to the dimension of Input port "DataIn" .

 

 

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

Otherwise, write successfully, Out port "DataOut" will be input port "DataIn", and Out port "Success" will be true.

 

 

Parameters


 

Please double click this block to open parameters dialog below:

 

writeCoilRegs_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 "write coil registers" command to.

 

Force to use single Write (FC=05) —  true means that we we will use multiple single writings (FC=05) to replace one multiple writing (FC=15).

 

 

Ports


 

Input

 


 

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

 

DataIn — "logical" data type's vector.  It is data values you want to write.

 

 

Outport


 

Success — "logical" data type's scalar. true means write successfully. false means that failure in writing.

 

DataOut — "logical" data type's vector. It is input port "DataIn" values when write successfully.  The output port "DataOut" will keep previous values if fail in writing. Initial value is false vector.