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: Mark Rivers <[email protected]>
To: "'Andrew Gomella'" <[email protected]>, "[email protected] Talk" <[email protected]>
Date: Fri, 13 Feb 2015 00:42:59 +0000

Hi Andrew,

 

That seems like a reasonable way to handle this device.

 

> 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.

 

That assumes that the received message has enough information in it for you to figure out what parameter it corresponds to.

 

For example if a typical command/response was like this you would be out of luck:

 

write: read voltage

read: 1.0

write: read current

read: 2.5

 

But if it is like this then you are OK because the response contains enough information to know what it means:

 

write: read voltage

read: voltage=1.0

write: read current

read: current=2.5

 

I’m assuming your device is like the latter.

 

Mark

 

 

 

From: Andrew Gomella [mailto:[email protected]]
Sent: Thursday, February 12, 2015 5:49 PM
To: Mark Rivers; [email protected] Talk
Subject: Re: Example asyn device support for rs-232 hardware with unsolicited messages (without using stream-device)

 

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

 

 


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
Re: Example asyn device support for rs-232 hardware with unsolicited messages (without using stream-device) Andrew Gomella

Navigate by Date:
Prev: Using the EPICS Build/Make system to build kernel modules for linux Williams Jr., Ernest L.
Next: Re: can run multiple IOCs on single host? JaeRyong Seo
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) Andrew Gomella
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 
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 ·