equal
deleted
inserted
replaced
|
1 |
|
2 |
|
3 #How TPG26x comms work: |
|
4 #First send a command (e.g. ask for the pressure) then the device will return ACK. |
|
5 #Then send ENQ to get the actual values. |
|
6 |
|
7 #According to the streamdevice manual, once an "out" is sent access to the |
|
8 #device is exclusively locked until the WHOLE protocol is finished. |
|
9 #This should mean that we do not need to worry about commands interrupting each other |
|
10 |
|
11 LockTimeout = 2500; |
|
12 ReplyTimeout = 2000; |
|
13 ReadTimeout = 100; |
|
14 OutTerminator = CR; |
|
15 InTerminator = CR LF; |
|
16 |
|
17 # Reset communication |
|
18 reset { |
|
19 out "RES,1"; |
|
20 in ACK; |
|
21 out ENQ; |
|
22 in "%s"; |
|
23 } |
|
24 |
|
25 # Get pressures (and errors) from both guages |
|
26 pres { |
|
27 out "PRX"; |
|
28 in ACK; |
|
29 out ENQ; |
|
30 in "%(\$1\$2)d,%f,%(\$1\$3)d,%(\$1\$4)f"; |
|
31 } |
|
32 |
|
33 # Get the current units |
|
34 getUnits { |
|
35 out "UNI"; |
|
36 in ACK; |
|
37 out ENQ; |
|
38 in "%{0|1|2}"; |
|
39 } |
|
40 |
|
41 # Set the current units |
|
42 setUnits { |
|
43 #UNI,0 = mbar |
|
44 #UNI,1 = Torr |
|
45 #UNI,2 = Pa |
|
46 out "UNI,%{0|1|2}"; |
|
47 in ACK; |
|
48 out ENQ; |
|
49 in "%{0|1|2}"; |
|
50 } |