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]>
Cc: "[email protected]" <[email protected]>
Date: Sat, 18 May 2013 23:42:02 +0000
Hi Zen,

To more directly answer your points in this message, recall that all asyn port drivers implement one or more asyn interfaces.  Thus, although they don't export global functions, they do have a function table of those interface functions (int32->read, etc.) which are accessed via the pasynManager functions (findInterface, etc.)

Mark

________________________________________
From: Zenon Szalata [[email protected]]
Sent: Saturday, May 18, 2013 11:42 AM
To: Mark Rivers
Cc: [email protected]
Subject: Re: More on Modbus

Hi Mark,
I would like to try your suggestion.  You may recall, that I have
written a C++ device driver for the New Focus Pico motor (mostly for
fun), using the asynMotorController and asynMotorAxis base classes. So I
think this aspect of the project should not be much of a problem.

I assume that the IO to hardware would be done via the modbus support
module.
I see that there is only one external function in the drvModbusAsyn.c file,
drvModbusAsynConfigure.  I see the same thing in the modbusInterpose.c
file.  I am assuming that my driver would link to the modbus library
(libmodbus.a).  I have not yes figured out how the register read and
write is done in the modbus support module.
Anyway, could you sketch out how my driver would be integrated with the
modbus support module and how would the IO be done?
Thanks Mark,
Zen

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



References:
More on Modbus Zenon Szalata
RE: More on Modbus Mark Rivers
Re: More on Modbus Zenon Szalata

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