10-16-2007 01:58 PM
I am using a 6221 PCI DAQ card and attempting to put out a DC level for a several different times. During the output of each DC level I need to sample two DC inputs via the analog input. Most of my DC levels last for 100s of seconds each and a sample rate of 1S/s on the analog inputs is OK.
My problem arises when I attempt to place a 30ms pulse into the analog output. During this 30ms I need to increase the data rate of the analog input.
I have attempted to use a while loop to control the time between changes but can not get the sampling rates correct to allow for the correct number of samples.
On suggestion has been to take all data at a fast rate. The test will last in excess of 3000 seconds and I get way too much data at a fast rate.
I need to be able to change data rates on the fly as I change the DC levels.
Does any one have any ideas?
Thanks,
10-17-2007 01:18 AM
Hi John,
It sounds like "we" detect an event - the end of pulse - and only then know how fast we should have been sampling(?) The advice to always sample fast is right - it's not necessary save the all the data. If sampling at 65536 samples/sec, you could configure your input buffer for 4-seconds - 262144 samples. Read 65536 samples per read. Save every sample of the 1st read, save every-other sample of the 2nd read, save every 4th sample of the 3rd read, etc. At 65536Hz, from the 17th read on, just save one sample per read. When the pulse has ended, then go back and reduce the starting data as needed. If you want samples every 500ms for pulses up to 34 seconds, you could save every sample for the first two seconds, then every other sample for the next two seconds, etc. Of course the sampling rate can be changed, but this strategy will work best if fundamental sampling-rate (Hz) is a power of 2. ![]()
Cheers!
10-17-2007 11:06 PM
Hi John,
Sorry, neglected to mention a key word: "Continuous Acquisition" - it's how to sample forever. There are many examples. A four second input buffer is probably overkill, two-seconds may be plenty, but it doesn't cost much memory and gives your app time to recover if the OS suddenly demands the CPU. You only need to read the input-buffer fast-enough to keep new data from over-writing old. So if you can read/process one-second's-worth of data, in less than a second, you can acquire data "very-fast", forever!
Cheers!
10-18-2007 07:31 AM
No, I know when the pulse is to arrive before it happens. I have an array of data including voltage outputs, duration of output, and what data rate to sample at.
My problem is insuring the sampling starts before the pulse arrives and continues for the duration of the pulse.
Thanks,
10-18-2007 11:51 AM
John@Saft wrote:
I know when the pulse is to arrive before it happens. I have an array of data including voltage outputs, duration of output, and what data rate to sample at.
My problem is insuring the sampling starts before the pulse arrives and continues for the duration of the pulse.