emModbusSlaveWriteCoils

Top  Next

emModbusSlaveWriteCoils


Embedded Modbus Server receives coil register writing value.

Since R2019b

 

Library: embeddedCreatorLib ( Dafulai Electronics) / Modbus Slave & Debugger / emModbusSlaveWriteCoils

 

 

emMBSlaveWriteCoils

 

 


 

Description


 

For embedded target side, this block will receive my Modbus server coil register writing value and embedded target gets data only from this block's Output Data. Block's input port Data is only for PC side to send coil register data value.

 

Notes: Any Port name with "Right Arrow" (à) symbol contains "built-in" probe. So in PC side, you can watch its value directly by "Display" block, you don't need add "Probe" block (our emProbe) before "Display" block. Of cause, you can still use "Mux"  block to collect all watching variables and then connect one "emProbe" which connects "Display" block.  In this way, you can decrease communication traffic.

Parameters


 

Please double click this block to open parameters dialog below:

 

emMBSlaveWriteCoils_param

 

 

 

 

Let us explain parameters.

 

 

Modbus Server ID or node address — tell system this block is for which Modbus Server node. You just choose from drop list which is from "emModbusSlaveDebugSetup" block.

 

Uart No (In case 2 or 2+ Uarts with the same Server ID) — It is Uart Number Modbus Server uses.  This is only used in one Server ID for more different Uarts. In this situation, you cannot connect these 2 or more nodes into one Modbus network because node Sever ID must be unique in one Modbus network.

 

Use Single Coil Reg writing — It will use FC=05 (Single writing coil reg) to replace FC=15 (Multiple writing coil registers).

 

Sample time in sec (-1 for inherited): — Sample time for this block. It is the same meaning as general Simulink block .

 

 

Ports


 

Input

 

StartAddr — "uint16" data type's scalar. It is Modbus Server coil registers' start address (1-based without prefix "0X"). It must be from Constant block or from  "emProbe" output because both PC side and embedded side must know its value.

 

 

Data — "logical" Scalar or Vector. We only care the size of vector in embedded target. It decides how many items will be written. And the value of  this input port will be written to target coil registers from PC Debug/monitor.

 

Outport


 

Ok — "logical" data type's scalar. In PC side, it denotes whether communication between PC and Target is OK. In embedded target side, it denotes whether coil register range you read is valid.

 

Data —"logical" Scalar or Vector.   It is from coil register values written.

 

 

Examples