IOCINFRAApp/Db/TPG26x.proto
author Heinz Junkes <junkes@fhi-berlin.mpg.de>
Thu, 07 Mar 2019 09:23:26 +0100
changeset 0 77d8eafe2a07
permissions -rw-r--r--
Initial repo



#How TPG26x comms work:
#First send a command (e.g. ask for the pressure) then the device will return ACK.
#Then send ENQ to get the actual values.

#According to the streamdevice manual, once an "out" is sent access to the
#device is exclusively locked until the WHOLE protocol is finished.
#This should mean that we do not need to worry about commands interrupting each other

LockTimeout = 2500;
ReplyTimeout = 2000;
ReadTimeout = 100;
OutTerminator = CR;
InTerminator = CR LF;

# Reset communication 
reset {
    out "RES,1";
    in ACK;
	out ENQ;
    in "%s";
}

# Get pressures (and errors) from both guages
pres {
    out "PRX";
    in ACK;
	out ENQ;
    in "%(\$1\$2)d,%f,%(\$1\$3)d,%(\$1\$4)f";
}

# Get the current units
getUnits {
    out "UNI";
	in ACK;
	out ENQ;
    in "%{0|1|2}";
}

# Set the current units
setUnits {
    #UNI,0 = mbar
    #UNI,1 = Torr
    #UNI,2 = Pa
    out "UNI,%{0|1|2}";
	in ACK;
	out ENQ;
    in "%{0|1|2}";
}