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: | 答复: Questions about set parameters to device by using epics |
From: | lzf neu <[email protected]> |
To: | Eric Norum <[email protected]>, "[email protected]" <[email protected]> |
Date: | Fri, 27 Jan 2017 05:34:40 +0000 |
Firstly, thanks for your respond ! But the problem still exists, let me describe it in details. The modbus version is R1-2(very old version).
And the contents of st.cmd file are posted in the following:
#!../../bin/linux-x86_64/modbusApp < envPaths
dbLoadDatabase("../../dbd/modbus.dbd") modbus_registerRecordDeviceDriver(pdbbase) # Use the following commands for TCP/IP #read Device ID 2 drvAsynIPPortConfigure("AGM16-007", "192.168.1.241:502",0,1,1) modbusInterposeConfig("AGM16-007", 2,0,2000) # Read 100 words (1600 bits). Function code=3. drvModbusAsynConfigure("RD1R", "AGM16-007", 3, 0, 95, 0, 1130, "rpDevice") # Write 8 words (128 bits). Function code=16 drvModbusAsynConfigure("parawrite1", "AGM16-007", 16, 48, 8, 0, 10000, "rpDevice") drvModbusAsynConfigure("timewrite1", "AGM16-007", 16, 64, 7, 0, 10000, "rpDevice") # dbLoadRecords("../../db/ssrfdb/RPmodbus.db","RPNAM=Gamma:01, PORT=RD1R, paraWDPORT=parawrite1, timeWDPORT=timewrite1") iocInit #################################################
After running, epics displays the following errors during its initialization: 2017/01/27 12:55:21.149 drvModbusAsyn::doModbusIO port parawrite1 is disconnected
Here is the whole messages:
[rp@localhost iocTest]$ ./test.cmd
epics>
#!../../bin/linux-x86_64/modbusApp < envPaths epicsEnvSet("ARCH","linux-x86_64") epicsEnvSet("IOC","iocTest") epicsEnvSet("TOP","/home/rp/epicswork/modbusR1-2") epicsEnvSet("EPICS_BASE","/home/rp/epics/base-3.14.12.5") epicsEnvSet("ASYN","/home/rp/epics/modules/asyn-4.9") epicsEnvSet("GENSUB","/home/rp/epics/modules/genSubV1-6") dbLoadDatabase("../../dbd/modbus.dbd") modbus_registerRecordDeviceDriver(pdbbase) # Use the following commands for TCP/IP #read Device ID 2 drvAsynIPPortConfigure("AGM16-007", "192.168.1.241:502",0,1,1) modbusInterposeConfig("AGM16-007", 2,0,2000) # Read 100 words (1600 bits). Function code=3. drvModbusAsynConfigure("RD1R", "AGM16-007", 3, 0, 95, 0, 1130, "rpDevice") # Write 8 words (128 bits). Function code=16 drvModbusAsynConfigure("parawrite1", "AGM16-007", 16, 48, 8, 0, 10000, "rpDevice") 2017/01/27 12:55:21.149 drvModbusAsyn::doModbusIO port parawrite1 is disconnected drvModbusAsynConfigure("timewrite1", "AGM16-007", 16, 64, 7, 0, 10000, "rpDevice") ### dbLoadRecords("../../db/ssrfdb/RPmodbus.db","RPNAM=DCLS:RP:Gamma:01, PORT=RD1R, paraWDPORT=parawrite1, timeWDPORT=timewrite1") iocInit Starting iocInit ############################################################################ ## EPICS R3.14.12.5 $Date: Tue 2015-03-24 09:57:35 -0500$ ## EPICS Base built Jan 25 2017 ############################################################################ iocRun: All initialization complete
Now I can read data from device, but the problem is I cannot set parameters to device. for example, I can read Hour from device in addr 68, but i cannot write new hour to device using the db.
This is the correct db that read Hour from device: record(ai, "$(RPNAM):HourVal"){
This is the db that I try to write Hour to device:field(DTYP,"asynInt32") field(INP, "@asynMask($(PORT) 68 16)MODBUS_DATA") field(SCAN,"Passive") field(FLNK, "$(RPNAM):WeekVal") } record(ao, "$(RPNAM):HourValSET"){
field(DTYP,"asynInt32") field(OUT, "@asyn($(PORT), 68)") field(SCAN,"Passive") } by typing the command to set new hour value '15': caput Gamma:01:HourValSET 15 The error message displays in the following: epics> 2017/01/27 12:56:04.314 drvModbusAsyn::writeInt32 port RD1R invalid request for Modbus function 3
2017/01/27 12:56:04.314 DCLS:RP:Gamma:01:HourValSET devAsynInt32 process error Any suggestions and many thanks in advance !
Zhefu 发件人: Eric Norum <[email protected]>
发送时间: 2017年1月26日 17:57 收件人: lzf neu 抄送: [email protected] 主题: Re: Questions about set parameters to device by using epics You need to specify a MODBUS output function code ― function code 6 to write a single holding register, function code 16 to write multiple holding registers. Here re a couple examples
drvModbusAsynConfigure("eps1_io", "epsPLC_1", 0, 6, 16000, 1, 0, 1000, "Wago")
drvModbusAsynConfigure("eps1_ao", "epsPLC_1", 0,16, 17216, 54, 0, 1000, "Wago”)
|