1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 <2015> 2016 2017 2018 2019 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 <2015> 2016 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: data of modbus write function didn't updated automatically |
From: | JaeRyong Seo <[email protected]> |
To: | Mark Rivers <[email protected]>, [email protected] |
Date: | Fri, 3 Apr 2015 14:58:02 +0900 |
Hi JaeRyong,
What you are asking is not possible. The OutFunctions:
# Write 32 bits. Function code=5.
drvModbusAsynConfigure("T1_Yn_Out_Bit", "Trans1", 0, 5, 17600, 040, 0, 100, "LSIS_PLC")
This uses function code 5, which is a write-only operation. So it is not possible to read back a value with this driver except once at iocInit for bumpless reboots.
Since you have an InFunction that looks at the same memory:
# Read 32 bits. Function code=1.
drvModbusAsynConfigure("T1_Yn_In_Bit", "Trans1", 0, 1, 17600, 040, 0, 100, "LSIS_PLC")
you could build a database that sets your bo record to match the corresponding bi record.
In general asyn can now update bo records when the driver sends a new value (this was added in asyn R4-26). However, this does not work with the Modbus driver because each driver either does output or input. The output drivers do not periodically poll their memory locations and do callbacks, which would be required to implement the new asyn feature. This could potentially be added in a future modbus release.
Note that I spotted several errors in your files:
# Read 80 words (128 bits). Function code=3.
drvModbusAsynConfigure("T1_Yn_In_Word", "Trans1", 0, 3, 1100, 80, 0, 100, "LSIS_PLC")
The comment says that you are reading 80 words (128 bits). That would be true if 80 were an hex number. But you have not put a leading 0x or a leading 0 (which would be octal and hence 64 bits).
These lines don't look correct because you have passed a final "I/O Intr" parameter, which would be for the SCAN macro. But mbboDirect.template from modbus/Db does not take a SCAN macro.
file "../../db/mbboDirect.template" { pattern
{P, R, PORT, OFFSET, MASK, SCAN}
{CIS:TRANS1:, YWOut0, T1_Yn_Out_Word, 0x0, 0xFFFF, "I/O Intr"}
{CIS:TRANS1:, YWOut1, T1_Yn_Out_Word, 0x1, 0xFFFF, "I/O Intr"}
}
Mark
________________________________
From: [email protected] [[email protected]] on behalf of JaeRyong Seo [[email protected]]
Sent: Thursday, April 02, 2015 12:15 AM
To: [email protected]
Subject: data of modbus write function didn't updated automatically
drvAsynIPPortConfigure("Trans1","192.168.1.10:502<http://192.168.1.10:502>",0,0,1)
Hi, all
for communication with PLC via using modbus, I used modbusR2-5 version.
i found one problem.
here is 4 functions that InFunction A,B and OutFunctions C, D.
they access same memory.
After I changed memory data via using OutFunction C or D,
data of InFunctions A, B updated automatically (this is written on manual),
but data of OutFunctions C, D didn't updated automatically.
I wonder if it is possible to update data of the other OutFunctions automatically.
below is my log data.
[sjr@localhost ~]$ caget CIS:TRANS1:YWIn1
CIS:TRANS1:YWIn1 0
[sjr@localhost ~]$ caget CIS:TRANS1:YWOut1
CIS:TRANS1:YWOut1 0
[sjr@localhost ~]$ caget CIS:TRANS1:YBIn1_1
CIS:TRANS1:YBIn1_1 Low
[sjr@localhost ~]$ caget CIS:TRANS1:YBOut1_1
CIS:TRANS1:YBOut1_1 Low
[sjr@localhost ~]$ caput CIS:TRANS1:YBOut1_1 1
Old : CIS:TRANS1:YBOut1_1 Low
New : CIS:TRANS1:YBOut1_1 High
[sjr@localhost ~]$ caget CIS:TRANS1:YBIn1_1
CIS:TRANS1:YBIn1_1 High
[sjr@localhost ~]$ caget CIS:TRANS1:YWIn1
CIS:TRANS1:YWIn1 2
[sjr@localhost ~]$ caget CIS:TRANS1:YWOut1
CIS:TRANS1:YWOut1 0
[sjr@localhost ~]$ caput CIS:TRANS1:YWOut1 0
Old : CIS:TRANS1:YWOut1 0
New : CIS:TRANS1:YWOut1 0
[sjr@localhost ~]$ caget CIS:TRANS1:YWIn1
CIS:TRANS1:YWIn1 0
[sjr@localhost ~]$ caget CIS:TRANS1:YBOut1_1
CIS:TRANS1:YBOut1_1 High
[sjr@localhost ~]$
and this is substitutions.
# These are the Yn inputs done with bit access Y0-Y7
file "../../db/bi_bit.template" { pattern
{P, R, PORT, OFFSET, ZNAM, ONAM, ZSV, OSV, SCAN}
{CIS:TRANS1:, YBIn1_0, T1_Yn_In_Bit, 0x10, Low, High, NO_ALARM, MAJOR, "I/O Intr"}
{CIS:TRANS1:, YBIn1_1, T1_Yn_In_Bit, 0x11, Low, High, NO_ALARM, MAJOR, "I/O Intr"}
}
file "../../db/intarray_in.template" { pattern
{P, R, PORT, NELM, SCAN}
{CIS:TRANS1:, YBIn0Array, T1_Yn_In_Bit, 32, "I/O Intr"}
}
file "../../db/asynRecord.template" { pattern
{P, R, PORT, ADDR, TMOD, IFACE}
{CIS:TRANS1:, YBIn0Asyn, T1_Yn_In_Bit, 0, Read, asynUInt32Digital}
}
file "../../db/statistics.template" { pattern
{P, R, PORT, SCAN}
{CIS:TRANS1:, YBIn0St, T1_Yn_In_Bit, "10 second"}
}
file "../../db/poll_delay.template" { pattern
{P, R, PORT}
{CIS:TRANS1:, YBIn0PollDelay, T1_Yn_In_Bit}
}
file "../../db/mbbiDirect.template" { pattern
{P, R, PORT, OFFSET, MASK, SCAN}
{CIS:TRANS1:, YWIn0, T1_Yn_In_Word, 0x0, 0xFFFF, "I/O Intr"}
{CIS:TRANS1:, YWIn1, T1_Yn_In_Word, 0x1, 0xFFFF, "I/O Intr"}
}
file "../../db/intarray_in.template" { pattern
{P, R, PORT, NELM, SCAN}
{CIS:TRANS1:, YWIn0Array, T1_Yn_In_Word, 80, "I/O Intr"}
}
file "../../db/asynRecord.template" { pattern
{P, R, PORT, ADDR, TMOD, IFACE}
{CIS:TRANS1:, YWIn0Asyn, T1_Yn_In_Word, 0, Read, asynInt32}
}
file "../../db/statistics.template" { pattern
{P, R, PORT, SCAN}
{CIS:TRANS1:, YWIn0St, T1_Yn_In_Word, "10 second"}
}
file "../../db/poll_delay.template" { pattern
{P, R, PORT}
{CIS:TRANS1:, YWIn0PollDelay, T1_Yn_In_Word}
}
# These are the Yn outputs done with bit access. Y0-Y7
file "../../db/bo_bit.template" { pattern
{P, R, PORT, OFFSET, ZNAM, ONAM}
{CIS:TRANS1:, YBOut1_0, T1_Yn_Out_Bit, 0x10, Low, High}
{CIS:TRANS1:, YBOut1_1, T1_Yn_Out_Bit, 0x11, Low, High}
}
file "../../db/asynRecord.template" { pattern
{P, R, PORT, ADDR, TMOD, IFACE}
{CIS:TRANS1:, YBOut0Asyn, T1_Yn_Out_Bit, 0, Read, asynUInt32Digital}
}
file "../../db/statistics.template" { pattern
{P, R, PORT, SCAN}
{CIS:TRANS1:, YBOut0, T1_Yn_Out_Bit, "10 second"}
}
file "../../db/poll_delay.template" { pattern
{P, R, PORT}
{CIS:TRANS1:, YBOut0PollDelay, T1_Yn_Out_Bit}
}
file "../../db/mbboDirect.template" { pattern
{P, R, PORT, OFFSET, MASK, SCAN}
{CIS:TRANS1:, YWOut0, T1_Yn_Out_Word, 0x0, 0xFFFF, "I/O Intr"}
{CIS:TRANS1:, YWOut1, T1_Yn_Out_Word, 0x1, 0xFFFF, "I/O Intr"}
}
file "../../db/asynRecord.template" { pattern
{P, R, PORT, ADDR, TMOD, IFACE}
{CIS:TRANS1:, YWOut0Asyn, T1_Yn_Out_Word, 0, Read, asynInt32}
}
file "../../db/statistics.template" { pattern
{P, R, PORT, SCAN}
{CIS:TRANS1:, YWOut0St, T1_Yn_Out_Word, "10 second"}
}
file "../../db/poll_delay.template" { pattern
{P, R, PORT}
{CIS:TRANS1:, YWOut0PollDelay, T1_Yn_Out_Word}
}
and this is st.cmd files
modbusInterposeConfig("Trans1",0,5000,0)
# Read 32 bits. Function code=1.
drvModbusAsynConfigure("T1_Yn_In_Bit", "Trans1", 0, 1, 17600, 040, 0, 100, "LSIS_PLC")
# Write 32 bits. Function code=5.
drvModbusAsynConfigure("T1_Yn_Out_Bit", "Trans1", 0, 5, 17600, 040, 0, 100, "LSIS_PLC")
# Read 80 words (128 bits). Function code=3.
drvModbusAsynConfigure("T1_Yn_In_Word", "Trans1", 0, 3, 1100, 80, 0, 100, "LSIS_PLC")
# Write 80 words (128 bits). Function code=6.
drvModbusAsynConfigure("T1_Yn_Out_Word", "Trans1", 0, 6, 1100, 80, 0, 100, "LSIS_PLC")
and this is my epics environment.
epics> epicsParamShow
EPICS_AR_PORT: 7002
EPICS_CAS_AUTO_BEACON_ADDR_LIST is undefined
EPICS_CAS_BEACON_ADDR_LIST is undefined
EPICS_CAS_BEACON_PERIOD is undefined
EPICS_CAS_BEACON_PORT is undefined
EPICS_CAS_IGNORE_ADDR_LIST is undefined
EPICS_CAS_INTF_ADDR_LIST is undefined
EPICS_CAS_SERVER_PORT is undefined
EPICS_CA_ADDR_LIST: 100.100.10.255 192.168.1.255 10.10.10.255
EPICS_CA_AUTO_ADDR_LIST: NO
EPICS_CA_BEACON_PERIOD: 15.0
EPICS_CA_CONN_TMO: 30.0
EPICS_CA_MAX_ARRAY_BYTES: 1000000000
EPICS_CA_MAX_SEARCH_PERIOD: 300.0
EPICS_CA_NAME_SERVERS is undefined
EPICS_CA_REPEATER_PORT: 5065
EPICS_CA_SERVER_PORT: 5064
EPICS_CMD_PROTO_PORT is undefined
EPICS_IOC_LOG_FILE_COMMAND is undefined
EPICS_IOC_LOG_FILE_LIMIT: 1000000
EPICS_IOC_LOG_FILE_NAME is undefined
EPICS_IOC_LOG_INET is undefined
EPICS_IOC_LOG_PORT: 7004
EPICS_TIMEZONE: CUS::360:031302:110602
EPICS_TS_NTP_INET is undefined
IOCSH_HISTSIZE: 50
IOCSH_PS1: epics>
Best Regards,
JaeRyong