45 lines
924 B
Tcl
45 lines
924 B
Tcl
namespace eval agilent53132a {} {
|
|
}
|
|
|
|
proc stdConfig::agilent53132a {} {
|
|
controller std "\n" 5
|
|
prop startcmd "*IDN?"
|
|
|
|
pollperiod 0.1 0.1
|
|
|
|
obj "agilent53132a" rd
|
|
prop read agilent53132a::read
|
|
|
|
kids "Frequency counter 53132a settings" {
|
|
node base par 0
|
|
prop width 12
|
|
prop fmt %.8g
|
|
}
|
|
|
|
return "agilent53132a frequency counter"
|
|
}
|
|
|
|
proc agilent53132a::read {} {
|
|
sct send "READ:FREQ?"
|
|
return agilent53132a::complete
|
|
}
|
|
|
|
proc agilent53132a::complete {} {
|
|
|
|
set value [string map {"," ""} [sct result]]
|
|
lassign $value value unit
|
|
if {$unit eq "MHz"} {
|
|
set value [expr $value * 1e6]
|
|
} else {
|
|
error "unsupported unit: $unit"
|
|
}
|
|
set base [format %.5g [hval [sct]/base]]
|
|
if {abs($value - $base) > 16384} { # max value for single precision with 0.001 resolution
|
|
set base [format "%.5g" $value]
|
|
hupdate [sct]/base $base
|
|
}
|
|
sct update [expr $value - $base]
|
|
return idle
|
|
}
|
|
|