I’m new to Modbus TCP, so I’m not quite sure how to match up the pump controller documentation with the Modbus documentation.
The software user manual says it implements 0x03 and 0x10 functions. It says
“The output address space starts at base address 0x1000, output offset is 0x100. Considering output numbered from 0 to available output number minus one a output register address is given by:
Registeraddress = baseaddress + outputoffset * outputnumber + registeroffset
e.g. output 2 VOUT register is 0x1000 + 0x100 * 1 + 0x49 = 0x1149”
It also says:
Each output has a unique address space starting at output base address, with the output status registers from 0x40 to 0x80.
The register I’m interested in is read only, and with an offset of 0x4a (instead of 0x49).
I configured it as follows:
drvAsynIPPortConfigure("NEG","172.20.39.175:502",0,0,0)
modbusInterposeConfig("NEG",0,5000,10)
drvModbusAsynConfigure("NEGmb","NEG",0,3,0x1140,0x40,0,2000,"SAES")
database:
record(ai, "TESTnegI") {
field(DTYP,"asynInt32")
field(INP,"@asynMask(NEGmb 0xa 16)MODBUS_DATA")
field(LINR,"LINEAR")
field(EGUL,"0")
field(EGUF,"655.36")
field(HOPR,"655.36")
field(LOPR,"0")
field(SCAN,"1 second")
}
How should I be configuring this? I realize I/O Intr would be a better SCAN choice, but at this point I’m more concerned with getting the read to work.
Thank you,
Scott
Debug information follows:
asynReport shows:
modbus port: NEGmb
initialized: true
asynOctet server: NEG
modbusSlave: 0
modbusFunction: 3
modbusStartAddress: 010500
modbusLength: 0100
absoluteAddressing: false
dataType: 0 (INT16)
plcType:
I/O errors: 13
Read OK: 0
Write OK: 0
pollDelay: 2.000000
Time for last I/O 0 msec
Max. I/O time: 0 msec
Time per hist. bin: 1 msec
Port: NEGmb
Timestamp: <undefined>
Input EOS[0]:
Output EOS[0]:
Parameter list 0
Number of parameters is: 12
Parameter 0 type=asynInt32, name=MODBUS_DATA, value is undefined
Parameter 1 type=asynInt32, name=MODBUS_READ, value is undefined
Parameter 2 type=asynUInt32Digital, name=ENABLE_HISTOGRAM, value is undefined
Parameter 3 type=asynInt32, name=READ_HISTOGRAM, value is undefined
Parameter 4 type=asynInt32, name=HISTOGRAM_BIN_TIME, value is undefined
Parameter 5 type=asynInt32Array, name=HISTOGRAM_TIME_AXIS, value is undefined
Parameter 6 type=asynFloat64, name=POLL_DELAY, value is undefined
Parameter 7 type=asynInt32, name=READ_OK, value=0, status=0
Parameter 8 type=asynInt32, name=WRITE_OK, value=0, status=0
Parameter 9 type=asynInt32, name=IO_ERRORS, value=13, status=0
Parameter 10 type=asynInt32, name=LAST_IO_TIME, value=0, status=0
Parameter 11 type=asynInt32, name=MAX_IO_TIME, value=0, status=0
This is what the asynTrace shows:
2021/04/23 17:42:57.539 172.20.39.175:502 write 12
00 11 00 00 00 06 00 03 11 40 00 40
2021/04/23 17:42:57.541 172.20.39.175:502 read 9
00 11 00 00 00 03 00 83 02
2021/04/23 17:43:05.545 172.20.39.175:502 write 12
00 12 00 00 00 06 00 03 11 40 00 40
2021/04/23 17:43:05.546 172.20.39.175:502 read 9
00 12 00 00 00 03 00 83 02