esrf

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

#%TITLE%
#  NPS.MAC 
#%NAME%
#  NEW Treating brakes on primary slits,for LINUX MaxeVpap taco server
#
#%CATEGORY% Positioning
#
#%DESCRIPTION%
#  Some very simple macros to open, close and get the state of the
#  brakes of the primary slits. 
# Has to be used instead of ps.mac if you use Linux MaxeVpapds server to
# control the Primary slits motors.
#
#%EXAMPLE%
#%DL%
#%DT%  pslsetup "ID09/Relay_0/00_" pu 89 pd 91 pr 93 pl 95 %DD%
#%DT%   pslstat %DD%
#    Displays if brakes are released or set     
#%DT%   pslopen %DD%
#%XDL%
#
#%END%

#%UU%  

#%MDESC%
#    Release the 4 brakes of the primary slits
def pslopen '
local ii dev
for (ii=0;ii<4;ii++) {
  esrf_io(dev=PSLITDEV""PS_MOT_NB[ii][1],"DevOpen")
  }
'

#%UU%  

#%MDESC%
#    Close the 4 brakes of the primary slits
def pslclose '
local ii 
for (ii=0;ii<4;ii++) {
  esrf_io(dev=PSLITDEV""PS_MOT_NB[ii][1],"DevClose")
  }
'

#%UU%  

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

#%UU%  [Relay Root dev-name] [pu-mne] [relay-channel] [pd-mne] [relay-channel]
# [pr-mne]  [relay-number] [pr-mne]  [relay-number]
#%MDESC%

#    Tell the macros the device name of the primary slit maxe device
#    server. 
def pslsetup '{
global PSLITDEV
short array PS_MOT_NB[4][2]
if (!$#) {
  print "usage pslsetup Relay Root dev-name] [pu-mne] [relay-channel] [pd-mne] \
  [relay-channel] [pr-mne]  [relay-number] [pr-mne]  [relay-number]"
  exit
}

PSLITDEV = "$1"
  
PS_MOT_NB[0][0] = motor_num("$2")
PS_MOT_NB[1][0] = motor_num("$4")
PS_MOT_NB[2][0] = motor_num("$6")
PS_MOT_NB[3][0] = motor_num("$8")
PS_MOT_NB[0][1] = $3
PS_MOT_NB[1][1] = $5
PS_MOT_NB[2][1] = $7
PS_MOT_NB[3][1] = $9
}'
#%MACROS%
#%IMACROS%
#%DEPENDENCIES%
#  The file nps.mac has to be read in           !done by: startup script
#%AUTHOR%
#  NPS.MAC - L.Claustre (BLISS)
#  $Revision: 1.3 $ / $Date: 2008/08/12 14:51:32 $
#%TOC%