1062 stopped events mis-firing

Supporting Visual Studio on Windows
Post Reply
mikewu99
Fresh meat
Posts: 2
Joined: Wed Oct 31, 2018 3:59 pm
Contact:

1062 stopped events mis-firing

Post by mikewu99 »

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:

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
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.
mikewu99
Fresh meat
Posts: 2
Joined: Wed Oct 31, 2018 3:59 pm
Contact:

Re: 1062 stopped events mis-firing

Post by mikewu99 »

I found a workaround by dynamically removing/adding the event handlers so that they don't fire even if the event is raised when it shouldn't be. I'd still like to understand why the Stepper.Stopped events are being raised on one channel of the 1062 when a different channel is moving.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests