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  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024  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  <20232024 
<== Date ==> <== Thread ==>

Subject: Re: Help getting modbus module started
From: Christian Pauly via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Wed, 15 Feb 2023 01:56:33 +0100
Great, thanks for the quick help !
Now it works, the ioc starts and is running.

But now i am stuck with defining a record using the modbus interface.

As a simpe start, I would like to read a single word (int16) from a given address 0x2103 of master device with id=1, using modbus read function type 3.
the relevant part of my st.cmd at the moment looks like this:

drvAsynSerialPortConfigure("RS485", "/dev/ttyUSB0", 0, 0, 0)
asynSetOption("RS485",0,"baud","9600")
asynSetOption("RS485",0,"parity","none")
asynSetOption("RS485",0,"bits","7")
asynSetOption("RS485",0,"stop","2")
asynOctetSetOutputEos("RS485",0,"\r\n")
asynOctetSetInputEos("RS485",0,"\r\n")
modbusInterposeConfig("RS485",2,1000,5)
drvModbusAsynConfigure(IN_int,"RS485",1,3,-1,1,UINT16,1000,0)
asynSetTraceIOMask("RS485",0,4)

## Load record instances
dbLoadTemplate "FUrecords.db"

But how do i have to define the ai(?)-record in FUrecords.db now, to read a single word from the given address 0x2103 using the IN_int function as defined above ? without using template- and substitution files like in all examples i found so far ?? (for sure that is the more clever way, but before i try to understand that part i would like to have a running example first)

Thanks again for any help !

Christian





On 2/14/23 20:23, Pierrick M Hanlet via Tech-talk wrote:
I almost forgot, you'll also need to add modbus to your
$TOP/configure/RELEASE file (assuming that you have the modbus module).
This may not be precisely worded, but when adding a module, you need to
define its path in $TOP/configure/RELEASE and then
add the modules (lib / dbd) to the $TOP/xxxApp/src/Makefile.
Cheers,
Pierrick



On 2/14/23 13:02, Pierrick M Hanlet via Tech-talk wrote:
Hi Christian,
You will also need to add some things to your xxxApp/src/Makefile:
- xxx_DBD+=modbusSupport.dbd
- xxx_DBD+=drvAsynSerialPort.dbd
- xxx_LIBS+=modbus

I think that this should do it for you.
Good luck,
Pierrick


On 2/14/23 11:38, Christian Pauly via Tech-talk wrote:
Hi folks

I am trying hard to set up a Raspberry running an EPICS IOC for a
Delta VFD motor driver / frequency inverter. The device is controlled
via modbus, using a large set of individual 16bit integer read/write
registers for configuration, and few more registers for control.
At the moment it is configured to talk Modbus ASCII via RS485, and
with a simple Python program using minimalmodbus-lib i can talk to the
controller.

Now i started with a fresh EPICS 3.15.7 base, (in ~/EPICS/base) and
installed ASYN-R4-43 (~/EPICS/modules/asyn-R4-43) and modbus
(~/EPICS/modules/modbus_R3-2).
I initiated a new application ~/EPICS/projects/FUcontrol,
ran "makeBaseApp.pl -t example FUcontrol", "makeBaseApp.pl -i -t
example FUcontrol" - and thats basically it.

And now i am stuck how to include modbus (includes / libs / dbd files)
into my exampleApp.

I kind of managed to include ASYN already by adding
    ASYN=... to the RELEASE file

and to the Makefile:
    FUcontrol_LIBS += asyn

In my ioc startup st.cmd i can run the commands
drvAsynSerialPortConfigure("RS485", "/dev/ttyUSB0", 0, 0, 0)
to configure the interface.

But if i add
modbusInterposeConfig("RS485",2,1000,0)
i get an error on startup claiming that modnusinterposeconfig can not
be found.


So:
Is there any simple step-by-step instructions how to add modbus to an
existing ioc application ?
I could not find anything "simple" in the documentation. I saw the
examples which come with modbus, but all these already look quite
complicated to me...

Or any good advise on how to continue from here ?

Thanks for any help !

Christian









Replies:
Re: Help getting modbus module started Mark Rivers via Tech-talk
References:
Help getting modbus module started Christian Pauly via Tech-talk
Re: Help getting modbus module started Pierrick M Hanlet via Tech-talk
Re: Help getting modbus module started Pierrick M Hanlet via Tech-talk

Navigate by Date:
Prev: RE: Help getting modbus module started Mark Rivers via Tech-talk
Next: Re: Help getting modbus module started Mark Rivers via Tech-talk
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  <20232024 
Navigate by Thread:
Prev: Re: Help getting modbus module started Pierrick M Hanlet via Tech-talk
Next: Re: Help getting modbus module started Mark Rivers via Tech-talk
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  <20232024 
ANJ, 15 Feb 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·