beautypg.com

B&B Electronics MODSCAN32 - Manual User Manual

Page 80

background image

80

Block Writes

The following property and method determine how modbus data is written to the slave device(s).

EnableBlockWrites

This boolean property determines how modbus data is written to the slave
device attached to the control. If this property is FALSE, the control will
attempt to write data to the slave device whenever the controlling application
modifies an array value using Coil(), Register(), Float(), or WSFloat(). Since
writing data to a slave device requires a significant amount of time, the user
may wish to inhibit data writes until the controlling application has updated
several data points, thereby writing multiple values to the slave using a single
modbus message.

If the EnableBlockWrites is TRUE, data will only be transmitted to the slave
using the WriteBlock() method. This allows the controlling application to
update several array points, (via a logic loop), without generating a high
volume of serial traffic to the modbus device. After setting the points to the
desired values, the WriteBlock() method may be used to transmit the data
using a single message, (i.e. 15—Force Multiple Coils or 16—Preset Multiple
Registers).

If the control is configured to perform block updates, care must be taken to
insure that the values contained in the data array is not updated by a read
operation, (Update()), between the time the controlling application makes
modifications and issues the WriteBlock() method. If this happens, the data
may be corrupted and the changes lost. The controlling logic should block
Update() operations while making modifications to the data using
WriteBlock()..

WriteBlock()

This method is used to write the current data values contained in the data array
to the modbus slave device. Data is written using the modbus message types
15, (Force Multiple Coils), or 16, (Preset Multiple Registers). All data points
currently defined by the control are transmitted to the slave device.