LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Two output tasks on one device

I would like to learn the best way to configure two output tasks on one device. Both tasks employ the same channels. Task 1 outputs a 2D array (raster pattern on some channels and DC on others) for which the array values and array timing may change during the rastering. Task 2 outputs only DC values in a 1D array: one value for each channel. There is a Boolean that turns the rastering on and off.
    Should I have two separate tasks or one task where the DAQmx Timing and DAQmx Write change according to the raster on/off switch? Do the tasks need to Start each time an array value is changed? I've come close to making it work both ways and the major problem seems to be a "resources are unavailable" error when I want to stop everything and send 0 to all the outputs.
Thanks, Peg
0 Kudos
Message 1 of 5
(2,393 Views)

since you have two seperate tasks sharing a resource you must stop and clear the first task befor configuring and starting the second task.  This should be no problem if you dont mind the overhead of recreating tasks.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 5
(2,385 Views)
Dear Paul,
    Thanks for your response. I have managed to produce a vi that seems to work with just one task. When changing back and forth from rastering to non-rastering, the task is stopped and started, but never cleared until the vi ends. What I don't understand is why new values are output even though I don't call Start Task each time a value is changed. I'm happy it works but I'm nervous that I don't know why. I have attached it in case you (or anyone) has the patience to take a look.
Thanks,
Peg
0 Kudos
Message 3 of 5
(2,376 Views)
I don't see anything wrong with your code.  When you update the data, the new values will be put out because you are writing that data into the DAQmx write VI on every iteration.  You don't need to start and stop the task in order for the changes to take effect.  They will occur as soon as the new data is written into the buffers, and the DAQ outputs get to the new data in the buffer.
0 Kudos
Message 4 of 5
(2,362 Views)

Yes you dont need to stop and restart a task if all you are doing is changing a property, I do this often when I am controlling a stepper motor where I change the timing of a continious digitasl pulse train out without stopping the output.  There are a few good examples of this for digital output where the buffer is updated on the fly (inside of the write loop).

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 5
(2,346 Views)