From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

two DAQmx tasks with special timing relationship in one vi

Solved!
Go to solution

Hi everyone

 

my mission includes two DAQ task, one is AI (voltage input), the other is DO(counter PWM output). the problem lie in the somewhat time sequence. that is,

 

in a word, the recording (AI) is a little longer than generating (DO).

 

 

 

for clear description, there are three episodes, 

 

1. recording began and last  50ms, at 1000Hz rate,

 

2.the PWM generation began after recording began 50ms, the PWM frequency and duration could be set by a controler, meanwhile, the recording go on

 

3.when the PWM output ends, the recording   keep last 100ms, then recording completes.

 

the point is that the recording couldn't be disrupted by the PWM in the whole mission.

 

How could I  arrange the two task ?

 

my card is a M series one.

 

THANK YOU advanced

 

 

0 Kudos
Message 1 of 5
(4,495 Views)

Create both tasks and have them in two independent loops, each with their own start/stop controls.  Add a third master loop that will start and stop the other two loops in the sequence and timing you desire.

 

Can you post your code?

 

 

Randall Pursley
0 Kudos
Message 2 of 5
(4,255 Views)

Hi  bwyy

Can you try this procedure. The first loop for Data acquisitin and the second loop for  PWM.

 

0 Kudos
Message 3 of 5
(4,194 Views)
Solution
Accepted by topic author bwyy

Sorry I made mistake. here you can find it.

Message 4 of 5
(4,191 Views)

Thank you, Ali!


I think your advice is a good solution that satisfied my demands. Your example illustrated the time orders of two task clearly.

 

I am sorry to replyed and accepted your advice so late. It has been four years that the project had done. after that, I devote myself to pure biology research. so I had not touch LabVIEW, neither accessed this forum.

Actually, I addressed the question in another way in several days after I posted my question. that is I use another onboard counter's (counter1) output as a gate signal to the counter (counter0) that serve as the PWM. on this condition, only when the counter1 is 0 status, the counter1 release PWM signal.

So my solution is a hardware-based one, that has accurate synchrony. while yours is software-based one, that doesn't occupy other hardware resources.

Thank you again.

0 Kudos
Message 5 of 5
(2,357 Views)