From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring DAQmx to generate fixed cycles of Pulses.

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 5
(1,149 Views)

I would be tempted to suggest that you use the Continuous Sampling (since your timespan is very large), and make use of the "Total Samples Per Channel Generated" property of the DAQmx Write class.

 

You can wire a property node with the "DAQmx Write" class and then find this under Status > Total Samples Per Channel Generated".

That might give you what you want?

 

cbutcher_0-1605972513140.png

 


GCentral
0 Kudos
Message 2 of 5
(1,125 Views)

Will "Total Samples Per Channel Generated" property of the DAQmx Write class truly give the total number of samples generated from the start of task even if the task is continuosly generating pulses for a very large time span?

 

The output of this Property can be compared with total number of pulses expected. And the moment it exceeds the the target number of pulses the task can be stopped. This sounds good but there are chances that the task will be stopped after some extra pulses are given ? Can we stop the task instantly once the target number of pulses are generated ?

0 Kudos
Message 3 of 5
(1,122 Views)

If the number of samples that you write at once is sufficiently large, then you should be able to check and stop correctly (i.e. if you don't write more than expected).

However, the property node in my screenshot might not be the best choice - it looks like it depends on the number of samples that have actually been output.

 

With some more testing, I'd guess the "Current Write Position" might be a more useful property (so sorry for the bad suggestion). That value increments when you write the samples using DAQmx Write, not when they actually "come out" of the terminal, so if the chunk size is at least a few hundred milliseconds I'd guess (no promises) you'd be ok.

 

If the samples you're generating are multiple repetitions of the same values, you can use the Regeneration Mode (I think this defaults to Allowed/On on hardware that supports it) to avoid having to repeatedly call DAQmx Write, and instead just write once and keep reading the number of samples written.

If you do this, take care to avoid an unnecessarily greedy loop (i.e. no waiting, just checking the counter over and over, burning 100% CPU on one core...).

 


GCentral
0 Kudos
Message 4 of 5
(1,105 Views)

Yes, i have to generate multiple repetitions of the same value. Please refer below image to get more clearity on it

 

gargrahul_0-1605981422011.png

As can be seen above one cycle will involve around 23,530 sample value. I want to generate around 20,000 repetition of the same data. The total number of samples generated for 20,000 repetitions will be around 457,200,000.

My requirement is to stop the Task when all the samples corresponding to 20,000 repetitions are generated.

I'm not sure but if 457,200,000 sample values can be passed to the Write DAQmx.vi in one go by setting the DAQmx Timing.vi in Finite mode then my problem is solved. Otherwise as you said i have to configure DAQmxTiming.vi in continuous Mode and allow Regeneration.

 

I cannot interpret how i can use Current Write position property because it points to buffer position. Can you please post an example of it for the current case?

 

Although trial needs to be taken but i feel TotalSamplePerChannelGenerated Property can give satisfactory Result. I have used this property in the image.

 

0 Kudos
Message 5 of 5
(1,074 Views)