1062 stopped events mis-firing
Posted: Wed Oct 31, 2018 4:44 pm
I am controlling two steppers from a Phidgets 1062 using channels 0 and 1. I have defined two instances of Phidget22.Stepper, one called Xstepper and one called Ystepper:
I have defined two event handlers, one for Xstepper.Stopped and one for Ystepper.stopped. The Xstepper.Stopped handler increments Xstepper.TargetPosition until a limit is reached; it then increments Ystepper.TargetPosition. The Ystepper.Stopped handler simply checks to see if the Y limit has been reached, and if it hasn't it changes the sign on the X increment and increments Xstepper.TargetPosition.
What should happen is that I should get a raster-type scan - move N steps in the X direction, move one step in Y, move N steps backwards in the X direction, move one step in Y, etc. this is started with an initial increment to Xstepper.TargetPosition.
The Xstepper.Stopped handler should fire N times, the Ystepper.Stopped handler should fire once, the Xstepper.Stopped handler should fire N times, the Ystepper.Stopped handler should fire once, etc.
What is actually happening is the Xstepper.Stopped handler fires N times, on the last time correctly incrementing Ystepper.TargetPosition; however, while the Y stepper is moving the Xstepper.Stopped handler fires constantly. Once the Ystepper.Stopped handler fires it correctly increments Xstepper.TargetPosition, but while the Xstepper is moving the Ystepper.Stopped handler fires continuously.
Hope this is not too confusing. I assume I am not using the separate channels of the 1062 correctly.
Code: Select all
Try
Xstepper = New Phidget22.Stepper
Xstepper.Channel = 0
Xstepper.Open()
Catch ex As PhidgetException
MessageBox.Show(ex.Message)
Application.Exit()
End Try
Try
Ystepper = New Phidget22.Stepper
Ystepper.Channel = 1
Ystepper.Open()
Catch ex As PhidgetException
MessageBox.Show(ex.Message)
Application.Exit()
End Try
What should happen is that I should get a raster-type scan - move N steps in the X direction, move one step in Y, move N steps backwards in the X direction, move one step in Y, etc. this is started with an initial increment to Xstepper.TargetPosition.
The Xstepper.Stopped handler should fire N times, the Ystepper.Stopped handler should fire once, the Xstepper.Stopped handler should fire N times, the Ystepper.Stopped handler should fire once, etc.
What is actually happening is the Xstepper.Stopped handler fires N times, on the last time correctly incrementing Ystepper.TargetPosition; however, while the Y stepper is moving the Xstepper.Stopped handler fires constantly. Once the Ystepper.Stopped handler fires it correctly increments Xstepper.TargetPosition, but while the Xstepper is moving the Ystepper.Stopped handler fires continuously.
Hope this is not too confusing. I assume I am not using the separate channels of the 1062 correctly.