Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Continous analog generation without using a status polling loop

Thanks for looking!
 
I am converting Traditional Daq to Daqmx.
 
How does one keep a continous analog output generating after a time without  having a status polling loop?
 
I am refering to the labview 7.1 shipping example "Cont Gen Voltage Wfm - Int clk-OnBoard Regeneration"
 
I would like to set a property instead of polling the status and leaving loops running to close later.
0 Kudos
Message 1 of 16
(4,006 Views)
samadams,

You do not have to check whether or not the task is done - this is only recommended in case an error is thrown while performing analog output. You simply need to stop the task at the end of the output using the "DAQmx Clear Task" VI. I would do this in whatever code terminates your application.

Hope this helps,
Ryan V.
National Instruments
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
Message 2 of 16
(3,993 Views)

The analog output stops itself after 5ms without polling.  If I poll the status the analog output runs continuous.

 

See example code.

 

 

0 Kudos
Message 3 of 16
(3,985 Views)

samadams,

The problem you are seeing when you don't poll, is that your VI finnishes execution immediatly.  When you poll, you have a loop running which keeps the VI running until you press stop.  When the VI finnishes running all tasks created in it are destroyed.  This will stop the generation.  Your VI should work just fine if you either add a loop with nothing but a stop button and wait ms timer to your false case, or if you completely removed the polling you are doing in your true case.  However, it is amost always preferrable to use some sort of polling in your loop so that you can recieve notification if your task errors.  I have modified your VI to illistrate my point.

Hope this helps,
Dan

Message 4 of 16
(3,981 Views)

samadams,

Here's one more modification where I've made the option to poll configurable (if you decide that you don't want to poll the task).

Dan

Message 5 of 16
(3,981 Views)

Thanks for passing along your knowledge. 

The vi stopping execution was causing the task to be destroyed.

I will keep this in mind when testing future code blocks.

 

 

0 Kudos
Message 6 of 16
(3,964 Views)

One more question.  How do you get the actual frequency generated by the analog output? 

I am using a PXI chassis and only certain multiples of the clock frequency are available at higher (10khz or more ) frequencies. 

Traditional daq  had a indicator of the sample clock rate used. 

I would like to know how to get this with Daqmx.

See attached example code snippet.

 

 

 

0 Kudos
Message 7 of 16
(3,963 Views)
samadams,

The DAQmx driver does its best to get the sample clock as close as possible to your desired sample rate. After setting it, the exact value can be read using a DAQmx Timing property node set to SampClk.Rate. Note that this is not the frequency of your sinusoid, but rather the rate at which samples are being generated. From this number, using the number of samples per period, you should be able to determine the exact frequency of your output waveform.

Hope this helps,
Ryan V.
National Instruments
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
Message 8 of 16
(3,952 Views)

Thanks ryan.

 

This part of the code is sucessfully completed  (converted to Daqmx) Thanks for your help!

0 Kudos
Message 9 of 16
(3,937 Views)
>When the VI finnishes running all tasks created in it are destroyed.  This will stop the generation.

Hi.  I'm seeing this problem as well.  However, I would like the generation to persist after I stop the VI.  Is there any way to preserve a task once a VI is finished running?

I would like to have my first subVI initialize generation and have a separate subVI close the task at a later time.  I made this work using a 6733 board and traditional DAQ, but I'm now trying it with a 6221 board and DAQmx.  I've been (unsuccessfully) searching the DAQmx property nodes for a solution.

Any help is appreciated.  Thanks.
--
Pascal
0 Kudos
Message 10 of 16
(3,723 Views)