LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control loop from task: Is it possible to change the sampling rate online?

Hello everyone!

 

I have two tasks and a timed loop that I need to synchronize to get meaningful results. I can synchronize the timed loop and the input task with the Create Timing Source VI.

 

My application would be a lot more effective if I could change the task's sampling rate online. I have tried the following: Inside the loop, stop the task, change the rate with a property node, and restart the task right away. Later I would adjust the loop's period so that its actual duration remains the same. This, however, leads to an unpleasant error -805 (timing source was cleared) and the abortion of the timed loop. Is there a workaround for this?

 

And another question: If the second task has a (30-40x) higher rate than the first, can I still use the first timing source in the second task (to synchronize both)?

 

Thanks a lot!

0 Kudos
Message 1 of 7
(3,511 Views)

Hi SLS,

 

do you use this vi?

Please post your code to let us see what exactly you are doing.

 

 2013-09-26 10_04_54-Kontexthilfe.png

 

Best regards,

Peter

0 Kudos
Message 2 of 7
(3,409 Views)

Hello Peter, thanks for your reply.

 

I was not clear enough: I was referring to the DAQmx create timing source VI. I was trying something like this:

 

sample.png

 

But the error was thrown as soon as I stopped the task.

In the meantime I came to the following workaround: To put the timed loop inside a while loop. Then, to change the rate, I would just quit the timed loop, change the sample rate in the while loop and let the timed loop restart. Would work... But that's really bulky.

0 Kudos
Message 3 of 7
(3,402 Views)

There are multiple ways to synchronize loops.

2013-09-26 11_30_26-Funktionen.png

 

Do you have special requirements which make it necessary not to use those?

 

Best regards,

Peter

0 Kudos
Message 4 of 7
(3,396 Views)

Well, what I'm trying to synchronize are not independent events in time which have to happen in a certain order, but the ticks of the timing sources. I don't know if those VIs are able of doing such a thing?

0 Kudos
Message 5 of 7
(3,394 Views)

I'm sorry, but I still don't know what you are trying to do.

You would like to "synchronize ... the ticks of the timing sources".

 

This sounds like you are trying to synchronize the sample clocks of two devices.

Please be more precise.

 

Best Regards,

Peter

0 Kudos
Message 6 of 7
(3,382 Views)

hello, 

 

I think you are trying to do this (attached file)

0 Kudos
Message 7 of 7
(3,361 Views)