11-28-2005 06:55 AM
11-28-2005 07:55 AM
11-29-2005 09:56 AM
Hi Thomas,
Thanks for posting on the NI discussion forums.
In answer to your question, although it is not necessarily incorrect to include all of the code within your loop, it is often not the suggested coding method. In your case it would be advantageous to have some of your code outside of your while loop, namely the 'Create DAQmx Channel' and 'DAQmx Clear Task' VIs. With these VIs in the loop, the code will be starting the DAQ card, writing a point, then stopping the card on every iteration. This will cause your code to operate inefficiently.
I have modified your code a little so that your card starts and waits for new values to be passed to it as your loop iterates. Once the loop stops, the card will stop and the task will be cleared.
The revised method will result in fewer calls to the drivers, so will be inherently less likely to cause error. My suspicion is that your code was making driver calls to strat-write-stop the card so many times, and so quickly it may be the cause of the error you are seeing.
Please try the attached VI and let me know how you get on. If you have any further issues then please let me know, I will be happy to help further.
Thanks,
11-29-2005 10:06 AM
Hello Rob.
I have intergrated your code with the rest of my VI, and there have been no errors since.
The advice on the loops was exactly what I was after!
Thanks for the help, I really appreciate it.
Best Regards
Thomas
11-29-2005 11:08 AM
Hi Thomas,
I'm glad it worked for you. Happy to be of help!
If you have any further issues then please do contact us again.
Cheers,