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

Subject: RE: More on Modbus
From: Mark Rivers <[email protected]>
To: Zenon Szalata <[email protected]>, "[email protected]" <[email protected]>
Date: Sat, 18 May 2013 15:45:28 +0000
Hi Zen,

Hi Zen,

I think I see a solution that should allow you to stop the poller thread when you want to access the same Modbus addresses in another thread.  The solution is to have the poller thread take the asyn port driver lock (pasynManager->lockPort()) for its operation loop.  Your other thread can then also lock the port, which will block the poller thread while you do a sequence of write and read operations.  This will work fine if your motor code is written as a C/C++ driver.  But if it is just a collection of records in a database I'm not sure how to do it.

Since the problematic Beckhoff devices are motor controllers, you could write a real driver in C++ using the asynMotorController and asynMotorAxis base classes, which are themselves derived from asynPortDriver.  There are quite a few examples of relatively simple drivers using that model in the synApps motor module now.  Such drivers are normally used with the synApps motor record, but this is NOT required.  Since the driver uses standard asyn interfaces it is possible to just use standard records to move the motor, control the velocity, read the status, etc.  You lose the "state machine" aspect of the motor record (backlash correction, retries, etc.).  But for a simple controller the standard records may be fine.  In your C++ driver you will then call lockPort() for the underlying Modbus driver when needed.

I can make the appropriate minor change to the Modbus driver for you to test if this seems like a reasonable approach to you.

Mark

________________________________________
From: Zenon Szalata [[email protected]]
Sent: Friday, May 17, 2013 4:39 PM
To: Mark Rivers; [email protected]
Subject: More on Modbus

Hi Mark,
Some of what I wrote in my previous email is no longer relevant.  I have
since played with controlling the polling timeout to reduce the
interference between the reads done in the polling thread and the
write-reads that I am attempting from my rather complicated set of EPICS
records.  I have reached a conclusion, hopefully correct, that what I
really need is a Modbus device driver that would give me a full control
when and in which order register read and write operations are performed.
Is this possible with the existing Modbus support module?
I am thinking that it would be very nice to have a C++ base class like
asynPortDriver, or perhaps a subclass of asynPortDriver, which would
implement all the details of Modbus protocol and basic IO.
Have you thought of writing something like that?
Do you think such a class would be useful?
Beckhoff are the only modbus devices that I have written software for
and the stepper motor controllers are the only devices for which I find
your Modbus support module too limited. For that reason I am a bit
hesitant to start a new project, that is to write the C++ class.  Could
you offer your insight on this?
Thanks in advance,
Zen


Replies:
Re: More on Modbus Zenon Szalata
Re: More on Modbus Zenon Szalata
References:
More on Modbus Zenon Szalata

Navigate by Date:
Prev: Re: Relative time in XY graph Ralph Lange
Next: Re: More on Modbus Zenon Szalata
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: More on Modbus Zenon Szalata
Next: Re: More on Modbus Zenon Szalata
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·