Files
sics/site_ansto/instrument/hipd/config/commands/eulerscan.tcl
Ferdi Franceschini 71b71e262c Added eulerscan.tcl from ics1-wombat
Updated to get in-situ changes to motor configurations (eg monochromator resolvers)
r3072 | ffr | 2011-02-25 19:12:19 +1100 (Fri, 25 Feb 2011) | 2 lines
2012-11-15 17:08:50 +11:00

108 lines
2.7 KiB
Tcl

# Euler cradle scan commands for texture runs
# AJS Dec 2010
# SetHistoSync: sets the histogram to receive $framenum worth of frames on receiving
# TTL pulse in frame sync input. Note: Framebuffer should be set to OFF for long runs
proc SetHistoSync {framenum} {
histmem stop
bat_table -set NO_BAT_ENTRIES $framenum NO_BAT_PERIODS $framenum
bat_table -set NO_REPEAT_ENTRY 1 NO_REPEAT_TABLE 1 NO_EXECUTE_TABLE 1 PERIOD_INDICES { 0 1 }
fat_table -set NOS_PERIODS $framenum
oat_table -set T {0 2200000} NTC 1
histmem loadconf
histmem fsrce EXTERNAL
}
publish SetHistoSync user
# SetHistoNormal: resets the histo for standard operation
proc SetHistoNormal {} {
histmem stop
bat_table -set NO_BAT_ENTRIES 1 NO_BAT_PERIODS 1
bat_table -set NO_REPEAT_ENTRY 0 NO_REPEAT_TABLE 0 NO_EXECUTE_TABLE 0 PERIOD_INDICES { 0}
fat_table -set NOS_PERIODS 1
oat_table -set T {0 2200000} NTC 1
histmem loadconf
histmem fsrce INTERNAL
proc ::histogram_memory::pre_count {} {}
}
# continous scan for EPHI- the euler cradle phi stage (innermost axis)
# note make sure controller 2 has the PHISCAN code in it
publish SetHistoNormal user
proc EphiCtsScan {start step range steptime} {
# magic number: steps per rotation for phi
set ephisteps -12500
set ephispeed [expr {($step*1.0)/$steptime}]
set numsteps [expr {round($range/$step)}]
# broadcast $omspeed $numsteps
# run ephi to start angle -1 so that first pulse signals as ephi crosses 0 angle
# at correct velocity
ephi accel 1
ephi decel 1
ephi speed 3
drive ephi [expr {$start-1}]
ephi speed $ephispeed
ephi accel [expr {$ephispeed*1.2}]
# now set ephi parameters to galil and clear the bit
set scval [expr {($range+2.2)*$ephisteps}]
set stval [expr {$ephisteps * $step}]
broadcast $scval $stval
som send CTLEN=$scval
som send CTSTEP=$stval
# som send OMN = [expr {$numsteps+1}]
som send CB5
proc ::histogram_memory::pre_count {} {
ephi send "XQ #EPHSCAN,2"
}
histmem mode unlimited
histmem start block
newfile HISTOPERIOD_XY
for {set i 0} {$i<$numsteps} {incr i} {save $i}
ephi speed 1
# this we needed when it didn't work properly
# proc ::histogram_memory::pre_count {} {}
# ephi send SHC
# ephi send SPC=25000
# ephi send BCG
# wait 3
# ephi send "XQ #THREAD0,0"
# wait 3
# ephi reset
}
publish EphiCtsScan user
proc EulerCtsScan {range step steptime} {
set numsteps [expr {round($range/$step)}]
SetHistoSync $numsteps
foreach chi {0 15 30 45 60 75 90} {
drive echi $chi
EphiCtsScan [expr {-$range/2}] $step $range $steptime
}
# SetHistoNormal
}
publish EulerCtsScan user
proc KillEphi {} {
ephi send HX2
ephi send STC
ephi reset
}