Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring DAQmx to generate pulse for fixed number of cycles.

Hello all,

 

I'm using NI 9472 to generate a Digital Pulse.

The expected pulse involves sequence of High and Low level which is to be repeated number of times(cycle). The number of Repetition or number of cycles of the sequence is fixed.

 

I can generate the expected Digital Pulse by configuring DAQmx Timing.vi in either Continuos or Finite Sample Mode.

 

Continous Sampling Mode - In this mode i can pass the data of one cycle to DAQmx Write.vi and it will continuosly generate the sequence repeatedly unless i stop it. My concern here is how will i keep the track of number of cycles been generated because i have to generate the sequence for a fixed number of cycles.

 

Finite Sampling Mode- In this mode i can the pass the whole data(required number of cycle of sequence) at once to the DAQmx Write.vi so that it will generate the fixed number of cycles of the sequence and stop. My concern here is that the data which i'm passing to DAQmx Write.vi is becoming very large since the whole pulse is of around 44 hours long. Can't i pass data of only once sequence to the DAQmx Write.vi and configure it to repeat it for a fixed number of cycles?

 

Please suggest what should be the best timing mode in this case. I have tried my best to explain my question, if you are unable to understand any part of it please reply to this post.

 

Thanks

0 Kudos
Message 1 of 4
(1,240 Views)

What's the total # pulses?  I'm pretty sure that you can set up Finite Sampling to keep regenerating from a small-ish buffer until it reaches a much larger total # samples.  You might have to explicitly set a DAQmx Write property for "regeneration mode" to allow regeneration.  (This is the default behavior for Continuous Sampling tasks, I'm not sure if it's also default for Finite).

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 4
(1,202 Views)

I have to generate multiple repetition(cycles) of the same pulse. The number of repetitions is pre-defined and i have to stop the task when these repetitions are generated. 

 

Number of Samples in 1 Cycle of Pulse is 23,350.

Total Number of Repetitions(Cycles) is around 20,000 so Total Number of Samples is going to be around 457,200,000.

 

I understand the use of Setting Regeneration Mode Property but i'm not sure about how i can Stop the task at the exact instant when 457,200,000 samples are generated. Can you please share an example code for it.

 

Thanks

0 Kudos
Message 3 of 4
(1,191 Views)

Start with one of the shipping examples (menu Help->Find Examples...) for Finite digital output.  Default values in that example write only 8 samples to the buffer while configuring the task to to generate 1000 samples.

 

That indicates that the # samples can be both exact and much greater than the # of values in the buffer.  I don't have real hw to verify, but the example did run without error for a simulated device.  I would have expected an error if it would have been necessary to explicitly set the property to allow regeneration (which the example doesn't do).

 

So you should be able to configure DAQmx Timing for Finite Sampling with ~457 200 000 samples, write your 23350 samples to the task buffer one time, start the task and let it do its thing.  The choice of Finite Sampling means the task will stop generating all by itself when it reaches your designated total # samples.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 4
(1,177 Views)