Page 1 of 1

LabView Example for Steppers incorrect

Posted: Mon Jun 10, 2013 12:04 pm
by stevencovert
Hi,

I came here for some general advise about structuring code in LV (2012) because I found the example code fails in the same way as my code :P

The problem is the StepperOpen.vi in the Init section of the Case structure. It works until you try to change anything, in which case the state machine goes back to INIT, and calls the StepperOpen again. This crashes LV, because it is opening a reference that is already open.

I was trying to find a VI that could tell me if the handle is already open, and putting a test case in front of StepperOpen. Which leads me to my real question about structuring a LV program that calls a .DLL. My code is similar to the example, a state machine. There is an OPEN, a while loop that continues until STOP is pressed, then CLOSE. If something goes wrong and the program stops, the handles (or references) are still open and crash the next time you run the VI. Looking for a good way to detect this.

I have built an XY stage using the Phidget controllers and LabVIEW. It is pretty cool! I use a chart with cursors. I "grab" a cursor and move it withing the chart and the steppers follow along. I know my travel (and thus max counts). Set up the chart to show 0" to 1.000" (my range). So the chart is now your XY space. Now need to "solidify" the code :)


Any ideas?

Thanks,
Steve