1 REM For more keywords and how to use them, see t3000_help.chm in the installation directory
10 REM THE FOLLOWING ARE EXAMPLES OF READING A SUBNET DEVICE MODBUS ID=2
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
141 REM Read the value of register No. 56 with Modbus ID 4 via MODBUS TCP, where 123 is the last segment of the IP address (192.168.0.123).
142 VAR99 =  123.4.MB_REG56 
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 ) 
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      
250  REM How to read slave unsigned INT by Modbus  ， reg3 is high  ,reg4 is low
251   VAR3 = 1.2.MB_REG3 * 65536 + 1.2.MB_REG4
255  REM THE FOLLOWING ARE EXAMPLES OF READING A REMOTE DEVICE MODBUS ID=4 WITH LAST IP NUMBER 199 
256 REM 199 is the last number of the IP address of the device to be read （ex:The IP address of the device to be read is 192.168.0.199）
259 VAR98 = 199.4.MB_REG55
260 VAR99 = 199.4.MB_DISINPUT56
270 REM PVAR RETURN THE NUMBER OF MINUTES SINCE LAST TRANSMISSION.
271 REM  PARAMETER RS485_MAIN USE 1 , RS485_SUB USE 2 ,ETHERNET USE 3  , WIFI USE 4
280 VAR100 = PVAR( 1 )
290 VAR101 = SIN ( 60 ) 
300 VAR102 = COS ( 34 ) 
310 REM T3-LIGHTING-SWITCH CAN USE RGB TO CONTROL LED COLOUR  RGB(RED,GREEN,BLUE ,BRIGHTNESS)
320 VAR103 = RGB(255,0,0,50)


