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  <20152016  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  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Example asyn device support for rs-232 hardware with unsolicited messages (without using stream-device)
From: Andrew Gomella <[email protected]>
To: Mark Rivers <[email protected]>, "[email protected] Talk" <[email protected]>
Date: Thu, 12 Feb 2015 18:49:27 -0500
Your example code and videos are great.

I'm curious about your (and/or tech-talk's) advice on how to approach the various peculiarities of the current device I am working with (previously mentioned on tech-talk here: http://www.aps.anl.gov/epics/tech-talk/2015/msg00001.php).

The device has these attributes:
1. typical command/reply + unsolicited messages (unsolicited messages are much higher priority than the command/reply ones) I really want to get unsolicited messages processed ASAP. 

2. all unsolicited commands require acknowledgement (the sooner the better, otherwise device will hang)

3. sometimes messages from device are space delimited, though usually they come one at a time

I was thinking of taking the following approach, but was wondering if my logic and design choices are reasonable:

Have a while(1) loop thread (setup just like the PollerThread in the XPS example except read only) always reading input. (similar to what you suggested back in 2010 http://www.aps.anl.gov/epics/tech-talk/2010/msg01203.php)

If spaces are found in the input, break up the messages into an array and use a for loop to process them one by one with a separate function which is just a series of if/else statements to match input. 

In the separate function: If input matches an unsolicited message: send reply back to the machine acknowledging it and setParam according to the message. Otherwise just run relevant setparam function according to the received message.

Have all other "writes" to device occur in the main thread and don't worry about reading because the reading thread will catch the response. 

Thanks for your help again.

-Andrew
 


On Wed, Feb 11, 2015 at 10:05 PM, Mark Rivers <[email protected]> wrote:
Hi Andrew,

I recently taught a class on asyn where we did a hands-on exercise writing a driver that communicates with a Newport XPS using the drvAsynIPPort as the underlying transport.

The handout is here:
http://www.aps.anl.gov/epics/docs/APS2015/10-AsynDriver-Lab.pdf

A tar file with the example driver fully worked out, and a template driver as an exercise for the students can be found here:

http://cars.uchicago.edu/gsecars/data/epics/XPSExample.tgz

The lecture slides and YouTube videos of the classes are here:

http://www.aps.anl.gov/epics/docs/APS2015.php

Let me know if you have questions.

Mark


________________________________
From: [email protected] [[email protected]] on behalf of Andrew Gomella [[email protected]]
Sent: Wednesday, February 11, 2015 7:52 PM
To: [email protected] Talk
Subject: Example asyn device support for rs-232 hardware with unsolicited messages (without using stream-device)

Hi,

I tried searching the on the APS list of hardware here (http://www.aps.anl.gov/epics/modules/bus.php#RS%2d232%20%28Asyn%29) but I am having trouble finding an application that fits the above description.

I would like to use it as a template to write support for a tricky device I am working with (which works with stream device 95% of the time but produces some occasional problems due to unpredictable ordering of output messages as well as grouping unsolicited messages with solicited output).

If anyone could  point an example application that does not use stream device that would be great.

Thanks,

Andrew




Replies:
RE: Example asyn device support for rs-232 hardware with unsolicited messages (without using stream-device) Mark Rivers
References:
Example asyn device support for rs-232 hardware with unsolicited messages (without using stream-device) Andrew Gomella
RE: Example asyn device support for rs-232 hardware with unsolicited messages (without using stream-device) Mark Rivers

Navigate by Date:
Prev: RE: EPICS Collaboration Meeting May 2014 Hoff, Larry
Next: Using the EPICS Build/Make system to build kernel modules for linux Williams Jr., Ernest L.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Example asyn device support for rs-232 hardware with unsolicited messages (without using stream-device) Mark Rivers
Next: RE: Example asyn device support for rs-232 hardware with unsolicited messages (without using stream-device) Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·