LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DC pulse output analog input

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,

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

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. Smiley Wink

Cheers! 

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 5
(3,918 Views)

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!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 3 of 5
(3,897 Views)

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,

0 Kudos
Message 4 of 5
(3,894 Views)


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.


One way I'm sure can work uses "Continuous Acquisition.  "See: "Cont Acq&Graph Voltage-Analog SW Trigger.vi" example.
If the DAQ-rate is known before leading-edge of pulse, then, start the Acquisition at whatever frequency's needed, making the input buffer bigger than required, then when the end-of-pulse arrives, reach-into the input buffer and pull-out the "pulse".  With a little work you may find an example that uses a "stop-trigger"
 
There may be a "slick" way to do this without "Continuous Acquisition" using a parameter called "Pre-trigger" scans.  My first LV project (circa- 1990) used this, and I've done it with at least one "E"-series board, but not yet under DAQ-MX - and couldn't find an example with Internal clock, External Trigger.
 
Cheers! 

 
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 5 of 5
(3,878 Views)