Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Daqmx write property: TotalSampPerChanGenerated

I've modified the ni example program (something like daqmx AO continuous non-regenerate) and I have noticed it is not displaying what I was expecting to see.  Here is a list of what I have done to it:

 

-added AO buffer vi and set to 100,000 samples

-sample rate 100,000

-sample to write per iteration to 2,000

-added TotalSampPerChanGenerated after start task vi

-added Space Available in Buffer attribute

 

Hardware: NI 9269, cdaq 9188

 

During the run I was expecting the TotalSampPerChanGenerated would increment by 2,000 after every iteration but what I got was 1,xxx (x being any number from 0 to 9).  Reading the number of samples written per channel terminal from the write vi showed a different result of 2,000. 

 

If left running for a long time the space available in buffer attribute will gradually decrease and I imagine it will eventually become an overflow error.

Also when generating a pps of my own with reference to gps pps I can see that it slowly lags behind the gps pps.

 

What can I do to ensure the daq is writing the correct number of samples because I assume it is reporting the correct amount (though not what I want to see) since space available in buffer is slowly being drained over time?

 

Here is a similar issue some one else posted in 2009

https://forums.ni.com/t5/Multifunction-DAQ/TotalSampPerChanGenerated-issue/m-p/881464/highlight/true...

 

Thanks

0 Kudos
Message 1 of 6
(4,929 Views)

Hello Lathan,

 

Could you please guide me to the specific example you are using on this case. And I want to make sure I have the same configuration as yours to try and reproduce the issue.

 

Also, have you tried with different samples to read and different samples to write per iteration. Does it throws the same behavior?

 

If you could share the VI that you have created or at least a capture of the block diagram, that would be great.

 

 

Regards,

 

David M.

National Instruments 

 

0 Kudos
Message 2 of 6
(4,833 Views)

Here is the modified example.  

 

I noticed the totalsampperchangenerated does not get updated until the second iteration but still not incrementing by the number of samples written.

 

I've tried to change the number of samples to write but no difference.

0 Kudos
Message 3 of 6
(4,769 Views)

Hello,

I've been playing around for awhile and did some reading and it seems daqmx uses a circular buffer for the read/write operations.  That may mean the TotalSampPerChanGenerated is likely true and the unwritten samples of one iteration are added to the front of the next hence my signals seems to be lagging more and more behind gps pps over time.  Let me know if this is true or not.

 

My question now is if there is anyway to clear the unwritten samples in the buffer after each iterations to ensure I write a new batch of samples in a continous generation non regen mode.  For example send 2k to Daqmx Write, device generates only 1,950 samples, clear the unwritten 50 samples and repeat.

 

Thanks

0 Kudos
Message 4 of 6
(4,698 Views)

Hello Lahan,

 

Now, I was reviewing similar situations as yours and came across this other forum on this matter. I think you could find it useful:

 

http://forums.ni.com/t5/Multifunction-DAQ/How-to-flush-output-buffer-optionally-resize-it-and-write-...

 

This approach is based on the  DAQmx control task.vi that is explain further on the next link:

 

http://zone.ni.com/reference/en-XX/help/370469AA-01/lvdaqmx/mxtaskctrl/

 

original.png

 

 

0 Kudos
Message 5 of 6
(4,661 Views)

Hello again,

 

It seems Daqmx is unable to generate the specified number of samples in the expected amount of time in Continuous Non-regen mode. 

I've tried 2K samples in 20ms (iteration duration), 10KS in 100ms, and 100KS in 1000ms, all at the generation rate of 100KS/s.

 

I am now using Finite Non-regen and that seems to work as I wanted but I am forced to start and end task so any changes to the samples will have to wait unti al new task starts.

 

0 Kudos
Message 6 of 6
(4,629 Views)