|
1 ########################################################################## |
|
2 # Copyright (c) 2011 Lawrence Berkeley National Laboratory, Accelerator |
|
3 # Technology Group, Engineering Division |
|
4 # This code is distributed subject to a Software License Agreement found |
|
5 # in file LICENSE that is included with this distribution. |
|
6 ########################################################################## |
|
7 |
|
8 @writetimeout { disconnect; } |
|
9 @replytimeout { disconnect; } |
|
10 @readtimeout { disconnect; } |
|
11 @mismatch { disconnect; } |
|
12 |
|
13 ReplyTimeout = 1200; |
|
14 InTerminator = "\n"; |
|
15 OutTerminator = "\n"; |
|
16 |
|
17 getIDN { |
|
18 out "*IDN?"; |
|
19 in "%\$1[^\r\n]"; |
|
20 ExtraInput = Ignore; |
|
21 } |
|
22 cmd { |
|
23 out "\$1"; |
|
24 } |
|
25 |
|
26 setD { |
|
27 out "\$1 %d"; |
|
28 @init { out "\$1?"; in "%d"; } |
|
29 } |
|
30 getD { |
|
31 out "\$1?"; |
|
32 in "%d"; |
|
33 ExtraInput = Ignore; |
|
34 } |
|
35 |
|
36 setF { |
|
37 out "\$1 %f"; |
|
38 @init { out "\$1?"; in "%f"; } |
|
39 } |
|
40 getF { |
|
41 out "\$1?"; |
|
42 in "%f"; |
|
43 ExtraInput = Ignore; |
|
44 } |
|
45 |
|
46 setRange { |
|
47 out "RANG 2E-%d"; |
|
48 @init { out "RANG?"; in "%*[^E]E-%d"; } |
|
49 } |
|
50 getRange { |
|
51 out "RANG?"; |
|
52 in "%*[^E]E-%d"; |
|
53 ExtraInput = Ignore; |
|
54 } |
|
55 |
|
56 setArmSource { |
|
57 out "ARM:SOUR %{IMM|BUS|TIM|MAN|TLIN|NST|PST|BST}"; |
|
58 @init { out "ARM:SOUR?"; in "%{IMM|BUS|TIM|MAN|TLIN|NST|PST|BST}"; } |
|
59 } |
|
60 getArmSource { |
|
61 out "ARM:SOUR?"; |
|
62 in "%{IMM|BUS|TIM|MAN|TLIN|NST|PST|BST}"; |
|
63 ExtraInput = Ignore; |
|
64 } |
|
65 setTriggerSource { |
|
66 out "TRIG:SOUR %{IMM|TLIN}"; |
|
67 @init { out "TRIG:SOUR?"; in "%{IMM|TLIN}"; } |
|
68 } |
|
69 getTriggerSource { |
|
70 out "TRIG:SOUR?"; |
|
71 in "%{IMM|TLIN}"; |
|
72 ExtraInput = Ignore; |
|
73 } |
|
74 cancel { |
|
75 out "\030ABOR\r"; |
|
76 in "%*s"; |
|
77 ExtraInput = Ignore; |
|
78 } |
|
79 |
|
80 # |
|
81 # Measure current |
|
82 # |
|
83 measureCurrent { |
|
84 ReplyTimeout = 5000; |
|
85 out "READ?"; |
|
86 in "%f"; |
|
87 ExtraInput = Ignore; |
|
88 @init { out "FORM:ELEM READ;CONF:CURR:DC"; } |
|
89 } |
|
90 fetchBuffered { |
|
91 ReplyTimeout = 10000; |
|
92 Separator = ","; |
|
93 out "FETC?"; |
|
94 in "%f"; |
|
95 ExtraInput = Ignore; |
|
96 } |
|
97 |
|
98 # |
|
99 # Source |
|
100 # |
|
101 setIlimit { |
|
102 out "SOUR:VOLT:ILIM 2.5E-%d"; |
|
103 @init { out "SOUR:VOLT:ILIM?"; in "2.5%*[^E]E-%d"; } |
|
104 } |
|
105 getIlimit { |
|
106 out "SOUR:VOLT:ILIM?"; |
|
107 in "2.5%*[^E]E-%d"; |
|
108 ExtraInput = Ignore; |
|
109 } |
|
110 setSourceRange { |
|
111 out "SOUR:VOLT:RANGE %d"; |
|
112 @init { out "SOUR:VOLT:RANGE?"; in "%{1.000000E+01|5.000000E+01|5.000000E+02}"; } |
|
113 } |
|
114 getSourceRange { |
|
115 out "SOUR:VOLT:RANGE?"; |
|
116 in "%{1.000000E+01|5.000000E+01|5.000000E+02}"; |
|
117 ExtraInput = Ignore; |
|
118 } |
|
119 |