05-23-2012 01:11 PM
I am trying to generate a motion code which synchronizes a contoured motion with data acquisition using breakpoints; the VI (attached) is loosely based on the 25229.vi provided on ni.com. I am using a PXI-7354 motion controller and running Labview 2011. I can run the VI once (successfully), complete the desired motion, trigger the breakpoint, and take data with no error messages. Then if I try to run the same VI immediately afterwards, the motor will move only 5-6 steps and then stop; no data is collected and no error messages are displayed. Then when I run it a third time, the motion and DAQ complete but I get error messages at the Clear Buffer.vi saying that the buffer is in use (Error -70061). I also get Error -70137 at the CheckBuffer.vi, which I think is because it is still monitering the buffer after the ClearBuffer.vi fails.
Do I need to include an additional initialization/clearing of the buffer somewhere?
Thanks,
Matt
Solved! Go to Solution.
05-24-2012 10:58 AM - edited 05-24-2012 10:59 AM
Hi MattCS,
I believe you are seeing this undesired behavior because you are not initializing your shift registers. The data from your last run will still be saved in your shift registers so next time you run it will start from where it left off. So if you push the stop button while running the VI the first time it will stop and everything works, but then the second time you run the VI the while loop will stop after its first iteration since its referencing the old value in the shift register. Also if you ever have an error in the while loop it will continue to be there every time you run the VI. Please try the changes circled in the image below and see if that help.
Tim O
05-24-2012 03:47 PM - edited 05-24-2012 03:48 PM
That was exactly the problem - thanks very much Tim!
Cheers,
Matt