esrf

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

#%TITLE% balzer.mac
#%NAME%
#  Macros to read and display balzers
#%CATEGORY% Vacuum, Other hardware
#%PACKAGE% balzer
#%SEARCH% balzersetup
#%DESCRIPTION%
#  This macro set is mainly used to do pressure. measurements
#  (preasure against time) or simply display the temperatures of some   
#  beamline elements in a window.  
#
#  For a more recent version check also gauge.mac
#
#%LINK%macdoc.py?macname=gauge.mac gauge.mac documentation%LINK%
#
#%EXAMPLE%
#%DL%
#%DT%  balzersetup bz1 ID01/pen/31 bz2 ID01/pir/31  %DD%
#    The balzers ID01/pen/31 and ID01/pir/31 will be associated with counters
#    pen31 and pir31 respectively and counting will be done as soon as
#    they are defined in config.     
#%DT%  ct 1 %DD%
#    Will count on those counters, including balzers, defined in
#    config.
#  
#%DT%  balzeroff %DD%
#    Access to balzers will be temporarily forbiden. 
#    Reset this feature with balzeron
#%DT%  balzershow %DD%
#    Will show current configuration
#%XDL%

#%UU%
#%MDESC%
#
def balzersetup '{
     global BALZER_NO BALZER_MNE BALZER_DEV BALZERON

     balzeroff
     if ($#) {
         n = split("$*",params)
         BALZER_NO = n/2 
         for (i=0;i<BALZER_NO;i++) {
            BALZER_MNE[i] = params[i*2]
            BALZER_DEV[i] = params[i*2+1]
         }
     } else {
        BALZER_NO = getval("How many balzers do you want to define",BALZER_NO)
        for (i=0;i<BALZER_NO;i++) {
            BALZER_MNE[i] = getval("\tCounter mnemonic",BALZER_MNE[i])
            BALZER_DEV[i] = getval("\tDevice name",BALZER_DEV[i])
        }
     }
     balzerdef
}'

#%IU%
#%MDESC%
def balzerdef '{
  for (i=0;i<BALZER_NO;i++) {
    cdef("user_getcounts",sprintf("balzer_getcounts %d\n",i),BALZER_MNE[i],0x02)
  }
}'


#%UU%
#%MDESC%
#
def balzershow '{
    
}'

#%UU%
#%MDESC%
#
def balzeron '{
    BALZERON=1
    balzerdef
}'

#%UU%
#%MDESC%
#
def balzeroff '{
    for(i=0;i<BALZER_NO;i++) {
       cdef("","",BALZER_MNE[i],"delete")
    }
    BALZERON=0
}'

#%UU%
#%MDESC%
#
def balzer_getcounts '{
    local ctnum upd_val

    ctnum = cnt_num(BALZER_MNE[$1])
    esrf_io(BALZER_DEV[$1],"DevUpdate",upd_val)
    if (upd_val[0] == 2) 
       S[ctnum] = upd_val[2] * counter_par(ctnum,"scale")
    else {
       printf("Cannot read balzer for counter %s\n",BALZER_MNE[i])
       S[ctnum] = 0
    }
}'

#%MACROS%
#%IMACROS%
#%DEPENDENCIES%
# The file balzer.mac has to be read in         !done by: startup script
#%AUTHOR%
#  BALZER.MAC Vicente Rey. September 1996
#%TOC%