LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reserving tasks

Here is a condensed version of my issue:

 

Hardware:  cDAQ-9174 USB, module of concern, NI-9401 used as a counter/timer module.

Software:  LabVIEW 12, Windows 7

 

What I need to do:

Ctr0 is used to generate a finite number of pulses to turn a motor X distance.

Ctr1 is used to read a digital linear gage.

 

Everything worked fine until I wanted to generate only X number of pulses. Before I had the task set up for continuous pulses and was watching the linear gage until the desired distance was seen, then I would stop the task. I also set the on-time, off-time of the pulse (velocity).

 

Beginning of program I use the DAQmx Control Task to "reserve" the task.

To start motor, I'm using the DAQmx Write, Counter/Timer, 1Chan N Samp.

 

To set the number of pulses now, I'm using the DAQmx Timing, sample mode = finite, samples per channel = distance.

 

It works once, then I receive error -201133 which says I need to reserve all tasks that use this device. I am at the beginning of my program, once for each counter.

 

In my main loop I'm using DAQmx Is Task Done? to determine when I need to go to the next step in the program. When I see the task is done, I stop the task, which shouldn't make a difference (no error reported) if the task is already done.

 

As soon as I try to write the number of pulses to the task again, I get error -201133.

 

I'm trying to explain this without having to copy/paste parts of my program for visual aid, but I'll try to do that.

 

This is the first time I've used the cDAQ so I've never had to "reserve" hardware.

 

Any suggestions are appreciated!

 

Thanks,

Teri

 

Download All
0 Kudos
Message 1 of 3
(2,103 Views)

I've attached a few jpegs to show what I'm doing.

 

CT01 - reserving task, starting task when time to run motor

CT02 - looking to see if task done

CT03 - stopping task

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

You should try closing the task and opening it again between each reading sense you want different sample clock parameters.  I bet that would fix your issue.

TimC
National Instruments
Applications Engineer
0 Kudos
Message 3 of 3
(2,053 Views)