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  <20092010  2011  2012  2013  2014  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  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: checking for change in value in device support function
From: Patrick Thomas <[email protected]>
To: [email protected]
Date: Fri, 24 Jul 2009 05:22:11 -0700
Hi,
I would like to try to implement the following pseudo code as a device support function for a motor. Basically, when called, it turns the motor on, checks to see if the motor was on, tells the motor to move to a position, waits for it to finish or time out, turns the motor off, checks to see if the motor is off, then checks to see if the current position is the one that was requested. The functions that it calls will be provided by driver support. The question I have is that I want it to immediately start moving to a new position if a new value is entered in the associated ao record field, even if the motor is already in motion. Is it possible to check for changes in the value field of the record from this function? Do I need to start this function as a new thread, set PACT to true, and then set it to false at the end of the thread? How would the thread pick up on the fact that the record value field has changed?

Another question I have is, that in driver support, in the init function, I will open up a socket connection and spawn a thread which constantly polls the motor for its status, ie current position, trajectory mode, motion done, etc. This data will be written to a structure which is available to the device support. However, when device support calls other driver support functions which communicate with the motor over the same socket connection, how do I ensure that these don't collide with the functions that are constantly polling?

Thank you,
Patrick

request_move_to_absolute_position( record val field )
{
   motor_on();

   if (read_motor_on != true)
   {
       print error;
       return;
   }

   move_to_absolute_position( record val field );

   while ( (motion_done_status != true) and (timeout != true) ) {
       if ( record val field changes ) {
           move_to_absolute_position( record val field );
           reset timeout;
       }
   }

   motor_off();

   if (read_motor_off != true)
   {
       print error;
   }

   if (read_actual_position() != record val field) {
       print error;
   }

   return;
}


Replies:
RE: checking for change in value in device support function Mark Rivers

Navigate by Date:
Prev: EDM symbols GOURNAY Jean-Francois
Next: RE: checking for change in value in device support function Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: EDM symbols GOURNAY Jean-Francois
Next: RE: checking for change in value in device support function Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 31 Jan 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·