############################################################################### # # Macros for setting up and ascanning epics process variables # # # # Macros: # # pvconfig - envokes CDE editor to set up PVs. Must enter Name, # mnemonic, PV value (.VAL), PV readback (.RBV), and # PV done moving flag (.DMOV?) # # pvascan - a scan of an epics PV in absolute units. # # pvdscan - PV lineup scan (relative units). # # pvlup - same as pvdscan. # # pvmv - move a PV to the given value. # # pvmvr - move a PV to a position relative to the current position. # # pvwa - Displays current position of all configured PVs # # # Modification History: # # # 11/17/99 J. Lang Fixed bug in header (no spaces # between pv labels). Added pvmv command to move # a pv. # 12/14/99 D. Wermeille Start implementing option to actually # move the gap and/or the taper in pvmv. # Fixed bug when scanning (position read before moving). # 12/21/99 D. Wermeille Finish implementing option to move # and wait while moving gap and taper. # 01/07/00 D. Wermeille Fixed bug in moving gap and taper # (prompt not coming back when move done). # Add check moving option when scanning gap and taper. # Comment out NPVS=0 at the begining of file. # Make it look more like SPEC by writing _pvascan, # _pvcheck (check PV name), pvdscan_cleanup, ... # Added pvlup, pvdscan and pvmvr # 02/15/00 D. Wermeille Add delay for gap and taper to see # if this solve the prompt and scan problem # 05/02/01 hp macros try to run pvdefine before asking the operator # to run pvconfig # # ############################################################################## global PV_file PV_file = "/usr/local/spec/lib/pvfile" global NPVS #NPVS = 0 global pv_name[] global pv_mne[] global pv_val[] global pv_rbv[] global pv_dmov[] def pvconfig ' wait(-1) user_waitall sync #Insert to check if file exists (and write permission) here unix(sprintf("/usr/dt/bin/dtpad %s",PV_file)) pvdefine ' def pvdefine ' local ff if (getline(PV_file,"open") == 0) { for (ff = "#"; ff == "#"; ) { PVline = getline(PV_file) ff = substr(PVline,0,1) } for (jj = 0; PVline != -1 && PVline != "\n"; ++jj){ local tmp[] split(PVline,tmp," ") pv_name[jj] = tmp[0] pv_mne[jj] = tmp[1] pv_val[jj] = tmp[2] pv_rbv[jj] = tmp[3] pv_dmov[jj] = tmp[4] tmpstr = sprintf("global %s\n%s = %i\n",tmp[1],tmp[1],jj) fprintf("tmp_mne","%s",tmpstr) PVline = getline(PV_file) } NPVS=jj fprintf("tmp_mne","u /bin/rm tmp_mne") } p "Configuring PVs" close("tmp_mne") qdofile("tmp_mne") ' def pvwa ' local i, j, k, s[] waitmove onp if (NPVS == 0) { pvdefine } if (NPVS != 0 ) { printf("\nCurrent PV Positions \n") { for (i=0; i