12
GF U3000 V2 Ultrasonic Flowmeter
Modbus Supplement to the operating instructions
The general procedure for updating a unit’s setting by the MBM follows the steps below:
1. Set the “Lock-out Updates” flag as mentioned earlier.
2. Perform write operations as necessary and set respective update flags.
3. Clear the “Lock-out Updates” flag.
4. Check the desired action has been performed by examining the update flags. If the action has been performed, update flags will
be automatically cleared , but if the action has not been performed, these flags will remain set.
There may be several reasons why an action has not been performed, but the most likely cause is that there has been a race condi-
tion between checking the inhibit bits and them being set by a local user.
If the register to be updated is read, then the value that was written to it will often be returned despite the operation failing. An ex-
ample of this are the damping registers. The update of the unit is triggered by a low to high transition and not simply by setting the
bit high. Since the value has already been set in the register, and providing it has not been overwritten, all that is required to try again
is to clear then set the update bit once more. Leave a few hundred milliseconds between these operations.
3.6
Some Examples
3.6.1
Unpacking Time and Date
The following pseudocode may be useful in unpacking time and date.
uint32 timeNdate; // allocate a 32-bit holding value.
uint16 year, month, day, hour, minute, second;
// Read the time and date starting at register offset 8.
timeNdate = Read2HoldingRegisters(8);
// Extract elements
second = timeNdate mod 2^6;
timeNdate = timeNdate div 2^6;
minute = timeNdate mod 2^6;
timeNdate = timeNdate div 2^6;
hour = timeNdate mod 2^5;
timeNdate = timeNdate div 2^5;
Day = timeNdate mod 2^5;
timeNdate = timeNdate div 2^5;
Month = timeNdate mod 2^4;
timeNdate = timeNdate div 2^4;
year = tim 2000;
3.6.2
Resetting Forward and Reverse Totals
1. Ensure inhibit bits are not set and that the update flags (bit 0 and bit 1 of the Status Flags register) are reset.
2. Send a MASK WRITE REGISTER message (command 22 or 0x16) to register address 5 with the AND mask being set to 0xFFFE
and the OR mask being 0x0001. This will set the “Lock-out Updates” flag (bit 0) of the Instrument Control Flags register.
3. Send a WRITE MULTIPLE REGISTERS message (command 16 or 0x10) with the big-endian floating-point representation of the
value being set. (Hint: use a tool to provide the conversion from a single precision floating point number to its hexadecimal re-
presentation. If the value is being reset to zero, then its value is 0x00000000)
4. Send a MASK WRITE REGISTER message (command 22 or 0x16) to register address 136 with the AND mask being set to 0xFFFC
and the OR mask being 0x0003. This will initiate the reset of totals on the unit.
5. Send a MASK WRITE REGISTER message (command 22 or 0x16) to register address 5 with the AND mask being set to 0xFFFE
and the OR mask being 0x0000. This will clear the “Lock-out Updates” flag (bit 0) of the Instrument Control Flags register.
When totals are read, they will start from the new values.