put things from HAL-9500 muSR instrument into git
This commit is contained in:
104
tcl/drivers/tc400.tcl
Normal file
104
tcl/drivers/tc400.tcl
Normal file
@ -0,0 +1,104 @@
|
||||
namespace eval tc400 {} {
|
||||
}
|
||||
|
||||
proc stdConfig::tc400 {adr} {
|
||||
controller std "\r" 5
|
||||
prop startcmd "0010031202=?101"
|
||||
prop read tc400::read
|
||||
prop write tc400::write
|
||||
|
||||
pollperiod 5 5
|
||||
|
||||
obj "TC400" wr
|
||||
prop par 707
|
||||
prop @adr $adr
|
||||
prop type fix2
|
||||
|
||||
kids "turbo $adr" {
|
||||
node on wr
|
||||
prop par 10
|
||||
prop type bool
|
||||
prop enum 1
|
||||
|
||||
node motor wr
|
||||
prop par 23
|
||||
prop type bool
|
||||
prop enum 1
|
||||
|
||||
node speed rd
|
||||
prop par 309
|
||||
prop type fix0
|
||||
|
||||
node nominalspeed rd
|
||||
prop par 308
|
||||
prop type fix0
|
||||
|
||||
node current rd
|
||||
prop par 310
|
||||
prop type fix2
|
||||
|
||||
node errorcode -text rd
|
||||
prop par 303
|
||||
prop type text
|
||||
|
||||
node ovtempelec rd
|
||||
prop par 304
|
||||
prop type bool
|
||||
|
||||
node ovtemppump rd
|
||||
prop par 305
|
||||
prop type bool
|
||||
|
||||
node temppmpbot rd
|
||||
prop par 330
|
||||
prop type fix0
|
||||
|
||||
node tempbearng rd
|
||||
prop par 342
|
||||
prop type fix0
|
||||
|
||||
node tempmotor rd
|
||||
prop par 346
|
||||
prop type fix0
|
||||
|
||||
}
|
||||
|
||||
return "TC400 turbo pump"
|
||||
}
|
||||
|
||||
proc tc400::addcksum {str} {
|
||||
set cksum 0
|
||||
foreach num [scan $str [string repeat %c [string length $str]]] {
|
||||
incr cksum $num
|
||||
}
|
||||
return "$str[format %3.3d [expr $cksum % 256]]"
|
||||
}
|
||||
|
||||
proc tc400::read {} {
|
||||
sct send [addcksum [format "%3.3d00%3.3d02=?" [sct @adr] [sct par]]]
|
||||
return tc400::update
|
||||
}
|
||||
|
||||
proc tc400::update {} {
|
||||
set end 15
|
||||
set value [string range [sct result] 10 $end]
|
||||
if {![scan $value %d value]} {
|
||||
error "$value"
|
||||
}
|
||||
switch [sct type] {
|
||||
bool { sct update [expr $value != 0] }
|
||||
fix2 { sct update [expr $value * 0.01] }
|
||||
default { sct update $value }
|
||||
}
|
||||
return idle
|
||||
}
|
||||
|
||||
proc tc400::write {} {
|
||||
switch [sct type] {
|
||||
bool {set val [format "06%6.6d" [expr ([sct target] != 0) * 111111]]}
|
||||
fix2 {set val [format "06%6.6d" [expr int(0.5 + [sct target] * 100)]]}
|
||||
default {set val [format "06%6.6d" [expr int(0.5 + [sct target])]]}
|
||||
}
|
||||
sct send [addcksum [format "%3.3d10%3.3d$val" [sct @adr] [sct par] [sct target]]]
|
||||
return tc400::update
|
||||
}
|
Reference in New Issue
Block a user