Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: modbus 2.4
From: Pierrick M Hanlet <hanlet@fnal.gov>
To: "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Fri, 28 Sep 2012 16:41:11 +0000
Hi,
I have an ioc (base 3.14.11) using modbus 2.4 in which I'm controlling ProportionAir
Modbus Serial OPV1 proportional air valves over RS485 serial.  In my st.cmd file,
I have:
modbusInterposeConfig("RFTunerPort",2,1000,0)
drvModbusAsynConfigure("read1ADDR", "RFTunerPort",0x01,0x03,0x0000,1,0,86400000,"ProportionAir")
drvModbusAsynConfigure("read1VALU", "RFTunerPort",0x01,0x03,0x0031,1,0,86400000,"ProportionAir")
drvModbusAsynConfigure("read2ADDR", "RFTunerPort",0x02,0x03,0x0000,1,0,86400000,"ProportionAir")
drvModbusAsynConfigure("read2VALU", "RFTunerPort",0x02,0x03,0x0031,1,0,86400000,"ProportionAir")

drvModbusAsynConfigure("write1VAL","RFTunerPort",0x01,0x10,0x0031,1,0,0,"ProportionAir1")
drvModbusAsynConfigure("write1CLS","RFTunerPort",0x01,0x10,0x0031,1,0,0,"ProportionAir1")
drvModbusAsynConfigure("write2VAL","RFTunerPort",0x02,0x10,0x0031,1,0,0,"ProportionAir2")
drvModbusAsynConfigure("write2CLS","RFTunerPort",0x02,0x10,0x0031,1,0,0,"ProportionAir2")


And, in my database, I have:
record(ai,"MICE-RF-TUNE-01:READADDR") {
	field(DESC,"Read address")
	field(SCAN,"Passive")
	field(DTYP,"asynInt32")
	field(INP,"@asyn(read1ADDR,0, 60)MODBUS_DATA")
}
record(ai,"MICE-RF-TUNE-01:READVALU") {
	field(DESC,"Read value")
	field(SCAN,"Passive")
	field(DTYP,"asynInt32")
	field(INP,"@asyn(read1VALU,0,36000)MODBUS_DATA")
}

record(ai,"MICE-RF-TUNE-02:READADDR") {
	field(DESC,"Read address")
	field(SCAN,"Passive")
	field(DTYP,"asynInt32")
	field(INP,"@asyn(read1ADDR,0, 60)MODBUS_DATA")
}
record(ai,"MICE-RF-TUNE-02:READVALU") {
	field(DESC,"Read value")
	field(SCAN,"Passive")
	field(DTYP,"asynInt32")
	field(INP,"@asyn(read1VALU,0,36000)MODBUS_DATA")
}


###############################################################################
### Write functions
###############################################################################
### Unit 1
record(ao,"MICE-RF-TUNE-01:WRITEVALU") {
	field(DESC,"Write open 0%")
	field(SCAN,"Passive")
	field(DTYP,"asynInt32")
	field(VAL, "0x0000")
	field(OUT,"@asynMask(write1VAL,0,16)MODBUS_DATA")
}
record(ao,"MICE-RF-TUNE-01:WRITE000") {
	field(DESC,"Write open 0%")
	field(SCAN,"Passive")
	field(DTYP,"asynInt32")
	field(VAL, "0x0000")
	field(OUT,"@asynMask(write1CLS,0,16)MODBUS_DATA")
}

### Unit 2
record(ao,"MICE-RF-TUNE-02:WRITEVALU") {
	field(DESC,"Write open 0%")
	field(SCAN,"Passive")
	field(DTYP,"asynInt32")
	field(VAL, "0x0000")
	field(OUT,"@asynMask(write2VAL,0,16)MODBUS_DATA")
}
record(ao,"MICE-RF-TUNE-02:WRITE000") {
	field(DESC,"Write open 0%")
	field(SCAN,"Passive")
	field(DTYP,"asynInt32")
	field(VAL, "0x0000")
	field(OUT,"@asynMask(write2CLS,0,16)MODBUS_DATA")
}


===================================================
My problem is that I can successfully write, but I cannot read from the devices.
Whether I read or write, I get messages:
After a successful write:
2012/09/28 10:49:49.964 modbusInterpose::readIt, LRC error
2012/09/28 10:49:49.964 drvModbusAsyn::doModbusIO port write1CLS error calling writeRead, error=, nwrite=9/9, nread=0
2012/09/28 10:49:49.964 MICE-RF-TUNE-01:WRITE000 devAsynInt32 process error 

An attempt to read results in:
2012/09/28 11:37:55.103 MICE-RF-TUNE-01:READVALU devAsynInt32 process read error 

I keep reading the modbus 2.4 Driver Support for Modbus Protocol under EPICS, but I'm clearly
missing something.  I don't understand why I get an error on a successful write, and I don't 
understand why I cannot read at all.  Please help.
Thanks,
Pierrick


===================================================
"Whether you think you can or think you can't, either way, you are correct"
-- Henry Ford

_________________________________________________________________________
Pierrick Hanlet
IIT/Fermilab
+1-630-697-8758 (FNAL)
+1-312-567-5745 (IIT)
+1-630-697-8758/+44-7-948-860-1978 (US/UK mobile)

Replies:
RE: modbus 2.4 Mark Rivers

Navigate by Date:
Prev: Re: Loading modbus waveform record from acalcout record (or caput) Tim Mooney
Next: RE: modbus 2.4 Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
Navigate by Thread:
Prev: RE: problem passing string to aSub record parameter Jim Chen
Next: RE: modbus 2.4 Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·