EPICS Controls 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  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  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: modbus 2.4
From: Mark Rivers <[email protected]>
To: "'Pierrick M Hanlet'" <[email protected]>, "[email protected]" <[email protected]>
Date: Fri, 28 Sep 2012 16:58:49 +0000
Hi Pierrick,

Some questions:

- Are sure this device talks Modbus ASCII, not Modbus RTU?

- I don't understand the difference between port wirte1VAL and write1CLS that you have created.  They are created identically, i.e. they write to the same address, so why did you create 2 ports?
drvModbusAsynConfigure("write1VAL","RFTunerPort",0x01,0x10,0x0031,1,0,0,"ProportionAir1")
drvModbusAsynConfigure("write1CLS","RFTunerPort",0x01,0x10,0x0031,1,0,0,"ProportionAir1")

- Since you are writing a single register why did you use Modbus function code 0x10 (=16=write multiple registers), rather than function code 6 (write single register)?

- What is the evidence that the write is successful?

Write operations read a response from the Modbus server.  In your case you are getting the following:
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

That implies it is getting no response.  But to be sure you should turn on asynTrace on the underlying RS-485 port:

asynSetTraceIOMask("RFTunerPort",0,4)
asynSetTraceMask("RFTunerPort",0,255)

That will show you what is being written and read by the underlying serial port, and hopefully help to pin down the problem.

Mark


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Pierrick M Hanlet
Sent: Friday, September 28, 2012 11:41 AM
To: [email protected]
Subject: modbus 2.4

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 Pierrick M Hanlet
References:
modbus 2.4 Pierrick M Hanlet

Navigate by Date:
Prev: modbus 2.4 Pierrick M Hanlet
Next: RE: modbus 2.4 Pierrick M Hanlet
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: modbus 2.4 Pierrick M Hanlet
Next: RE: modbus 2.4 Pierrick M Hanlet
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·