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: Zenon Szalata <[email protected]>
To: Mark Rivers <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Sat, 18 May 2013 11:55:43 -0700
Hi Mark,
This is just a short follow up on my last email.
After looking at my Pico driver implementation and digging a bit more into drvModbusAsyn.c file, it seems to me that you might need to expose the data structures that are created for each port and then I should be able to call pasynOctetSyncIO routines as needed. Is that approximately what you had in mind?
Thanks for helping me with this,
Zen

P.S. At this point I have a reasonably well working implementation, all in a collection of records in a database, about 1000 of them. The only problem is that one has to pay attention to reads and writes to the hidden registers as these sometimes go wrong. With that said, some people here are getting somewhat excited, because Beckhoff offers a very inexpensive hardware solution compared to XPS. And the XPS controllers are not problem free.


On 05/18/13 08:45, Mark Rivers wrote:
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 Mark Rivers
References:
More on Modbus Zenon Szalata
RE: More on Modbus Mark Rivers

Navigate by Date:
Prev: Re: More on Modbus Zenon Szalata
Next: RE: More on Modbus Mark Rivers
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: RE: More on Modbus Mark Rivers
Next: RE: More on Modbus Mark Rivers
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 ·