Create fake DMC2280 controllers.
r1138 | ffr | 2006-10-13 09:06:05 +1000 (Fri, 13 Oct 2006) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
fdd815680f
commit
572b77fac2
40
site_ansto/instrument/TEST_SICS/fakeDMC/dmcParse.tcl
Normal file
40
site_ansto/instrument/TEST_SICS/fakeDMC/dmcParse.tcl
Normal file
@@ -0,0 +1,40 @@
|
||||
# $Revision: 1.1 $
|
||||
# $Date: 2006-10-12 23:06:05 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by: $Author: ffr $
|
||||
|
||||
# Parses a subset of DMC2280 commands and returns the corresponding command
|
||||
# which is defined in dmc2280Server.tcl
|
||||
|
||||
# dmc2280 has two letter commands <CM> as follows
|
||||
#parses CM exp, _CM<axis,num>, {TP,TD}<axis>, CM<axis>=exp, CM<axis>, CM
|
||||
# axis=ABCDEFGH, num=01234567
|
||||
proc parse {cmdst args} {
|
||||
# CM exp, handles MG
|
||||
if {[string length $args] > 0} {return "$cmdst $args"}
|
||||
|
||||
# _CM<axis,num>, {TP,TD}<axis> get an axis property or position
|
||||
set num [scan $cmdst {_%2s%1[ABCDEFGH0-7]} cmd an];
|
||||
if {$num == 2} {return "dmget $cmd $an"}
|
||||
set num [scan $cmdst {%2s%1[ABCDEFGH]} cmd axis];
|
||||
if {$num == 2 && [string first $cmd "TD TP"] != -1} {
|
||||
return "dmget $cmd $axis";
|
||||
}
|
||||
|
||||
# CM<axis>=exp
|
||||
# Try
|
||||
# set line "DPB=(_TPB - 7818915)*(25000/8192) + 0"
|
||||
# parse $line
|
||||
set cmdlst [split $cmdst =];
|
||||
if {[llength $cmdlst] == 2} {
|
||||
set num [scan [lindex $cmdlst 0] {%2s%1[ABCDEFGH0-7]} cmd axis];
|
||||
return "dmset $cmd $axis [lindex $cmdlst 1]";
|
||||
}
|
||||
|
||||
# CM<axis>
|
||||
set num [scan $cmdst {%2s%1[ABCDEFGH]} cmd axis];
|
||||
if {$num == 2} {return "dmcall $cmd $axis"}
|
||||
|
||||
return $cmdst;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user