LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While Loops & Labview "Unable to Write to Node"

Hello everyone.
 
I am having a problem with my VI. I am running 3 anlogue Inputs, 2 anlogue ouputs, 2 digital inputs and 2 digital outputs. Sometimes when  my VI is running it will crash after several minutes, and an error comes up "unable to write to node, analogue write 1 channel 1 sample. I attach the analogue portion of the VI. 
 
I was also wondering about the while loops. Is it ok to have all the code inside only one while loop as I have done? 
 
Many thanks.
 
Regards
Thomas 
0 Kudos
Message 1 of 5
(2,649 Views)
Actual Error
0 Kudos
Message 2 of 5
(2,640 Views)

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,

National Instruments | Northern California
0 Kudos
Message 3 of 5
(2,607 Views)

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

 

0 Kudos
Message 4 of 5
(2,602 Views)

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,

National Instruments | Northern California
0 Kudos
Message 5 of 5
(2,587 Views)