03-05-2020 05:59 AM
Hi
I have this subVI that is suppose to output signals to my cDAC.
Output_Waveform.vi block diagram
As the above block diagram shows at the end of each loop, I get a pop up message to continue or stop.
The problem I have is that after the first loop, I get the pop up message and if I press 'continue', I get the following error message:
I do not understand why the task I have passed to the subVI is not being recognised for the second loop.
Where did I go wrong?
Solved! Go to Solution.
03-05-2020 06:10 AM
Hi sherzaad,
@sherzaad wrote:
Where did I go wrong?
It's not a good idea (aka: it's a very bad idea) to delete DAQmx tasks in your loop, but still want to use the DAQmx task reference in the next iteration…
03-05-2020 08:02 AM
@GerdW wrote:
Hi sherzaad,
@sherzaad wrote:
Where did I go wrong?
It's not a good idea (aka: it's a very bad idea) to delete DAQmx tasks in your loop, but still want to use the DAQmx task reference in the next iteration…
so if I understood you correctly, then deleting this block should solve my issue, right?
03-05-2020 08:15 AM
Hi sherzaad,
@sherzaad wrote:
so if I understood you correctly, then deleting this block should solve my issue, right?
Don't delete the DAQmxClear function, but move it after the loop.
You also should move the DAQmxTiming function before the loop. You also don't need to wire the N input of the FOR loop.
(Hint: Use MatrixSize instead of ArraySize when you need the number of rows/columns as separate wires…)
03-05-2020 09:45 AM
I would have placed a DAQmx Stop where you had previously placed DAQmx Clear. (Although I'm actually not 100% sure it'll be necessary for a Finite Sampling task which might automatically revert to stopped state when you "wait until done".) The task ref remains valid and suitable for reuse after a Stop but not after a Clear.
I also agree with all the points GerdW already made.
-Kevin P
03-06-2020 03:34 AM
@Kevin_Price wrote:
I would have placed a DAQmx Stop where you had previously placed DAQmx Clear. (Although I'm actually not 100% sure it'll be necessary for a Finite Sampling task which might automatically revert to stopped state when you "wait until done".) The task ref remains valid and suitable for reuse after a Stop but not after a Clear.
I also agree with all the points GerdW already made.
-Kevin P
Yeah... I realised (better later than never!) that I should inlcude the DAQmx Stop block.
All working fine now.
Thanks @GerdW and yourself!