aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/Get_PowerStep01_Parameters.cs
blob: e6ced17ebf46368098ef2e362a1609b0603ba2a0 (plain)
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
using System;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Tango.PMR.Stubs;
using Tango.Stubs;

//unmark Auto logging !

const Int32 x_POWERSTEP01_CONFIG      = 0x1A;
const Int32 x_POWERSTEP01_STATUS      = 0x1B;
const Int32 x_POWERSTEP01_GATECFG1    = 0x18;
const Int32 x_POWERSTEP01_GATECFG2    = 0x19;

const Int32 x_ABS_POS    = 0x01;
const Int32 x_EL_POS     = 0x02;
const Int32 x_MARK       = 0x03;
const Int32 x_SPEED      = 0x04;
const Int32 x_ACC        = 0x05;
const Int32 x_DEC        = 0x06;
const Int32 x_MAX_SPEED  = 0x07;
const Int32 x_MIN_SPEED  = 0x08;
const Int32 x_FS_SPD     = 0x15;
const Int32 x_KVAL_HOLD  = 0x09;
const Int32 x_KVAL_RUN   = 0x0A;
const Int32 x_KVAL_ACC   = 0x0B;
const Int32 x_KVAL_DEC   = 0x0C;
const Int32 x_INT_SPD    = 0x0D;
const Int32 x_ST_SLP     = 0x0E;
const Int32 x_FN_SLP_ACC = 0x0F;
const Int32 x_FN_SLP_DEC = 0x10;
const Int32 x_K_THERM    = 0x11;
const Int32 x_ADC_OUT    = 0x12;
const Int32 x_OCD_TH     = 0x13;
const Int32 x_STALL_TH   = 0x14;
const Int32 x_STEP_MODE  = 0x16;
const Int32 x_ALARM_EN   = 0x17;
const Int32 x_CONFIG     = 0x18;
const Int32 x_STATUS     = 0x19;
//-------------------------------
const Int32 x_GET_PARAM  = 0x20;
//-------------------------------
const Int32 Max_Motor_ID  = 25;

string[] Motor_ID = new string[30];


Motor_ID[0] ="DH_CLEANHEAD ";
Motor_ID[1] ="DH_CLEANMECH ";
Motor_ID[2] ="DH_LID       ";
Motor_ID[3] ="DRYER_DRIVING";
Motor_ID[4] ="DRYER_LID    ";
Motor_ID[5] ="DRYER_LOADARM";
Motor_ID[6] ="DISPENCER_1  ";
Motor_ID[7] ="DISPENCER_2  ";
Motor_ID[8] ="DISPENCER_3  ";
Motor_ID[9] ="DISPENCER_4  ";
Motor_ID[10]="DISPENCER_5  ";
Motor_ID[11]="DISPENCER_6  ";
Motor_ID[12]="DISPENCER_7  ";
Motor_ID[13]="DISPENCER_8  ";
Motor_ID[14]="SCREW        ";
Motor_ID[15]="WINDER       ";
Motor_ID[16]="LDANCER1     ";
Motor_ID[17]="LDANCER2     ";
Motor_ID[18]="LDRIVING     ";
Motor_ID[19]="LLODING      ";
Motor_ID[20]="LPIVOT       ";
Motor_ID[21]="RDANCER      ";
Motor_ID[22]="RDRIVING     ";
Motor_ID[23]="RLOADARM     ";
Motor_ID[24]="RLODING      ";
Motor_ID[25]="SPARE1_1     ";
Motor_ID[26]="SPARE1_2     ";
Motor_ID[27]="SPARE2_1     ";
Motor_ID[28]="SPARE2_2     ";
Motor_ID[29]="SPARE3       ";

public void OnExecute(StubManager stubManager)
{
	
	var i = stubManager.ShowResponseWindow("Please Enter Motor ID:");
	
	stubManager.Write("Motor_ID:\t\t  ");
	stubManager.Write(i);
	stubManager.Write("\n");
	
	stubManager.Write("ABS_POS:\t\t");
	var response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_ABS_POS)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("EL_POS:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_EL_POS)<<16, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("MARK:\t\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_MARK)<<16, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("SPEED:\t\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_SPEED)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("ACC:\t\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_ACC)<<16, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("DEC:\t\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_DEC)<<16, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("MAX_SPEED:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_MAX_SPEED)<<16, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("MIN_SPEED:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_MIN_SPEED)<<16, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("FS_SPD:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_FS_SPD)<<16, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("KVAL\\TVAL_HOLD:\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_KVAL_HOLD)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("KVAL\\TVAL_RUN:\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_KVAL_RUN)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("KVAL\\TVAL_ACC:\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_KVAL_ACC)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("KVAL\\TVAL_DEC:\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_KVAL_DEC)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("INT_SPEED:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_INT_SPD)<<16, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("ST_SLP\\T_FAST:\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_ST_SLP)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("FN_SLP_ACC\\TON_MIN:\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_FN_SLP_ACC)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("FN_SLP_DEC\\TOFF_MIN:");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_FN_SLP_DEC)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("K_THERM:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_K_THERM)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("ADC_OUT:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_ADC_OUT)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("OCD_TH:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_OCD_TH)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("STALL_TH:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_STALL_TH)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("STEP_MODE:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_STEP_MODE)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("ALARM_EN:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_ALARM_EN)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("GATECFG1:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_POWERSTEP01_GATECFG1)<<16, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("GATECFG2:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_POWERSTEP01_GATECFG2)<<8, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("CONFIG:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_POWERSTEP01_CONFIG)<<16, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
	
	stubManager.Write("STATUS:\t\t");
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_POWERSTEP01_STATUS)<<16, 0, 0);
	stubManager.WriteHex(response.RecivedData,4); 
	stubManager.Write("\n");
}