Hi Dale,
- My issue is that the PV values aren't being updated when the IOC starts -- meaning that after the IOC start, the bo and mbbo values stored in that register don't match what was returned
via the initial modbus request.
I am not sure I completely understand what you are saying. Here is what should happen:
- Because this port you created uses function code 6 (write single register) and because you have a non-zero poll time, the driver will do one initial read of that register using function
code 3.
- EPICS device support for the bo records does a read operation from the port during init_record. If this read returns asynSuccess (which it should) then the value of the bo record
is set to the value read from the driver. This is the “bumpless reboot” concept.
- You have not set PINI=YES in these records, so the value from the record will not be written back to the device during iocInit. However, the record value should still match the device,
because of steps 1 and 2 above.
If I understand correctly you are saying that the bo record does have the correct value read from the device during steps 1-2. But now the device has a different value from that in the record? I don’t understand that, since it seems like
there must have been a write to the device to change the value?
Mark
From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of
Dale Cox via Tech-talk
Sent: Thursday, April 13, 2023 8:29 AM
To: tech-talk at aps.anl.gov
Subject: modbus ioc start
Good Morning,
I have an IOC that is currently reading registers via modbus rtu over rs485. There are a set of registers that store multiple configuration options in a single register. I set up the port using this line:
> drvModbusAsynConfigure("Z8TC1_Config", "SenecaBus", 5, 6, 53, 4, "UINT16", 100, "SenecaZ")
I've enabled the debugging lines on this IOC. When the IOC starts, I can see that the correct registers are being retrieved when the port is created. I can also write config changes to those registers at their assigned PV's with no issues
that I have found. My issue is that the PV values aren't being updated when the IOC starts -- meaning that after the IOC start, the bo and mbbo values stored in that register don't match what was returned via the initial modbus request.
Here are a couple of the DB entries that I'm using:
record(bo,"$(P)$(R)-TC1_enable") {
field(DTYP,"asynUInt32Digital")
field(OUT,"@asynMask($(PORT), 0, 0x8000 )")
field(ZNAM,"Disabled")
field(ONAM,"Enabled")
}
record(bo,"$(P)$(R)-TC2_enable") {
field(DTYP,"asynUInt32Digital")
field(OUT,"@asynMask($(PORT), 0, 0x4000 )")
field(ZNAM,"Disabled")
field(ONAM,"Enabled")
}
record(bo,"$(P)$(R)-TC1-2_units") {
field(DTYP,"asynUInt32Digital")
field(OUT,"@asynMask($(PORT), 0, 0x2000 )")
field(ZNAM,"tempDegC")
field(ONAM,"mV")
}
--
Dale Cox
Instrumentation and Electrical Engineer
|