LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

simultaneous starting tasks

Hello. I wnat to measure analog and quadrature counter signal. For that, I set the timing for counter to the ai signal, so that both measure values are recorded at the same time. Problem is that I am starting the conter task before the ai tast.

 

Because of I am starting measurement during a movement, the counter task counts but the ai tast is not still working. Consequence is the counter signal does not start with zero. Is there a better way to start two tasks simultaneously?

0 Kudos
Message 1 of 3
(2,806 Views)

Not sure what you mean by "task" - are you running Unix/Linux or are you running windows?

 

In wondows (maybe Linux too) you can start a process "suspended" so that it's ready to go but isn't executing yet, so you can get other processes set up, or set properties on the process, before it actually launches.

 

If it's Windows, and you get a thread or process ID to the other "task" you can check for the other process/thread running or not, so that your counter process knows to check and wait for the ai process to actually be running.

 

Menchar

0 Kudos
Message 2 of 3
(2,799 Views)

>>Not sure what you mean by "task" - are you running Unix/Linux or are you running windows?

 

With task, I mean the tasks for analog input and counter input I have to create befort starting the measurement.

 

    DAQmxCreateTask("", &ni_ai);
    DAQmxCreateTask("", &ni_ctr0);

 

I am using the functions

    DAQmxRegisterEveryNSamplesEvent (ni_ai, DAQmx_Val_Acquired_Into_Buffer, AFTERNS, 0, CF_ai, NULL);
    DAQmxRegisterEveryNSamplesEvent (ni_ctr0, DAQmx_Val_Acquired_Into_Buffer, AFTERNS, 0, CF_ctr0, NULL);

for reading and writing in files. When starting ai first, there are ai samples but not counter-samples until the counter is started. So I have to start counter first. I think (but not know) that this is the only pssibility for measureing to each ai one counter.

 

But the problem is when starting counter before ai while a movement, the measurement do not begin with counter=0 because of the tasks are not started simultaniously.

0 Kudos
Message 3 of 3
(2,795 Views)