esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

#%TITLE%
#  PS.MAC 
#%NAME%
#  Treating brakes on primary slits
#%DESCRIPTION%
#  Some very simple macros to open, close and get the state of the
#  brakes of the primary slits. Normally the idxxsetup.mac is
#  configured to set the device name of the primary slit maxe server
#  and release the brakes as soon as spec primary slit application
#
#%EXAMPLE%
#%DL%
#%DT%  pslsetup "ID11/psl1_maxe/1" %DD%
#%DT%   pslstat %DD%
#    Displays if brakes are released or set     
#%DT%   pslopen %DD%
#%XDL%

#%UU%  

#%MDESC%
#    Release the 4 brakes of the primary slits
def pslopen '
for (ii=0;ii<4;ii++) {
  esrf_io(PSLITDEV,"DevOpenBrake",ii)
  }
'

#%UU%  

#%MDESC%
#    Close the 4 brakes of the primary slits
def pslclose '
for (ii=0;ii<4;ii++) {
  esrf_io(PSLITDEV,"DevCloseBrake",ii)
  }
'

#%UU%  

#%MDESC%
#    Display the brake status of the primary slits
def pslstat '
for (ii=0;ii<4;ii++) {
  local status
  if (esrf_io(PSLITDEV,"DevReadBrakeState",ii) != 4) {
    status = "set"
    }
  else {
    status = "released"
    }
  printf ("Primary Slit Brake for motor %s %s\n",motor_mne(PS_MOT_NB[ii]),status)
  }
'

#%UU%  [dev-name]
#%MDESC%

#    Tell the macros the device name of the primary slit maxe device
#    server. 
def pslsetup '{
global PSLITDEV
short array PS_MOT_NB[4]
if (!$#) {
  PSLITDEV = getval ("Primary slit device name",PSLITDEV)
  }
else {
  PSLITDEV = "$1"
  }
PS_MOT_NB[0] = motor_num(pr)
PS_MOT_NB[1] = motor_num(pl)
PS_MOT_NB[2] = motor_num(pd)
PS_MOT_NB[3] = motor_num(pu)
}'
#%MACROS%
#%IMACROS%
#%ATTENTION%
#  As spec and the X11 graphical primary slit application use different
#  versions of maxe for the moment, the brake state will not change if 
#  the graphical application sets or releases the brakes.
#  If you release the brakes from within spec however the brakes will
#  actually be released and the status will be correct.
#%DEPENDENCIES%
#  The file ps.mac has to be read in           !done by: startup script
#%AUTHOR%
#  PS.MAC - JK 11.93
#  $Revision: 3.1 $ / $Date: 2001/03/13 18:30:59 $
#%TOC%