# $Id: sphinx_shutter.mac 907 2012-06-11 22:53:33Z jemian $ # from Christian Schlepuetz (formatted for RoboDoc) #============================================================================== #% # common/shutter # ============== # # NAME # shutter.mac # # SUMMARY # Commands to control a fast photon shutter. # # DESCRIPTION # The macro causes the fast photon shutter to be opened immediately prior to # any count command, and closed again upon its completion. A configurable # delay time assures that the shutter is fully open before issuing the # count command. # # The photon shutter is controlled via an EPICS binary output channel, and # the shutter status is optionally monitored via a binary input channel (in # which case the delay time is not used, but the monitor signal is used to # check for completion of the opening process). # # AUTHOR # Christian M. Schlepuetz (CS, cschlep) # # CREATION DATE # 2004/11/06 # # COPYRIGHT # Copyright 2006-2011 by the above authors (see AUTHOR/AUTHORS) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see http://www.gnu.org/licenses/. # # VERSION:: # # $. Date: 2010-11-04 19:06:06 -0400 (Thu, 04 Nov 2010) $ # $. Author: cschlep $ # $. URL: file:///data/svn/software/spec/trunk/common/shutter.mac $ # $. Revision: 17 $ # # DEPENDENCIES # Chained macro definitions affected by this macro: # - user_precount # - user_getcounts # - cleanup_always # # HISTORY # 2004/11/06 (CS): # # - modified the first original version to comply with naming and format # conventions # - implemented help-file support and wrote help texts. # 2010/03/30 (CS): # - added the following global variables to make macro more easily portable:: # # SHUTTER_CONTROL_PV # EPICS PV name for the shutter control (bo) # SHUTTER_CONTROL_OPEN # EPICS control value for open shutter # SHUTTER_CONTROL_CLOSED # EPICS control value for closed shutter # SHUTTER_STATUS_PV # EPICE PV name for the shutter status (bi) # SHUTTER_STATUS_OPEN # EPICS status value for open shutter # SHUTTER_STATUS_CLOSED # EPICS status value for closed shutter # SHUTTER_IS_ON # flag for automatic shutter control # SHUTTER_SLEEP_TIME # SPEC sleep time after opening shutter # # 2010/07/23 (CS): # - added SVN keywords (replacing CVS keywords) # # 2011/12/19 (CS): # - reformatted code documentation to work with ROBODoc # - added shutter_setup with following internal macros: # # * _shutter_print_setup # * _shutter_set_option # * _clear_screen # # - replaced SHUTTER_STATUS* with SHUTTER_MONITOR* # - replaced global variables _OPEN with _OPEN_VAL and # _CLOSED with _CLOSED_VAL # #============================================================================== #============================================================================== # Define some global variables # ---------------------------- global SHUTTER_MAC SHUTTER_MAC = DOFILE # EPICS PV of the binary output which controls the shutter # global SHUTTER_CONTROL_PV SHUTTER_CONTROL_PV = "X04SA-ES3-SC:FPS" global SHUTTER_CONTROL_OPEN_VAL SHUTTER_CONTROL_OPEN_VAL = "On" global SHUTTER_CONTROL_CLOSED_VAL SHUTTER_CONTROL_CLOSED_VAL = "Off" # EPICS PV of the binary input which monitors the state of the shutter # if SHUTTER_MONITOR_PV = "", no monitoring is performed # global SHUTTER_MONITOR_PV SHUTTER_MONITOR_PV = "" global SHUTTER_MONITOR_OPEN_VAL SHUTTER_MONITOR_OPEN_VAL = "open" global SHUTTER_MONITOR_CLOSED_VAL SHUTTER_MONITOR_CLOSED_VAL = "closed" global SHUTTER_IS_ON SHUTTER_IS_ON = 0 global SHUTTER_SLEEP_TIME SHUTTER_SLEEP_TIME = 0.1 #============================================================================== # This macro file contains the following commands: #============================================================================== #------------------------------------------------------------------------------ #% # shutter/sh_help, shutter_help # ============================= # # Displays the shutter help text. # # usage:: # # > sh_help # # .. note:: # The help text is generated by simply displaying the text file # shutter_mac.txt, which should reside in the same directory as shutter.mac. # If the file does not exist, a generic help text is shown. def shutter_help 'sh_help' def sh_help '{ # ======= unix (sprintf ("dirname %s", SHUTTER_MAC), _1) ll = length (_1) if (substr (_1, ll, 1) == "\n") _1 = substr (_1, 1, (ll - 1)) file = sprintf ("%s/shutter_mac.txt", _1) if (file_info (file, "-e")) { unix (sprintf ("cat %s", file)) } else { printf("\n Macros available in file shutter.mac:\n") printf( " ===========\n") printf("\n") printf(" sh_help - creates this help text\n") printf(" shop - opens the fast shutter\n") printf(" shcl - closes the fast shutter\n") printf(" shon - activate automatic shutter opening and closing\n") printf(" shoff - turn automatic shutter opening and closing off\n") printf(" sh_status - display whether the shutter is open or closed\n") printf(" sh_show - display shutter configuration and status\n") printf(" sh_setup - modify the shutter configuration\n") printf("\n") } }' # there is more in shutter.mac #============================================================================== # End of $Id: sphinx_shutter.mac 907 2012-06-11 22:53:33Z jemian $ #==============================================================================