Hi all,
How do we read from the rs485 port on a modbus device and poll a register for a value on the t3-oem?
Thanks
Chris
Hi all,
How do we read from the rs485 port on a modbus device and poll a register for a value on the t3-oem?
Thanks
Chris
I cannot see the modbus master dropdown in t3000 is this implemented on the OEM?
Modbus Master and Slave are merged into one now. The default is slave where the T3 device will respond to any modbus polling going on in the network. If you have written a program to read and write external devices over the Modbus port then the device will act as a master. If there’s a mix of the two going on, with multiple masters on the subnet then the T3 will do its best to handle both master and slave dutues. there will be data collisions which will degrade comommunications health is the only downside.
Hi Maurice
Thanks for the reply
so I want to construct a sort of step by step process, please give me your approval on my thinking of how to get there.
To assign the rs485 register value to a t3oem register so I can poll it from scada.
10 MB_DEFINE_DEVICE(“Registerassign”,“RTU:COM1,9600,N,1,2”)
20 rem MB_READ_HOLDING_REGISTERS(mode, device, start_address, count)
30 var1 = MB_READ_HOLDING_REGISTERS(“Registerassign”, 1, 300, 2") // from register of sensor
40 1.2.MB_REG8348 = var1 // 8348 is a variable in the unsigned registers i think in the t-oem that I can use?
If I have assigned var1 to the register in the t3-oem is this the way to do this as a modbus master on the slave setting as you say.
So I guess if you can fix this up to get me on the right track.
Thanks
Chris
If you are just polling from your SCADA to a subnet device you dont need any program at all. Search this forum for some ‘transparent’ mode, these are Modbus IP commands that will automatically be passed on to the subnet devices on the RS485 port.
Set the baud rate and protocol in the T3000 environment, you can only poll at the one baud rate as set up in your communications configuration dialog.
If you need to do some processing such as scaling then you would use a program like :
10 VAR1 = MBReg … (search the forum for ‘network programming’ for some examples.
To Be done: Fandu will give some full examples of transparent mode commands and also control basic type commands.
I understand the reads from a sensor on the rs485 through modbus poll, but where does it put the read data, onto what register range?
Use the T3000 register viewer tool, you can access that from T3000 → tools → modbus register viewer. All the vars will be there grouped together in some big register block. You can use the block read and write commands to speed up communications if there’s a lot of registers in your project.
Yes ,this can work
If the RS485 you are using connects to the Controller via the Modbus protocol, then 1.2.MB_REG8348 = var1 will write the value of var1 (from the Controller) into the RS485 subnet device with Modbus ID 2.
If you are using the BACnet protocol or connecting to the Controller via Ethernet, you can use 2VAR1 = VAR1, where the number “2” represents the panel number. For more available programming options, please refer to the help documentation.
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
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)
Thanks Fan_Du for the examples I am going to have a go and see if I can get the project I am wanting done. Maurice mentioned transparent mode which means that the modbus poll can read a register, but where does it output the values if I want to read them from scada, do you know the register range to look for in the t3-oem? At the same time I am going to do some calculations so the code will be necessary to create a formula which clarifies how the t3 comes together. I think im starting to understand how it works.
As I mentioned before, if you are doing a lot of work with Modbus registers you will want to get familiar with the T3000 → Tools → Modbus register viewer.
Note1: You only need to mess with Modbus registers if you are integrating other general modbus controllers and devices into your system.
Note2: If you need to read the T3 controller variables from an external Modbus master you can use the register viweer tool to scroll around and see ALL the modbus registers on the local T3 controller. The vars are in the list, you may have to scroll around but they’re there inculding a text description of the registers, the current value and the data structure.