Experimental Physics and Industrial Control System
Hi Zhefu,
> dbLoadRecords("../../db/ssrfdb/RPmodbus.db","RPNAM=DCLS:RP:Gamma:01, PORT=RD1R, paraWDPORT=parawrite1, timeWDPORT=timewrite1")
> This is the db that I try to write Hour to device:
> record(ao, "$(RPNAM):HourValSET"){
> field(DTYP,"asynInt32")
> field(OUT, "@asyn($(PORT), 68)")
> field(SCAN,"Passive")
>}
You are using the wrong port in HourValSET record. The line should be
field(OUT, "@asyn($( timeWDPORT), 68)")
Port $(PORT) was assigned to RD1R which is Modbus function 3.
Mark
________________________________
From: [email protected] [[email protected]] on behalf of lzf neu [[email protected]]
Sent: Thursday, January 26, 2017 11:34 PM
To: Eric Norum; [email protected]
Subject: 答复: Questions about set parameters to device by using epics
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
#!../../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
epics>
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"){
field(DTYP,"asynInt32")
field(INP, "@asynMask($(PORT) 68 16)MODBUS_DATA")
field(SCAN,"Passive")
field(FLNK, "$(RPNAM):WeekVal")
}
This is the db that I try to write Hour to device:
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”)
On Jan 26, 2017, at 9:42 AM, lzf neu <[email protected]<mailto:[email protected]>> wrote:
Hi,
Below is the correct db that can read hour from the device:
record(ai, "$(RPNAM):HourVal"){
field(DTYP,"asynInt32")
field(INP, "@asynMask($(PORT) 68 16)MODBUS_DATA")
field(SCAN,"Passive")
field(FLNK, "$(RPNAM):WeekVal")
}
now, I want to set new hour to the device and I try to write the following db according to Analog Output Example Record from "asynDriver: Asynchronous Driver Support" manual:
record(ao, "$(RPNAM):HourValSET"){
field(DTYP,"asynInt32")
field(OUT, "@asyn($(PORT), 68)")
field(SCAN,"Passive")
}
however, I failed, epics gives the following error messages:
drvModbusAsyn::writeInt32 port RD1R invalid request for Modbus function 3
Gamma:01:HourValSET devAsynInt32 process error
Could anyone give me some suggestions and thanks in advance !
- Replies:
- 答复: Questions about set parameters to device by using epics lzf neu
- References:
- Questions about set parameters to device by using epics lzf neu
- Re: Questions about set parameters to device by using epics Eric Norum
- 答复: Questions about set parameters to device by using epics lzf neu
- Navigate by Date:
- Prev:
Re: Question about EDM Problems Bruce Hill
- Next:
RE: problem connecting serial device with moxa 5150A Mark Rivers
- 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
- Navigate by Thread:
- Prev:
答复: Questions about set parameters to device by using epics lzf neu
- Next:
答复: Questions about set parameters to device by using epics lzf neu
- 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