I would like to implement an Emergency Stop routine based on a signal received from an external device through USB. I know there are delays involved in this problem (because of the operating system, because of the USB and because of different controllers utilized) but I want to do it anyway.
Now, my program has to move a stepper motor with precise position ending so I suppose, CONTROL_MODE_RUN and sslep(certain amount) may not the best solution (am I wrong?). So be it CONTROL_MODE_STEP.
It moves correctly with these instructions:
Code: Select all
for (int j = 0; j < NumAcquisition1; ++j) {
RotSteps = (TotalSteps1 / (NumAcquisition1 - 1)) * j;
printf("\nSegment: %d\n", j);
PhidgetStepper_setTargetPosition(BedMotor, BedSteps);
ssleep(5);
}
Code: Select all
PhidgetReturnCodePhidgetStepper_setTargetPosition_async(
PhidgetStepperHandle ch,
double targetPosition,
void (CCONV *asyncHandler)(PhidgetHandle phid, void *ctx, PhidgetReturnCode res),
void *ctx
)
Thank you in advance!