T3000 uses a specialized programming framework that extends the standard Modbus commands for advanced functionality like floating-point register reading, block writing, and reading Modbus registers. This framework allows the master device to send standard Modbus commands to the slave device with additional operations. Below is a detailed breakdown of the specific commands and concepts used in T3000 programming.
In the following example, VAR1
is a user-defined variable in T3000, which stands for VARIABLE 1. It is defined under the VARIABLES tab in the T3000 software, similar to INPUTS and OUTPUTS (e.g., IN1
, OUT2
, etc.). Users can rename these variables for better readability.
Reading Floating Point Registers
T3000 enables reading Modbus registers in different formats, including floating-point values with various byte orders. This operation is typically used to access registers that store floating-point data.
- Example:
VAR100 = 1.2.MB_REG_FLOAT_ABCD33
VAR101 = 1.2.MB_REG_FLOAT_CDAB44
VAR102 = 1.2.MB_REG_FLOAT_BADC55
VAR103 = 1.2.MB_REG_FLOAT_DCBA66
- Explanation:
1
represents the Master device panel number (the device sending the Modbus request).2
represents the Slave device Modbus address (the device being queried).MB_REG_FLOAT_ABCD33
refers to reading a floating-point register at address33
with the byte orderABCD
. The same applies for other formats such asCDAB
,BADC
, andDCBA
, depending on the specific data format of the slave device.
Reading Modbus Registers
T3000 allows reading values from Modbus registers. This can be used to retrieve the data stored in various types of registers.
- Example:
VAR104 = 1.2.MB_REG7
- Explanation:
- This command reads the value stored in register 7 of the slave device with address
2
. - You can modify the register address (
MB_REG7
) as needed to read other registers in the system.
- This command reads the value stored in register 7 of the slave device with address
Writing via Modbus Blocks (MB_BLOCKWRITE)
T3000 supports block writing to Modbus registers, which allows writing multiple registers in a single operation. This utilizes the Modbus Write Multiple Registers command to efficiently handle large amounts of data.
- Example:
VAR1 = MB_BLOCKWRITE ( 2 , 100 , 5 , 10 , 20 , 30 , 40 , 50 )
- Explanation:
2
represents the Slave device Modbus address (target device).100
is the start Modbus register address (the first register where data will be written).5
indicates the length of the write operation, meaning we are writing to 5 registers starting from address100
.- The remaining values (
10, 20, 30, 40, 50
) are the data values that will be written to the registers. - Note: The maximum number of data values you can write in a single block is 25.
- This operation uses the Write Multiple Registers Modbus command, which allows writing multiple registers at once.
Reading Unsigned Integers
T3000 can also read multiple registers and combine them to form larger data types like unsigned integers. This can be done by combining two 16-bit registers to create a single 32-bit integer.
- Example:
VAR3 = 1.2.MB_REG3 * 65536 + 1.2.MB_REG4
- Explanation:
MB_REG3
holds the high part of the unsigned integer (multiplied by65536
), andMB_REG4
holds the low part.- The result is a 32-bit unsigned integer.
Reading Coils (Function Code 0x01)
Coils are typically used to represent the on/off states of a device (e.g., open/closed, on/off). This command uses Function Code 0x01 to read the status of one or more coils.
- Example:
VAR107 = 1.2.MB_COIL7
- Explanation:
1
represents the Master device panel number (the device sending the Modbus request).2
represents the Slave device Modbus address (the device being queried).MB_COIL7
refers to reading Coil 7 at slave device address2
.- This command uses Function Code 0x01, which is used to read the status of coils (such as on/off or open/closed states).
Reading Discrete Inputs (Function Code 0x02)
Discrete Inputs are typically used to represent the status of input signals from devices. They are similar to coils but are read-only, meaning you cannot write to them. This command uses Function Code 0x02 to read the status of one or more discrete inputs.
- Example:
VAR108 = 1.2.MB_DISINPUT7
- Explanation:
1
represents the Master device panel number.2
represents the Slave device Modbus address.MB_DISINPUT7
refers to reading Discrete Input 7 at slave device address2
.- This command uses Function Code 0x02, which is used to read the status of discrete inputs.
Reading Input Registers (Function Code 0x04)
Input Registers are typically used to read data from sensors or other input devices. This command uses Function Code 0x04 to read the values of one or more input registers.
- Example:
VAR109 = 1.2.MB_INPUTREG7
- Explanation:
1
represents the Master device panel number.2
represents the Slave device Modbus address.MB_INPUTREG7
refers to reading Input Register 7 at slave device address2
.- This command uses Function Code 0x04, which is used to read values from input registers, typically used to retrieve data from sensors or other input devices.
Writing to Modbus Registers
- Example:
1.2.MB_REG3 = VAR1 / 65536
- Explanation:
1
represents the Master device panel number (the device sending the Modbus command).2
represents the Slave device Modbus address (the target device).MB_REG3
refers to writing the value to Register 3 at slave device address2
.- The value of
VAR1
is divided by65536
and written to the register. This operation writes the high-level part ofVAR1
into the register. - This command uses Write Single Register (Function Code 0x06), which is used to write a value to a single Modbus register.
Specialized Device Addressing
- Example:
259 VAR98 = 199.4.MB_REG55
- Explanation:
199
represents the last number of the IP address of the device to be read (e.g., the IP address192.168.0.199
).4
represents the Slave device Modbus address (the device being queried).MB_REG55
refers to reading Register 55 at slave device address4
.- This command allows the Master device to read from a specific device by its IP address and Modbus register. The IP here actually refers to other devices with IP address 199 in the same network segment as this device. When the panel number of this device is also 199, the device should use the panel number as the first priority.