#!/bin/sh #\ exec /site/coda/2.6.2/Linux/bin/wish4.0 -f "$0" ${1+"$@"} # exec /usr/bin/wish -f "$0" ${1+"$@"} # # Remote set delays of Highland v851 VME Pulser # # functions: # v851SetDelay (int chan, UINT32 delay, int xfr, int id) # chan - channel ID 1-6 # delay - delay in Nanoseconds # xfr - transfer flag, 1 = update of the delay # id - number of v851 in a crate # # # SP, 26-Apr-2013 set inp_str [split $argv " "] set inp_N [llength $inp_str] set roc -1 set tmp1 -1 set tmp2 -1 #*** Check input parameters *** set flag 0 if { $inp_N != 3 } { set flag 1 } else { set roc [string tolower [lindex $inp_str 0]] set tmp1 [string tolower [lindex $inp_str 1]] set tmp2 [string tolower [lindex $inp_str 2]] if { ($tmp1 < 1) || ($tmp1 > 6) } { set flag 2 } if { ($tmp2 < 0) || ($tmp2 > 167800000) } { set flag 3 } } #puts "\n flag=$flag; \n inp_N=$inp_N; \n roc=$roc; \n tmp1=$tmp1;" #*** Print help message *** if { $flag != 0 } { puts "\n Usage: v851_set_delay roc chan delay" puts " --------------------------------" puts " Where \"roc\" - name of VME crate" puts " \"chan\" - channel ID 1, 3 or 5" # puts " \"chan\" - channel ID (1-6)" puts " \"delay\" - delay in Nanoseconds (till 167.8 ms)" puts "" exit } #*** Execute function *** set TMP1 [expr $tmp1 + 1] set TMP2 [expr $tmp2 + 40] set exename "v851SetDelay($TMP1,$TMP2,1,0)" set result " error: Can't get result for $exename \n" catch {set result [exec tcpClient $roc $exename]} puts "\n$result" set exename "v851SetDelay($tmp1,$tmp2,1,0)" set result " error: Can't get result for $exename \n" catch {set result [exec tcpClient $roc $exename]} puts "\n$result" exit