This is a common problem when a device setting can be modified in more than one way. It could be through some other application, local console as in your case, etc.
Let's assume that you currently have a longout record (MyParam) that has SCAN=Passive, and a longin record (MyParam_RBV) reading that Modbus value that has SCAN=I/O Intr.
Here is a solution. You need to change MyParam to be soft device support, and add a new record MyParam_write that actually writes the value to Modbus. You need to add a new record MyParam_sync that copies MyParam_RBV to MyParam. This will update your longout whenever the longin changes:
record(longout, "$(P)$(R)MyParam")
{
field(PINI, "YES")
field(OUT, "$(P)$(R)MyParam_write PP")
field(VAL, "1")
}
record(longout, "$(P)$(R)MyParam_write")
{
field(SDIS, "$(P)$(R)MyParam_Sync.PACT")
field(DISV, "1")
field(DTYP, "asynInt32")
field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))FILE_NUMBER")
}
record(longin, "$(P)$(R)MyParam_RBV")
{
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))FILE_NUMBER")
field(SCAN, "I/O Intr")
field(FLNK, "$(P)$(R)MyParam_Sync")
}
record(longout, "$(P)$(R)MyParam_Sync")
{
field(DOL, "$(P)$(R)MyParam_RBV NPP")
field(OMSL, "closed_loop")
field(OUT, "$(P)$(R)MyParam PP")
}
This is the only way I know how to do it currently, and if you have many records that can be locally changed you need to do this for all of them.
Mark
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of haquin
Sent: Monday, August 19, 2013 9:35 AM
To: tech-talk
Subject: Modbus write register update when locally modified
Hi all,
I use Asyn (v4.19) ModbusTCP (v2.4) driver with longout record to write a consign.
when the plc is switched to Local control mode and consign is locally modified, when the plc is back in remote control
mode, the record hosting the consign is not updated with the new current value.
I've checked that the Modbus table is actually updated.
Is it possible to have the record updated in such circumstance ?
Such Local/Distant transition doesn't fall into the Disconnect/Reconnect scope.