forked from Dimsmary/OpenSTM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommandSend.py
150 lines (101 loc) · 5.39 KB
/
CommandSend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
class CommandSendHandle:
def __init__(self, port):
self.port = port
def data_format(self, val):
return ('%05d' % (val, )) + '\r\n'
def send_to_dac_16bit(self, val):
self.port.write(("SETD0" + self.data_format(val)).encode())
def send_to_dac_z(self, val):
self.port.write(("SETD1" + self.data_format(val)).encode())
def send_to_dac_y(self, val):
self.port.write(("SETD2" + self.data_format(val)).encode())
def send_to_dac_x(self, val):
self.port.write(("SETD3" + self.data_format(val)).encode())
def send_to_dac_12bit(self, val):
val = val << 4
self.port.write(("SETD4" + self.data_format(val)).encode())
def send_get_adc(self):
self.port.write("GETAD00000\r\n".encode())
def send_to_curve(self, val):
self.port.write(("CURVE" + self.data_format(val)).encode())
def send_to_approach_begin(self):
self.port.write(("APPGO" + self.data_format(0)).encode())
def send_to_approach_stop(self):
self.port.write(("APPST" + self.data_format(0)).encode())
def send_to_approach_target(self, value):
self.port.write(("APPTA" + self.data_format(value)).encode())
def send_to_approach_register(self, value):
self.port.write(("APPRE" + self.data_format(value)).encode())
def send_to_approach_kp(self, value):
self.port.write(("APPS0" + self.data_format(value)).encode())
def send_to_approach_ki(self, value):
self.port.write(("APPS1" + self.data_format(value)).encode())
def send_to_approach_kd(self, value):
self.port.write(("APPS2" + self.data_format(value)).encode())
def send_to_approach_step(self, value):
self.port.write(("APPSS" + self.data_format(value)).encode())
def send_to_approach_crash(self, value):
self.port.write(("APPCA" + self.data_format(value)).encode())
def send_to_approach_amplitude(self, value):
self.port.write(("APPAM" + self.data_format(value)).encode())
def send_to_approach_slope(self, value):
self.port.write(("APPSO" + self.data_format(value)).encode())
def send_to_approach_cap_fast(self, value):
self.port.write(("APPFA" + self.data_format(value)).encode())
def send_to_approach_cap_slow(self, value):
self.port.write(("APPSL" + self.data_format(value)).encode())
def send_to_approach_bias(self, value):
self.port.write(("APPBI" + self.data_format(value)).encode())
def send_to_curve_test_register(self, value):
self.port.write(("CTREG" + self.data_format(value)).encode())
def send_to_curve_test_di_stop(self, value):
self.port.write(("CTDST" + self.data_format(value)).encode())
def send_to_curve_test_di_inc(self, value):
self.port.write(("CTDIN" + self.data_format(value)).encode())
def send_to_curve_test_delay(self, value):
self.port.write(("CTDLY" + self.data_format(value)).encode())
def send_to_curve_test_reset(self, value):
self.port.write(("CTRST" + self.data_format(value)).encode())
def send_to_curve_test_bi_stop(self, value):
self.port.write(("CTBST" + self.data_format(value)).encode())
def send_to_curve_test_bi_start(self, value):
self.port.write(("CTBSS" + self.data_format(value)).encode())
def send_to_curve_test_bi_inc(self, value):
self.port.write(("CTBIN" + self.data_format(value)).encode())
def send_to_scan_reg(self, value):
self.port.write(("SCREG" + self.data_format(value)).encode())
def send_to_scan_delay(self, value):
self.port.write(("SCDLY" + self.data_format(value)).encode())
def send_to_scan_line_target(self, value):
self.port.write(("SCLTA" + self.data_format(value)).encode())
def send_to_scan_line_origin_x(self, value):
self.port.write(("SCLTX" + self.data_format(value)).encode())
def send_to_scan_line_origin_y(self, value):
self.port.write(("SCLTY" + self.data_format(value)).encode())
def send_to_scan_line_inc(self, value):
self.port.write(("SCLIN" + self.data_format(value)).encode())
def send_to_scan_line_direction(self, value):
self.port.write(("SCLDI" + self.data_format(value)).encode())
def send_to_scan_ccch_mode(self, value):
self.port.write(("SCCMO" + self.data_format(value)).encode())
# scan parameters
def send_to_scan_x_begin(self, value):
self.port.write(("SCXBE" + self.data_format(value)).encode())
def send_to_scan_x_end(self, value):
self.port.write(("SCXEN" + self.data_format(value)).encode())
def send_to_scan_y_begin(self, value):
self.port.write(("SCYBE" + self.data_format(value)).encode())
def send_to_scan_y_end(self, value):
self.port.write(("SCYEN" + self.data_format(value)).encode())
def send_to_scan_inc(self, value):
self.port.write(("SCINC" + self.data_format(value)).encode())
def send_to_scan_cc_inc(self, value):
self.port.write(("SCCIN" + self.data_format(value)).encode())
def send_to_scan_mode(self, value):
self.port.write(("SCMOD" + self.data_format(value)).encode())
def send_to_scan_ch(self, value):
self.port.write(("SCICH" + self.data_format(value)).encode())
def send_to_scan_retract(self, value):
self.port.write(("SCRET" + self.data_format(value)).encode())
def send_to_scan_ez_switch(self, value):
self.port.write(("SCEZS" + self.data_format(value)).encode())