Hi szymon,
As your program require a single MODBUS channel, it would be better if you create it on the dEX 2.0. Then based on the template you can expand it further. Your program has some weaknesses:
- As MODBUS read voltage, it will not use MODBUS type 0 (R0), most likely MODBUS type 4 for holding register.
- There is a shift by 1 on dataTaker declaration to read a register address, when you declare 4096, it means the register target would be 4095.
- It is rare to use the MBI setting (integer), except the sensor indicates a division number. Meaning if the division is 10 then the MODBUS output would be divided by 10 to gain a floating-point number. Beside the MBF that you should use, you need to declare the byte sequence (endianness).
A recommendation, please try to reduce the allocation memory to 30M when using firmware version 9.22.
The right sample program would be (with assumption of using a floating-point and a holding register)
BEGIN"config"
'Generated by new dEX-2
password=""
RS1S
RA"Modbus"("b:",ALARMS:OV:100KB:W60,DATA:OV:1MB)5S
LOGONA
1MODBUS("Voltage~",AD1,R4:4096,MBF,=1001CV,LM)
END
The profile setting is no longer part of the program, it will allow you to change them without any need to resend the program. Or if you wish to include them in the program please use manual channels.
BEGIN"config"
'Generated by new dEX-2
password=""
'Manual "Profile1"{
PROFILE SERSEN_PORT BPS=9600
PROFILE SERSEN_PORT FLOW=NONE
PROFILE SERSEN_PORT DATA_BITS=8
PROFILE SERSEN_PORT STOP_BITS=1
'Manual}
'Manual "Profile2"{
PROFILE SERSEN_PORT PARITY=NONE
PROFILE SERSEN_PORT MODE=RS485
PROFILE SERSEN_PORT FUNCTION=MODBUS_MASTER
PROFILE MODBUS_SERVER SERSEN_ADDRESS=0
'Manual}
RS1S
RA"Modbus"("b:",ALARMS:OV:100KB:W60,DATA:OV:1MB)5S
LOGONA
1MODBUS("Voltage~",AD1,R4:4096,MBF,=1001CV,LM)
END
Best regards,
dataTaker Expert
Hi szymon,
As your program require a single MODBUS channel, it would be better if you create it on the dEX 2.0. Then based on the template you can expand it further. Your program has some weaknesses:
- As MODBUS read voltage, it will not use MODBUS type 0 (R0), most likely MODBUS type 4 for holding register.
- There is a shift by 1 on dataTaker declaration to read a register address, when you declare 4096, it means the register target would be 4095.
- It is rare to use the MBI setting (integer), except the sensor indicates a division number. Meaning if the division is 10 then the MODBUS output would be divided by 10 to gain a floating-point number. Beside the MBF that you should use, you need to declare the byte sequence (endianness).
A recommendation, please try to reduce the allocation memory to 30M when using firmware version 9.22.
The right sample program would be (with assumption of using a floating-point and a holding register)
````
BEGIN"config"
'Generated by new dEX-2
password=""
RS1S
RA"Modbus"("b:",ALARMS:OV:100KB:W60,DATA:OV:1MB)5S
LOGONA
1MODBUS("Voltage~",AD1,R4:4096,MBF,=1001CV,LM)
END
````
The profile setting is no longer part of the program, it will allow you to change them without any need to resend the program. Or if you wish to include them in the program please use manual channels.
````
BEGIN"config"
'Generated by new dEX-2
password=""
'Manual "Profile1"{
PROFILE SERSEN_PORT BPS=9600
PROFILE SERSEN_PORT FLOW=NONE
PROFILE SERSEN_PORT DATA_BITS=8
PROFILE SERSEN_PORT STOP_BITS=1
'Manual}
'Manual "Profile2"{
PROFILE SERSEN_PORT PARITY=NONE
PROFILE SERSEN_PORT MODE=RS485
PROFILE SERSEN_PORT FUNCTION=MODBUS_MASTER
PROFILE MODBUS_SERVER SERSEN_ADDRESS=0
'Manual}
RS1S
RA"Modbus"("b:",ALARMS:OV:100KB:W60,DATA:OV:1MB)5S
LOGONA
1MODBUS("Voltage~",AD1,R4:4096,MBF,=1001CV,LM)
END
````
Best regards,
dataTaker Expert
edited Jun 27 '22 at 11:08 am