Can the T3-BB controller READ & WRITE modbus tcp & BACnet/IP sensors?
WITH EXAMPLE CONTROL BASIC PROGRAM
Sure, the T3 controllers can read & write Bacnet and Modbus sensors over Ethernet.
For modbus we have some special commands in our "Control Basic’ programming language:
01 (0x01) Read Coils > MB_COIL
02 (0x02) Read Discrete Inputs > MB_DISINPUT
03 (0x03) Read Holding Registers > MB_REG
04 (0x04) Read Input Registers > MB_INPUTREG
05 (0x05) Write Single Coil > MB_COIL
06 (0x06) Write Single Register > MB_REG
So suppose we have a Modbus device at IP address 192.168.0.100 and we want to read register #2 the program would look like this:
10 VAR1 = 100MBREG2
Where VAR1 is the variable on the local controller and 100 is the last IP octet of the Modbus IP device on your lan.
For Bacnet devices from other manufacturers just use the bacnet instance number and the Bacnet object you are interested in: AV, BV, AI, BI, AO, BO and so on. This works over both Ethernet/IP connections as well as RS485/MSTP connections.
10 VAR1 = 100AI2
And for the simplest method, for Bacnet devices from Temco Controls, use the native point name
10 VAR1 = 100IN2
Where 100 is the ‘Panel ID’ of the remote device and IN2 is the input point you are interested in, this could be IN, OUT, VAR, SCHED or any of the native point references. This is the preferred method when two Temco products are sharing network points because the point name will be replaced with the user text name once the program is sent and loaded back.
Maurice this helps me and others to know how to read from modbus device.
I have other queries like:
1.How to read 32/64 bit register.
2.How to read bit mask register.
3.How to read real swapped register.
- How to read 32/64 bit register.
For now we just support 16 bit registers.
2.How to read bit mask register.
The following are examples of reading a subnet device with Modbus ID=10 connected to a master controller on the Ethernet network with ‘Panel ID’ = 97
10 VAR10 = 97.10.MB_REG7
20 VAR9 = 97.10.MB_REG & 1
30 VAR9 = 97.10.MB_REG | 1
Use & (bitwise and) and | (bitwise or) to manage bit level read & write.
3.How to read real swapped register.
For now we only support 16bit low byte first.
For other structures you would have to manipulate the data in your program.
Hello Maurice, could I have an updated list of modbus BASIC commands? I found on this forum:
10 REM **** Modbus Function Code 01: Read Coils
20 VAR1 = 3.5.MB_COIL1
30 REM **** Modbus Function Code 02: Read Discrete Inputs
40 VAR2 = 3.5.MB_DISINPUT1
50 REM **** Modbus Function Code 03: Read Holding Registers
60 VAR3 = 3.5.MB_REG1
70 REM **** Modbus Function Code 04: Read Input Registers
80 VAR4 = 3.5.MB_INPUTREG1
90 REM **** Modbus Function Code 05: Write Single Coil
100 3.5.MB_COIL1 = 1
110 REM **** Modbus Function Code 06: Write Single Register
120 3.5.MB_REG1 = 1
Where:
The Panel ID of the T3 controller is 3
And the Modbus ID of the subnet device is 5
Are they still correct? Thanks.
Hi DonatoM:
About panel ID and modbus id you mentioned are correct.
In program, we support Read Holding, partial Read Coil and Read input register.But the Read Input Register does not support Read by float . Read Holding can read by float and support different ways
Other demo and keywords can search in the datasheet.
https://temcocontrols.com/ftp/file
T3000 Software Manual.pdf
10 REM THE FOLLOWING ARE EXAMPLES OF READING A SUBNET DEVICE MODBUS ID=1
20 REM WHICH CONNECTED TO A MASTER CONTROLLER ON THE ETHERNET NETWORK WITH ‘PANEL ID?
30 REM READ THE REGISTER UNDER MODBUS RS485 IN MODBUS FLOATING POINT MODE AND SAVE IT
40 VAR100 = 1.2.MB_REG_FLOAT_ABCD33
50 VAR101 = 1.2.MB_REG_FLOAT_CDAB44
60 VAR102 = 1.2.MB_REG_FLOAT_BADC55
70 VAR103 = 1.2.MB_REG_FLOAT_DCBA66
80 REM HOW TO READ BIT MASK REGISTER.
90 VAR104 = 1.2.MB_REG7
100 VAR105 = 1.2.MB_REG7 & 1
110 VAR106 = 1.2.MB_REG7 | 1
120 VAR107 = 1.2.MB_COIL7
130 VAR108 = 1.2.MB_DISINPUT7
140 VAR109 = 1.2.MB_INPUTREG7
149 REM READ OTHER DEVICE USE BACNET PROTOCAL 123456 IS THE DEVICE ID (INSTANCE NUMBER)
150 VAR110 = 123456AI2048
160 VAR111 = 123456AV3
170 VAR112 = 123456AO4
180 VAR110 = 123456BO5
190 VAR110 = 123456BI6
200 VAR110 = 123456BV7
210 VAR1 = MB_BLOCKWRITE ( 1 , 2 , 3 , 111 , 5 , 6 )
220 VAR10 = MB_BLOCKREAD ( 1 , 2 , 3 , 2 , VAR1 , VAR2 )
228 REM Line 230 writes the high level of VAR1 to register 3
229 REM Line 240 writes the low level of VAR1 to register 4
230 1.2.MB_REG3 = VAR1 / 65536
240 1.2.MB_REG4 = VAR1 * 1000 % 65536 / 1000
Hi Fance, thank you very much.