Multi-Register Write Command
A multi-register write command is a UIS command made up of one or more command components that writes to a set of registers (i.e., data group elements) in one or more data groups. It applies to most Modbus data groups with write functionality. Each data group included in such a command must conform to one or the other of the procedures described below. This command is not the same thing as a single-element data group, which enables you to specify one and only one register to read from and write to.
There are two methods to configure a multi-register write command:
- Accept the command component default parameters and write to all of a data group's registers.
- Override the command component default parameters and write to a subset of a data group's registers.
The two methods for creating multi-register write commands may be used in different command components to make up a single UIS command.
See the following subsections for more information:
- Accepting the Command Component Default Parameters
- To Configure a Multi-Register Write Command Using Defaults
- Overriding the Command Component Default Parameters
- To Configure a Multi-Register Write Command Using uccSendParms
For more information, see UIS Commands.
Accepting the Command Component Default Parameters
Note: In order for a data group to be available for inclusion in a command, the data group must be instantiated for the remote device, the data group's DataGroup element must define the attribute uccSend as "true", and the data group must include at least one properly defined modbusWriteBlocks element.
If you want to include all data group elements in a data group in a UIS command, follow the procedure below. You do not need to write values to each of the corresponding registers, but each is included in the command message.
Example
|
<Setup niceName="Setup" canSend="true" uccSend="true"> <dgElements byteOrder="bigEndian" secLev="4" type="i2"> <ABMode desc="AB Mode" regDef="1:1" hidden="true"/> <ABModeS desc="AB Mode" type="string" mapVal="EnableStates" ref="ABMode"/> <Murphy desc="Murphy Mode" regDef="1:2" hidden="true"/> <MurphyS desc="Murphy Mode" type="string" mapVal="EnableStates" ref="Murphy"/> <DiffMode desc="Differential Pressure Mode" regDef="1:3" hidden="true"/> <DiffModeS desc="Differential Pressure Mode" readOnly="true" type="string" mapVal="EnableStates" ref="DiffMode"/> <OnHiS desc="On High Side" regDef="1:4" hidden="true"/> <OnLoS desc="On Low Side" regDef="1:5" hidden="true"/> <OffHiS desc="Off High Side" regDef="1:6" hidden="true"/> <OffLoS desc="Off Low Side" regDef="1:7" hidden="true"/> <ThreeVlv desc="Three Valve Mode" regDef="1:8" hidden="true"/> <ThreeVlvS desc="Three Valve Mode" type="string" mapVal="EnableStates" ref="ThreeVlv"/> <ShrtCycle desc="Short Cycle Mode" regDef="1:9" hidden="true"/> <ShrtCycleS desc="Short Cycle Mode" type="string" mapVal="EnableStates" ref="ShrtCycle"/> <BattLowTm desc="Battery Low Time" regDef="2:00" type="i4"/> <MntPlngCnt desc="Maintenance Plunger Count" regDef="1:0"/> <BattVLim desc="Battery Voltage Limit" regDef="3:00" type="r4" units="volts"/> <SetPwd desc="Set Password" regDef="4:00"/> </dgElements> <modbusReadBlocks regByteLen="2"> <block1 regOff="-40001" regNum="40009" regCnt="10" funcCode="3"/> <block2 regOff="-40001" regNum="40091" regCnt="02" funcCode="3"/> <block3 regOff="-40001" regNum="40315" regCnt="02" funcCode="3"/> <block4 regOff="-40001" regNum="41001" regCnt="01" funcCode="3"/> </modbusReadBlocks> <modbusWriteBlocks regByteLen="2"> <block1 regOff="-40001" regNum="40009" regCnt="10" funcCode="16"/> <block2 regOff="-40001" regNum="40091" regCnt="02" funcCode="16"/> <block3 regOff="-40001" regNum="40315" regCnt="02" funcCode="16"/> <block4 regOff="-40001" regNum="41001" regCnt="01" funcCode="16"/> </modbusWriteBlocks> </Setup> |
The "Setup" data group command parameters as they appear on the UIS Commands editor:
|
UIS Commands Editor |
To Configure a Multi-Register Write Command Using Defaults
- Using CygNet Explorer, open the Device Definition Service (DDS).
- Double-click the remote device.
- Click the UIS Commands page and click Add.
- Fill out the UIS Command Info.
- In the UIS Command Components group box, click Add.
- At Component Type, select Send data group to device [DG_T_DEV].
- In the Data Group Information group box, click Choose Group. All available data groups with write capability appear in the Choose Data Group dialog box that opens. If you do not see the desired data group, it either does not have write capability or it has not yet been added to your device.
- Select the desired data group and click OK. All of the data group's parameters (i.e., data group elements or registers) appear by default in the Parameters field.
- Double-click a parameter and enter a new value. Repeat for each parameter you want to change on a field device.
- When you are done, click OK to save and exit.
Overriding the Command Component Default Parameters
Note: In order for a data group to be available for inclusion in a command, the data group must be instantiated for the remote device, the data group's DataGroup element must define the attribute uccSend as "true", and the data group must include at least one properly defined modbusWriteBlocks element.
If you want to write to a subset of data group element IDs in a data group in a UIS command, follow the procedure below. Each user-specified data group element ID is repackaged into its own message. Depending on your specific setup, this might be more or less efficient than just writing to all available registers.
Example
|
<Setup niceName="Setup" canSend="true" uccSend="true"> <dgElements byteOrder="bigEndian" secLev="4" type="i2"> <ABMode desc="AB Mode" regDef="1:1" hidden="true"/> <ABModeS desc="AB Mode" type="string" mapVal="EnableStates" ref="ABMode"/> <Murphy desc="Murphy Mode" regDef="1:2" hidden="true"/> <MurphyS desc="Murphy Mode" type="string" mapVal="EnableStates" ref="Murphy"/> <DiffMode desc="Differential Pressure Mode" regDef="1:3" hidden="true"/> <DiffModeS desc="Differential Pressure Mode" readOnly="true" type="string" mapVal="EnableStates" ref="DiffMode"/> <OnHiS desc="On High Side" regDef="1:4" hidden="true"/> <OnLoS desc="On Low Side" regDef="1:5" hidden="true"/> <OffHiS desc="Off High Side" regDef="1:6" hidden="true"/> <OffLoS desc="Off Low Side" regDef="1:7" hidden="true"/> <ThreeVlv desc="Three Valve Mode" regDef="1:8" hidden="true"/> <ThreeVlvS desc="Three Valve Mode" type="string" mapVal="EnableStates" ref="ThreeVlv"/> <ShrtCycle desc="Short Cycle Mode" regDef="1:9" hidden="true"/> <ShrtCycleS desc="Short Cycle Mode" type="string" mapVal="EnableStates" ref="ShrtCycle"/> <BattLowTm desc="Battery Low Time" regDef="2:00" type="i4"/> <MntPlngCnt desc="Maintenance Plunger Count" regDef="1:0"/> <BattVLim desc="Battery Voltage Limit" regDef="3:00" type="r4" units="volts"/> <SetPwd desc="Set Password" regDef="4:00"/> </dgElements> <modbusReadBlocks regByteLen="2"> <block1 regOff="-40001" regNum="40009" regCnt="10" funcCode="3"/> <block2 regOff="-40001" regNum="40091" regCnt="02" funcCode="3"/> <block3 regOff="-40001" regNum="40315" regCnt="02" funcCode="3"/> <block4 regOff="-40001" regNum="41001" regCnt="01" funcCode="3"/> </modbusReadBlocks> <modbusWriteBlocks regByteLen="2"> <block1 regOff="-40001" regNum="40009" regCnt="10" funcCode="16"/> <block2 regOff="-40001" regNum="40091" regCnt="02" funcCode="16"/> <block3 regOff="-40001" regNum="40315" regCnt="02" funcCode="16"/> <block4 regOff="-40001" regNum="41001" regCnt="01" funcCode="16"/> </modbusWriteBlocks> <uccSendParms> <PartialWrt desc="Partial Write" required="true" type="boolean"/> <BattVLim desc="Battery Voltage Limit" type="r4"/> </uccSendParms> </Setup> |
The "Setup" data group command parameters as they appear on the UIS Commands editor:
|
UIS Commands Editor |
To Configure a Multi-Register Write Command Using uccSendParms
- Open the Modbus template for which you want to add send parameters.
- Go to the data group(s) you want to modify and add a valid uccSendParms element.
- Add a SendParmName empty element called PartialWrt. Include desc, required, and type attributes along with relevant values in the PartialWrt element.
- Add a SendParmName empty element for each parameter (i.e., data group element or register) you want to send to a field device.
- Save your template changes and close the template.
- Validate and reload the template using the CygNet Device Template Manager utility.
- Perform steps 1 – 10 above for the affected data group(s), setting the PartialWrt value to Yes in the Edit Command Component dialog box. Note that instead of all of the data group parameters appearing by default in the Parameters field, only those you defined in the device template file appear.


