- Driver for the Risoe Temperature controller
- HM is now working - display code added
This commit is contained in:
95
sans2com.tcl
95
sans2com.tcl
@@ -21,6 +21,11 @@ if { [info exists sansinit] == 0 } {
|
||||
Publish count User
|
||||
Publish Repeat User
|
||||
Publish storedata User
|
||||
Publish disto Spy
|
||||
Publish statusinfo Spy
|
||||
Publish displaycontrol User
|
||||
Publish displayunits User
|
||||
Publish setdispar User
|
||||
}
|
||||
#======================== general useful stuff ======================
|
||||
proc SplitReply { text } {
|
||||
@@ -135,16 +140,13 @@ proc count { {mode NULL } { preset NULL } } {
|
||||
set b [banana CountMode]
|
||||
set bb [SplitReply $b]
|
||||
set tt [sicstime]
|
||||
set sn [sample]
|
||||
set sn [SplitReply [sample]]
|
||||
starttime [sicstime]
|
||||
ClientPut [format " Starting counting in %s mode with a preset of %s" \
|
||||
$bb $aa ]
|
||||
ClientPut [format "Count started at %s" $tt]
|
||||
ClientPut [format " sample name: %s" $sn]
|
||||
#------- count
|
||||
banana InitVal 0
|
||||
wait 1
|
||||
set ret [catch {Success} msg]
|
||||
banana count
|
||||
set ret [catch {Success} msg]
|
||||
#------- StoreData
|
||||
@@ -172,9 +174,11 @@ proc writeBeforeSample args {
|
||||
nxscript puttext sname SINQ, Paul Scherrer Institut
|
||||
nxscript puttext stype Continuous flux spallation source
|
||||
nxscript puttext vname Dornier velocity selector
|
||||
# writeFloatVar vrot velo
|
||||
# writeFloatVar vtilt tilt
|
||||
# writeFloatvar vlambda lambda
|
||||
set res [nvs list]
|
||||
set l [split $res "\n"]
|
||||
nxscript putfloat vrot [SplitReply [lindex $l 0]]
|
||||
writeFloatVar vtilt tilt
|
||||
writeFloatvar vlambda lambda
|
||||
writeFloatVar colli collimator
|
||||
# writeFloatVar atti attenuator
|
||||
}
|
||||
@@ -255,7 +259,76 @@ proc storedata args {
|
||||
|
||||
nxscript close
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#========================= laser distance reading ========================
|
||||
proc disto args {
|
||||
global distoCON
|
||||
gpib sendwithterm $distoCON a 13
|
||||
gpib readtillterm $distoCON 10
|
||||
gpib sendwithterm $distoCON g 13
|
||||
set result [gpib readtillterm $distoCON 10]
|
||||
set l [split $result " +" ]
|
||||
return [string trim [lindex $l 1] 0]
|
||||
}
|
||||
#========================= helper function for status display ============
|
||||
proc statusinfo {} {
|
||||
append result "SICS = " [SplitReply [status]] " \n"
|
||||
append result [title] " \n"
|
||||
append result [sample] " \n"
|
||||
append result [user] " \n"
|
||||
set tst [nvs list]
|
||||
set l [split $tst "\n"]
|
||||
append result "Velocity selector rotation = " \
|
||||
[SplitReply [lindex $l 0]] " \n"
|
||||
append result "lambda = " [SplitReply [lambda]] " \n"
|
||||
append result "Collimation length = " [SplitReply [collimator]] " \n"
|
||||
append result "filenumber = " [SplitReply [sicsdatanumber]] " \n"
|
||||
return $result
|
||||
}
|
||||
#============= scripts for controlling the ECB display unit ============
|
||||
proc disloadpar {unit offset val} {
|
||||
ecb1 func 166 0 [expr $unit -1] $offset $val
|
||||
}
|
||||
#-----------------------------------------------------------------------
|
||||
proc startdisplay {} {
|
||||
ecb1 func 128 0 0 0 1
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
proc stopdisplay {} {
|
||||
ecb1 func 129 0 0 0 0
|
||||
}
|
||||
#-----------------------------------------------------------------------
|
||||
proc setdispar {unit name key parnum} {
|
||||
switch $key {
|
||||
timer {set type 1}
|
||||
scaler {set type 2}
|
||||
ratemeter {set type 4}
|
||||
motor {set type 3}
|
||||
encoder {set type 5}
|
||||
default {
|
||||
error "Unknown parameter key"
|
||||
}
|
||||
}
|
||||
stopdisplay
|
||||
disloadpar $unit 0 [ecb1 toint [string index $name 0]]
|
||||
disloadpar $unit 1 [ecb1 toint [string index $name 1]]
|
||||
disloadpar $unit 2 [ecb1 toint [string index $name 2]]
|
||||
disloadpar $unit 3 $parnum
|
||||
disloadpar $unit 4 $type
|
||||
startdisplay
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
proc cleardisplay {} {
|
||||
ecb1 func 131 0 0 0 0
|
||||
}
|
||||
#-------------------------------------------------------------------------
|
||||
proc defdisplay { num} {
|
||||
ecb1 func 166 1 $num 0 0
|
||||
}
|
||||
#------------------------------------------------------------------------
|
||||
proc displayunits { u1 u2 u3 u4} {
|
||||
ecb1 func 130 $u1 $u2 $u3 $u4
|
||||
}
|
||||
#-----------------------------------------------------------------------
|
||||
proc displaycontrol {command} {
|
||||
ecb1 func 170 0 0 $command 0
|
||||
}
|
||||
Reference in New Issue
Block a user