Files
sics/site_ansto/instrument/config/environment/isotech_ps.sct
2014-11-06 16:27:15 +11:00

58 lines
1.4 KiB
Plaintext

# Simple driver generator for the ISOTECH Power Supply
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent
#
driver isotech_ps = {
vendor = isotech; device = ps; protocol = std;
class = environment;
simulation_group = environment_simulation;
protocol_args = '{terminator "\r"}';
group = {
readable = 5
mutable = true
var relay = {
type = int;
read_command = 'F';
read_function = read_relay;
writeable = 1
write_command = 'KO';
write_function = write_relay;
}
var amps = {
type = float;
read_command = 'A';
units = 'A'
}
var volts = {
type = float;
read_command = 'V';
writeable = 1;
write_command = 'SV';
write_function = write_voltage;
units = 'V'
}
}
code read_function rdValue = {
@ set data [string range [sct result] 1 end]
}
code read_function read_relay = {
@ if { [string equal -nocase -length 2 "F1" "${data}"] } {
@ set data 1
@ } elseif { [string equal -nocase -length 2 "F0" "${data}"] } {
@ set data 0
@ } else {
@ sct geterror "Unexpected response '${data}' not 'F1' nor 'F0'"
@ }
}
code write_function write_relay = {
@ if { ${par} == 0 } {
@ set cmd "KOD"
@ } else {
@ set cmd "KOE"
@ }
}
code write_function write_voltage = {
@ set par "[format "%05.2f" [sct target]]"
@ set cmd "SV ${par}"
}
}