LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Phidget fails to attach in Labview

Hi,

I am using Labview (8.0) to run a stepper motor. The interface between the LVprogram and the stepper motor is a phidget. The Labview code comes from www.phidgets. I let the stepper motor run 1000 steps clockwise, then 1000 steps anticlockwise and so on. Each of the runs involves an "Automation open" at the beginning, then the instructions for the stepper motor and a "Close Reference" at the end.  Everything works fine for a couple of 10000 runs (takes between half a day and two days to fail) when the program hangs up.

When the LV-program hangs up it either fails to attach the phidget or an catastrophic error 2147467261 is reported.  

Has anyone an idea how to prevent this or how to workaound the problem? Perhaps resetting the phidget programmatically when an error occurs?

 

Many thanks

Holger

0 Kudos
Message 1 of 4
(3,115 Views)

I have been looking at the example:

MotorControlLVActiveX_Ex1_BD.png

And I notice that the errors out are not handled (I don't think you use this code).

 

Do you have to close and open the interface every time? One thing to look for is the actual number of the refnum (just typecast it to a U32), it might be that LabVIEW just runs out of resources.

 

Ton

 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 4
(3,100 Views)

Hi Ton,

thanks for your ideas.I am using this code. Have you got an idea how to handle the errors to achieve an automatic restart of the phidget once there is an error, i.e. when the program crashes? It is little use to me if I get an error report and the program stops. I have just introduced a case structure to close the reference in case the attachment fails (IsAttached=false). Let's wait and see whether it works better.

I have the hunch that the activeX part used in the motor control collides with Windows XP, but I am not a specialist in this area.

I have to close the interface every time as in the real application the stepper motors are rarely used and should be kept shut off most of the time. 

Holger

0 Kudos
Message 3 of 4
(3,086 Views)

Hello Holger,

 

The Error Cluster can be used just like a standard cluster.  You can wire the error cluster into a 'Unbundle by name' to learn more about the current error.  The error cluster is a bundle of a Boolean, Numeric, and String.  The Boolean states whether an error has occurred, and the numeric gives the number of the error.  You can therefore use this data to control the execution of your VI, or to even clear the errors.

 

When working with motors and other actuators it is helpful to physically disable the motors on the outside of your While Loop.  The code in the While Loops will run repeatedly, and as soon as you press 'Stop' or exit the While Loop, you can execute a single disable command on the right hand side of the loop.

 

I have opened the example called "MotorControlLVActiveX_Ex1" and made some small alterations to make the VI more readable.  I have also wired the error clusters in a useful manner, as well as added the Simple Error Handler.  In the While Loop, you will see a 'Unbundle by Name' in place, ready to be used.

 

Regards,

George T.
Senior Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 4 of 4
(3,064 Views)