Rev 365 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 365 | Rev 368 | ||
---|---|---|---|
Line 113... | Line 113... | ||
113 | #include <stdbool.h> |
113 | #include <stdbool.h> |
114 | #include <windows.h> |
114 | #include <windows.h> |
115 | #include <userint.h> |
115 | #include <userint.h> |
116 | #include <utility.h> |
116 | #include <utility.h> |
117 | #include "ThorlabsLTS_ui.h" |
117 | #include "ThorlabsLTS_ui.h" |
118 | - | ||
119 | 118 | ||
120 | #include "ThorlabsMotionControlIntegratedStepperMotors.h" |
119 | #include "ThorlabsMotionControlIntegratedStepperMotors.h" |
- | 120 | #include "ThorlabsLTS.h" |
|
121 | 121 | ||
122 | - | ||
123 | void LTS_waitMove(int i, int timeout); |
- | |
124 | void LTS_waitHome(int i, int timeout); |
- | |
125 | char serialNumbers[][9] = {"45388004", "45387934","45388034"}; |
122 | char serialNumbers[][9] = {"45388004", "45387934","45388034"}; |
126 | 123 | ||
127 | // Set number of microsteps, found in APT communications protocol. Should be changed to 136533 if using K10CR1 |
124 | // Set number of microsteps, found in APT communications protocol. Should be changed to 136533 if using K10CR1 |
128 | int StepsPerMm = 409600; |
125 | int StepsPerMm = 409600; |
129 | double SingleMove=1; // in mm |
- | |
130 | 126 | ||
131 | int LTSTimerOut=0; |
127 | int LTSTimerOut=0; |
132 | int |
128 | int pth=0,tctrl; |
133 | 129 | ||
134 | 130 | ||
135 | int CVICALLBACK LTS_Timeout (int panel, int control, int event, |
131 | int CVICALLBACK LTS_Timeout (int panel, int control, int event, |
136 | void *callbackData, int eventData1, int eventData2) { |
132 | void *callbackData, int eventData1, int eventData2) { |
137 | switch (event) { |
133 | switch (event) { |
138 | case EVENT_TIMER_TICK: |
134 | case EVENT_TIMER_TICK: |
139 | LTSTimerOut = 1; |
135 | LTSTimerOut = 1; |
140 | printf("LTS timeout\n"); |
136 | printf("LTS timeout\n"); |
141 | break; |
137 | break; |
142 | } |
138 | } |
143 | return 0; |
139 | return 0; |
144 | } |
140 | } |
145 | 141 | ||
146 | /* |
142 | /* |
147 | void LTS_Timerast (int signumber) { |
143 | void LTS_Timerast (int signumber) { |
148 | LTSTimerOut = 1; |
144 | LTSTimerOut = 1; |
149 | printf("TIMEOUT !!!\n"); |
145 | printf("TIMEOUT !!!\n"); |
150 | SetCtrlAttribute (p1_h, P1_TIMEOUT, ATTR_ENABLED, 0); |
146 | SetCtrlAttribute (p1_h, P1_TIMEOUT, ATTR_ENABLED, 0); |
151 | } |
147 | } |
152 | */ |
148 | */ |
153 | 149 | // tout in ms |
|
154 | void LTS_Tmlnk (int tout) { |
150 | void LTS_Tmlnk (int tout) { |
- | 151 | if (!pth) { |
|
- | 152 | pth = NewPanel (0, "Timeout pannel", 0, 0, 200, 200); |
|
- | 153 | tctrl = NewCtrl (pth, CTRL_TIMER, "Timeout", 0, 0); |
|
- | 154 | SetCtrlAttribute (pth, tctrl, ATTR_CALLBACK_FUNCTION_POINTER, LTS_Timeout); |
|
- | 155 | SetCtrlAttribute (pth, tctrl, ATTR_ENABLED, 0); |
|
- | 156 | SetCtrlAttribute (pth, tctrl, ATTR_CTRL_MODE, VAL_INDICATOR); |
|
- | 157 | // SetActiveCtrl (pth, tctrl); |
|
- | 158 | } |
|
155 | LTSTimerOut = 0; |
159 | LTSTimerOut = 0; |
156 | SetCtrlAttribute ( |
160 | SetCtrlAttribute (pth, tctrl, ATTR_INTERVAL, (double)tout/1000.); |
157 | SetCtrlAttribute ( |
161 | SetCtrlAttribute (pth, tctrl, ATTR_ENABLED, 1); |
158 | } |
- | |
159 | - | ||
160 | void LTS_Tmulk ( void ) { |
- | |
161 | SetCtrlAttribute (p1_h, P1_TIMEOUT, ATTR_ENABLED, 0); |
- | |
162 | LTSTimerOut = 0; |
- | |
163 | } |
162 | } |
164 | 163 | ||
165 | void |
164 | void LTS_Tmulk ( void ) { |
166 | - | ||
167 | //Set up homing parameters. |
- | |
168 | MOT_HomingParameters homingParams; |
- | |
169 |
|
165 | SetCtrlAttribute (pth, tctrl, ATTR_ENABLED, 0); |
170 |
|
166 | LTSTimerOut = 0; |
171 | ISC_SetHomingParamsBlock(serialNumbers[i], &homingParams); |
- | |
- | 167 | } |
|
172 | 168 | ||
- | 169 | //Waits should only be used for Home commands. The home command has a different status return. |
|
173 |
|
170 | void LTS_waitHome(int i, int tout)// Waits until a single axis is homed. |
- | 171 | { |
|
- | 172 | WORD messageType=0; |
|
- | 173 | WORD messageId=0; |
|
- | 174 | DWORD messageData=0; |
|
- | 175 | int condition=0; |
|
- | 176 | LTS_Tmlnk (tout); |
|
- | 177 | do { |
|
174 |
|
178 | while (!ISC_MessageQueueSize(serialNumbers[i])){ |
- | 179 | Sleep(250); |
|
- | 180 | ProcessSystemEvents(); |
|
- | 181 | if (LTSTimerOut) break; |
|
- | 182 | } |
|
- | 183 | if (LTSTimerOut){ |
|
- | 184 | printf( "Timeout in axis [%d] pos: %f messageType %d, messageId %d\n",i,LTS_GetPosition(i), messageType, messageId); |
|
- | 185 | break; |
|
- | 186 | } |
|
- | 187 | ISC_GetNextMessage(serialNumbers[i], &messageType, &messageId, &messageData); |
|
- | 188 | printf( "axis [%d] pos: %f messageType %d, messageId %d\n",i,LTS_GetPosition(i), messageType, messageId); |
|
- | 189 | condition = (messageType == 2) && (messageId == 0); |
|
- | 190 | } while (!condition); |
|
- | 191 | ||
- | 192 | LTS_Tmulk(); |
|
- | 193 | } |
|
175 | 194 | ||
176 |
|
195 | void LTS_waitMove(int i, int tout)// Waits until axis is stopped. |
- | 196 | { |
|
- | 197 | WORD messageType=0; |
|
- | 198 | WORD messageId=0; |
|
- | 199 | DWORD messageData=0; |
|
- | 200 | int condition=0; |
|
- | 201 | LTS_Tmlnk (tout); |
|
- | 202 | do { |
|
177 |
|
203 | while (!ISC_MessageQueueSize(serialNumbers[i])){ |
- | 204 | Sleep(250); |
|
178 |
|
205 | ProcessSystemEvents(); |
179 | if |
206 | if (LTSTimerOut) break; |
- | 207 | } |
|
180 |
|
208 | if (LTSTimerOut){ |
- | 209 | printf( "Timeout in axis [%d] pos: %f messageType %d, messageId %d\n",i,LTS_GetPosition(i), messageType, messageId); |
|
- | 210 | break; |
|
- | 211 | } |
|
- | 212 | ISC_GetNextMessage(serialNumbers[i], &messageType, &messageId, &messageData); |
|
- | 213 | // printf( "axis [%d] pos: %f messageType %d, messageId %d\n",i,LTS_GetPosition(i), messageType, messageId); |
|
- | 214 | condition = (messageType == 2) && (messageId == 1); |
|
- | 215 | } while (!condition); |
|
- | 216 | ||
- | 217 | ||
- | 218 | LTS_Tmulk(); |
|
181 | } |
219 | } |
182 | 220 | ||
183 | int LTS_Init(int i){ |
221 | int LTS_Init(int i){ |
184 | 222 | ||
185 | int errorReturn = ISC_Open(serialNumbers[i]); |
223 | int errorReturn = ISC_Open(serialNumbers[i]); |
Line 193... | Line 231... | ||
193 | */ |
231 | */ |
194 | Sleep(1000); |
232 | Sleep(1000); |
195 | if (errorReturn == 0){ |
233 | if (errorReturn == 0){ |
196 | printf( "Device %d (serial %s) Connected... \n",i, serialNumbers[i]); |
234 | printf( "Device %d (serial %s) Connected... \n",i, serialNumbers[i]); |
197 | //Settings are loaded based on Stage Name. The integrated stepper class holds LTS and K10CR1 Information. |
235 | //Settings are loaded based on Stage Name. The integrated stepper class holds LTS and K10CR1 Information. |
198 | ISC_SetLEDswitches(serialNumbers[i], 0); // disable LED |
236 | ISC_SetLEDswitches(serialNumbers[i], 0); // disable LED |
- | 237 | Sleep(100); |
|
199 | ISC_StartPolling(serialNumbers[i], 50); |
238 | ISC_StartPolling(serialNumbers[i], 50); |
200 | Sleep(1000); |
239 | Sleep(1000); |
201 | } else { |
240 | } else { |
202 | printf( "Error connecting device %d (%s)\n",i, serialNumbers[i] ); |
241 | printf( "Error connecting device %d (%s)\n",i, serialNumbers[i] ); |
203 | } |
242 | } |
204 | return errorReturn; |
243 | return errorReturn; |
- | 244 | } |
|
- | 245 | ||
- | 246 | int LTS_Open(){ |
|
- | 247 | ||
- | 248 | TLI_BuildDeviceList(); |
|
- | 249 | TLI_DeviceInfo info; |
|
- | 250 | int err=0; |
|
- | 251 | for (int i=0;i<3;i++){ |
|
- | 252 | TLI_GetDeviceInfo(serialNumbers[i], &info); |
|
- | 253 | Sleep(100); |
|
- | 254 | err = LTS_Init(i); |
|
- | 255 | printf("%s err=%x\n", info.description, err); |
|
- | 256 | if (err) return err; |
|
- | 257 | } |
|
- | 258 | return 0; |
|
205 | } |
259 | } |
206 | 260 | ||
207 | void LTS_Close(int i){ |
261 | void LTS_Close(int i){ |
208 | //Close the stage |
262 | //Close the stage |
209 | ISC_StopPolling(serialNumbers[i]); |
263 | ISC_StopPolling(serialNumbers[i]); |
210 | ISC_Close(serialNumbers[i]); |
264 | ISC_Close(serialNumbers[i]); |
211 | printf( "Device Disconnected...\n"); |
265 | printf( "Device Disconnected...\n"); |
212 | } |
266 | } |
- | 267 | ||
- | 268 | // wait in ms |
|
- | 269 | void LTS_Home(int i,int wait){ |
|
- | 270 | ||
- | 271 | //Set up homing parameters. |
|
- | 272 | MOT_HomingParameters homingParams; |
|
- | 273 | ISC_GetHomingParamsBlock(serialNumbers[i], &homingParams); |
|
- | 274 | homingParams.direction = MOT_Reverse; |
|
- | 275 | ISC_SetHomingParamsBlock(serialNumbers[i], &homingParams); |
|
- | 276 | ||
- | 277 | //Clear existing messages in the hardware buffer. |
|
- | 278 | ISC_ClearMessageQueue(serialNumbers[i]); |
|
- | 279 | ||
- | 280 | //Home the stage and wait for the return message before continuing. |
|
- | 281 | ISC_Home(serialNumbers[i]); |
|
- | 282 | printf( "Start Homing...\n"); |
|
- | 283 | if (wait) LTS_waitHome(i, wait); |
|
- | 284 | printf( "Homed...\n"); |
|
- | 285 | } |
|
213 | 286 | ||
214 | void LTS_StopProfiled(int i){ |
287 | void LTS_StopProfiled(int i){ |
215 | ISC_StopProfiled(serialNumbers[i]); |
288 | ISC_StopProfiled(serialNumbers[i]); |
216 | } |
289 | } |
217 | 290 | ||
218 | void LTS_MoveAbsolute(int i, double position, int wait){ |
291 | void LTS_MoveAbsolute(int i, double position, int wait){ |
219 | ISC_SetMoveAbsolutePosition(serialNumbers[i], (position*StepsPerMm)); |
292 | ISC_SetMoveAbsolutePosition(serialNumbers[i], (position*StepsPerMm)); |
220 | ISC_MoveAbsolute(serialNumbers[i]); |
293 | ISC_MoveAbsolute(serialNumbers[i]); |
- | 294 | //Clear existing messages in the hardware buffer. |
|
- | 295 | ISC_ClearMessageQueue(serialNumbers[i]); |
|
221 | if (wait) LTS_waitMove(i, wait); |
296 | if (wait) LTS_waitMove(i, wait); |
222 | 297 | ||
223 | } |
298 | } |
224 | 299 | ||
225 | void LTS_MoveRelative(int i, double distance, int wait){ |
300 | void LTS_MoveRelative(int i, double distance, int wait){ |
226 | ISC_SetMoveRelativeDistance(serialNumbers[i], (distance*StepsPerMm)); |
301 | ISC_SetMoveRelativeDistance(serialNumbers[i], (distance*StepsPerMm)); |
227 | ISC_MoveRelativeDistance(serialNumbers[i]); |
302 | ISC_MoveRelativeDistance(serialNumbers[i]); |
- | 303 | //Clear existing messages in the hardware buffer. |
|
- | 304 | ISC_ClearMessageQueue(serialNumbers[i]); |
|
228 | if (wait) LTS_waitMove(i, wait); |
305 | if (wait) LTS_waitMove(i, wait); |
229 | } |
306 | } |
230 | 307 | ||
231 | 308 | ||
232 | double LTS_GetPosition(int i){ |
309 | double LTS_GetPosition(int i){ |
Line 234... | Line 311... | ||
234 | double real_unit = 1.0*device_unit / StepsPerMm; |
311 | double real_unit = 1.0*device_unit / StepsPerMm; |
235 | //const int unitType = 0 ;// 0 .. distance , 1 .. velocity, 2 .. acceleration |
312 | //const int unitType = 0 ;// 0 .. distance , 1 .. velocity, 2 .. acceleration |
236 | // does not work int err = ISC_GetRealValueFromDeviceUnit(serialNumbers[i], device_unit,&real_unit, unitType); |
313 | // does not work int err = ISC_GetRealValueFromDeviceUnit(serialNumbers[i], device_unit,&real_unit, unitType); |
237 | // printf("err = 0x%x pos %d %f\n", err ,device_unit, real_unit); |
314 | // printf("err = 0x%x pos %d %f\n", err ,device_unit, real_unit); |
238 | return real_unit; |
315 | return real_unit; |
239 | } |
316 | } |
240 | 317 | ||
241 | unsigned int LTS_GetStatus(int i){ |
318 | unsigned int LTS_GetStatus(int i){ |
242 | return ISC_GetStatusBits(serialNumbers[i]); |
319 | return ISC_GetStatusBits(serialNumbers[i]); |
243 | } |
320 | } |
244 | 321 | ||
245 | 322 | ||
Line 250... | Line 327... | ||
250 | 327 | ||
251 | int LTS_Disable(int i){ |
328 | int LTS_Disable(int i){ |
252 | return ISC_DisableChannel(serialNumbers[i]); |
329 | return ISC_DisableChannel(serialNumbers[i]); |
253 | } |
330 | } |
254 | 331 | ||
255 | 332 | ||
256 | int LTS_GetNumberPositions(int i){ |
333 | int LTS_GetNumberPositions(int i){ |
257 | return ISC_GetNumberPositions(serialNumbers[i]); |
334 | return ISC_GetNumberPositions(serialNumbers[i]); |
258 | } |
335 | } |
259 | - | ||
260 | int LTS_Open(){ |
- | |
261 | - | ||
262 | TLI_BuildDeviceList(); |
- | |
263 | TLI_DeviceInfo info; |
- | |
264 | int err=0; |
- | |
265 | for (int i=0;i<3;i++){ |
- | |
266 | TLI_GetDeviceInfo(serialNumbers[i], &info); |
- | |
267 | Sleep(100); |
- | |
268 | err = LTS_Init(i); |
- | |
269 | printf("%s err=%x\n", info.description, err); |
- | |
270 | if (err) return err; |
- | |
271 | } |
- | |
272 | return 0; |
- | |
273 | } |
- | |
274 | - | ||
275 | 336 | ||
276 | void LTS_RegisterMessageCallback(int i, void (* functionPointer)()){ |
337 | void LTS_RegisterMessageCallback(int i, void (* functionPointer)()){ |
277 | ISC_RegisterMessageCallback(serialNumbers[i], functionPointer ); |
338 | ISC_RegisterMessageCallback(serialNumbers[i], functionPointer ); |
278 | } |
339 | } |
279 | 340 | ||
280 | void LTS_GetRealValueFromDeviceUnit(int i, int device_unit, double *real_unit, int unitType){ |
341 | void LTS_GetRealValueFromDeviceUnit(int i, int device_unit, double *real_unit, int unitType){ |
281 | ISC_GetRealValueFromDeviceUnit(serialNumbers[i], device_unit, real_unit, unitType); |
342 | ISC_GetRealValueFromDeviceUnit(serialNumbers[i], device_unit, real_unit, unitType); |
282 | } |
343 | } |
283 | 344 | ||
284 | void LTS_GetDeviceUnitFromRealValue(int i, double real_unit, int *device_unit, int unitType){ |
345 | void LTS_GetDeviceUnitFromRealValue(int i, double real_unit, int *device_unit, int unitType){ |
285 | ISC_GetDeviceUnitFromRealValue(serialNumbers[i], real_unit, device_unit, unitType); |
346 | ISC_GetDeviceUnitFromRealValue(serialNumbers[i], real_unit, device_unit, unitType); |
286 | } |
347 | } |
287 | //Waits should only be used for Home commands. The home command has a different status return. |
- | |
288 | void LTS_waitHome(int i, int tout)// Waits until a single axis is homed. |
- | |
289 | { |
- | |
290 | WORD messageType=0; |
- | |
291 | WORD messageId=0; |
- | |
292 | DWORD messageData=0; |
- | |
293 | int condition=0; |
- | |
294 | LTS_Tmlnk (tout); |
- | |
295 | do { |
- | |
296 | while (!ISC_MessageQueueSize(serialNumbers[i])){ |
- | |
297 | Sleep(250); |
- | |
298 | if (LTSTimerOut) break; |
- | |
299 | } |
- | |
300 | if (LTSTimerOut){ |
- | |
301 | printf( "Timeout in axis [%d] pos: %f messageType %d, messageId %d\n",i,LTS_GetPosition(i), messageType, messageId); |
- | |
302 | break; |
- | |
303 | } |
- | |
304 | ISC_GetNextMessage(serialNumbers[i], &messageType, &messageId, &messageData); |
- | |
305 | condition = (messageType == 2) && (messageId == 0); |
- | |
306 | - | ||
307 | } while (!condition || !LTSTimerOut); |
- | |
308 | - | ||
309 | LTS_Tmulk(); |
- | |
310 | } |
- | |
311 | 348 | ||
312 | void LTS_waitMove(int i, int tout)// Waits until axis is stopped. |
- | |
313 | { |
- | |
314 | WORD messageType=0; |
- | |
315 | WORD messageId=0; |
- | |
316 | DWORD messageData=0; |
- | |
317 | int condition=0; |
- | |
318 | LTS_Tmlnk (tout); |
- | |
319 | do { |
- | |
320 | while (!ISC_MessageQueueSize(serialNumbers[i])){ |
- | |
321 | Sleep(250); |
- | |
322 | if (LTSTimerOut) break; |
- | |
323 | } |
- | |
324 | if (LTSTimerOut){ |
- | |
325 | printf( "Timeout in axis [%d] pos: %f messageType %d, messageId %d\n",i,LTS_GetPosition(i), messageType, messageId); |
- | |
326 | break; |
- | |
327 | } |
- | |
328 | ISC_GetNextMessage(serialNumbers[i], &messageType, &messageId, &messageData); |
- | |
329 | condition = (messageType == 2) && (messageId == 1); |
- | |
330 | - | ||
331 | } while (!condition); |
- | |
332 | - | ||
333 | - | ||
334 | LTS_Tmulk(); |
- | |
335 | } |
- | |
336 | //******************************************************************* |
349 | //******************************************************************* |
337 | 350 | ||
338 | #ifdef LTS_MAIN |
351 | #ifdef LTS_MAIN |
339 | 352 | ||
340 | 353 | ||
- | 354 | int p1_h; |
|
341 | int rID, tfID; |
355 | int rID, tfID; |
342 | 356 | ||
343 | #define MAX_THREADS 10 |
357 | #define MAX_THREADS 10 |
344 | static CmtThreadPoolHandle poolHandle = 0; |
358 | static CmtThreadPoolHandle poolHandle = 0; |
345 | int lid[][14]= { |
359 | int lid[][14]= { |
Line 460... | Line 474... | ||
460 | 474 | ||
461 | int evcontrl,evpanel,ierr; |
475 | int evcontrl,evpanel,ierr; |
462 | double n2; |
476 | double n2; |
463 | int comled; |
477 | int comled; |
464 | int enabled=0; |
478 | int enabled=0; |
- | 479 | double SingleMove=1; // in mm |
|
465 | 480 | ||
466 | 481 | ||
467 | SetSleepPolicy(VAL_SLEEP_MORE); |
482 | SetSleepPolicy(VAL_SLEEP_MORE); |
468 | CmtNewThreadPool (MAX_THREADS, &poolHandle); |
483 | CmtNewThreadPool (MAX_THREADS, &poolHandle); |
469 | SetStdioPort (CVI_STDIO_WINDOW); |
484 | SetStdioPort (CVI_STDIO_WINDOW); |
470 | if (InitCVIRTE (hInstance, 0, 0) == 0) return -1; |
485 | if (InitCVIRTE (hInstance, 0, 0) == 0) return -1; // out of memory |
471 | 486 | ||
472 | p1_h = LoadPanel (0,"ThorlabsLTS_ui.uir", P1); |
487 | p1_h = LoadPanel (0,"ThorlabsLTS_ui.uir", P1); |
473 | //p1_h = BuildP1 (0); |
488 | //p1_h = BuildP1 (0); |
474 | ierr = DisplayPanel (p1_h); |
489 | ierr = DisplayPanel (p1_h); |
475 | ierr = SetActiveCtrl (p1_h,P1_B1); |
490 | ierr = SetActiveCtrl (p1_h,P1_B1); |
Line 513... | Line 528... | ||
513 | break; |
528 | break; |
514 | case P1_BB: |
529 | case P1_BB: |
515 | LTS_MoveRelative(2,-SingleMove, 0); |
530 | LTS_MoveRelative(2,-SingleMove, 0); |
516 | break; |
531 | break; |
517 | case P1_HO: |
532 | case P1_HO: |
518 | LTS_Home(0, |
533 | LTS_Home(0,180000); |
519 | break; |
534 | break; |
520 | case P1_HO_2: |
535 | case P1_HO_2: |
521 | LTS_Home(1, |
536 | LTS_Home(1,180000); |
522 | break; |
537 | break; |
523 | case P1_HO_3: |
538 | case P1_HO_3: |
524 | LTS_Home(2, |
539 | LTS_Home(2,180000); |
525 | break; |
540 | break; |
526 | case P1_GX: |
541 | case P1_GX: |
527 | GetCtrlVal (p1_h, P1_XG, &n2); |
542 | GetCtrlVal (p1_h, P1_XG, &n2); |
528 | LTS_MoveAbsolute(0,n2, |
543 | LTS_MoveAbsolute(0,n2,15000); |
529 | break; |
544 | break; |
530 | case P1_GY: |
545 | case P1_GY: |
531 | GetCtrlVal (p1_h, P1_YG, &n2); |
546 | GetCtrlVal (p1_h, P1_YG, &n2); |
532 | LTS_MoveAbsolute(1,n2, |
547 | LTS_MoveAbsolute(1,n2,15000); |
533 | break; |
548 | break; |
534 | case P1_GZ: |
549 | case P1_GZ: |
535 | GetCtrlVal (p1_h, P1_ZG, &n2); |
550 | GetCtrlVal (p1_h, P1_ZG, &n2); |
536 | LTS_MoveAbsolute(2,n2, |
551 | LTS_MoveAbsolute(2,n2,15000); |
537 | break; |
552 | break; |
538 | case P1_G: |
553 | case P1_G: |
539 | GetCtrlVal (p1_h, P1_XG, &n2); |
554 | GetCtrlVal (p1_h, P1_XG, &n2); |
540 | LTS_MoveAbsolute(0,n2, |
555 | LTS_MoveAbsolute(0,n2,15000); |
541 | GetCtrlVal (p1_h, P1_YG, &n2); |
556 | GetCtrlVal (p1_h, P1_YG, &n2); |
542 | LTS_MoveAbsolute(1,n2, |
557 | LTS_MoveAbsolute(1,n2,15000); |
543 | GetCtrlVal (p1_h, P1_ZG, &n2); |
558 | GetCtrlVal (p1_h, P1_ZG, &n2); |
544 | LTS_MoveAbsolute(2,n2, |
559 | LTS_MoveAbsolute(2,n2,15000); |
545 | break; |
560 | break; |
546 | case P1_B3: // reset |
561 | case P1_B3: // reset |
547 | case P1_B3_2: // reset |
562 | case P1_B3_2: // reset |
548 | case P1_B3_3: // reset |
563 | case P1_B3_3: // reset |
549 | printf("RST Not yet implemented\n"); |
564 | printf("RST Not yet implemented\n"); |
Line 631... | Line 646... | ||
631 | 646 | ||
632 | 647 | ||
633 | #else |
648 | #else |
634 | // ************************************* |
649 | // ************************************* |
635 | 650 | ||
- | 651 | /* |
|
636 | int main(int argc, char ** argv) |
652 | int main(int argc, char ** argv) |
637 | { |
653 | { |
638 | //Sets up simulations. Comment in if running on physical hardware. |
654 | //Sets up simulations. Comment in if running on physical hardware. |
639 | //TLI_InitializeSimulations(); |
655 | //TLI_InitializeSimulations(); |
640 | 656 | ||
Line 658... | Line 674... | ||
658 | 674 | ||
659 | //Move the stage and wait for the return message before continuing. |
675 | //Move the stage and wait for the return message before continuing. |
660 | for (int k=0;k<10;k++){ |
676 | for (int k=0;k<10;k++){ |
661 | LTS_MoveAbsolute(i,k); |
677 | LTS_MoveAbsolute(i,k); |
662 | printf( "Moving ...\n"); |
678 | printf( "Moving ...\n"); |
663 |
|
679 | LTS_waitMove(i); |
664 | printf( "Move Complete...\n"); |
680 | printf( "Move Complete...\n"); |
665 | } |
681 | } |
666 | 682 | |
|
667 | 683 | |
|
668 |
|
684 | } |
669 | 685 | |
|
670 | for (int i=0;i<3;i++){ |
686 | for (int i=0;i<3;i++){ |
671 | LTS_Close(i); |
687 | LTS_Close(i); |
672 | } |
688 | } |
673 | 689 | |
|
674 | //Closes simulations. Comment if running on physical hardware. |
690 | //Closes simulations. Comment if running on physical hardware. |
675 | //TLI_UninitializeSimulations(); |
691 | //TLI_UninitializeSimulations(); |
676 | Delay(10); |
692 | Delay(10); |
677 | return 0; |
693 | return 0; |
678 | } |
694 | } |
- | 695 | */ |
|
679 | #endif |
696 | #endif |