Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Need to capture 5000S/sec using a 9215 analog input module

Using a 9215 module I am unable to capture 5000S/sec into an array indicator.  In the NI Example Finder using the Cont Acq&Graph Voltage-Ext Clk.vi I have the timing parameters defined as such: Clock Source = OnBoardClock, Rate = 5000 Hz, Samples to Read = 5000 with the sample mode defined to be continuous.  I have connected to the outside of the while loop a 2D array indicator with indexing enable.  Once the loop stops the array does not show the 5000S/sec I am trying to achieve.  How do I capture 5000S/sec in an array using the DAQmx functions?

 

Jeff

 

0 Kudos
Message 1 of 7
(3,674 Views)

Hi Jeff,

 

I am going to ask you some questions to try and set up your scenario.  Is your 9215 in a CDAQ chassis, ENET, WLS, or USB form factor?  You are choosing an example that is built to use an external clock, yet it looks like you wish to use the on board clock, have you tried the Cont Acq&Graph Voltage-Int Clk.vi? 

 

You have selected a continuous acquisition of 5000 samples at 5000 Hz, which equivocates to 5kS/s, is all you want 5000 samples or did you want several seconds of data?  With continuous acquisition in a while loop, you will see your acquisition gather 5000 samples for every second the program runs.  If you wish to only gather 5000 samples, try using a finite acquisition without the while loop.  What is the while loop stop condition?  

 

Another thing that would be helpful is to understand your results.  What is shown in the array of data when the program finishes execution?  Are you seeing too many samples or not enough?  

 

Let me know if you have any questions, thank you.

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 2 of 7
(3,648 Views)
Hi Kyle,

 

Thanks for your response.  The 9215 is in a CDAQ chassis along with a 9263 and a 9481 module.  As for the clock source I'm not sure how to use this input.  The Cont Acq&Graph Voltage-Int Clk.vi was not working for me so I went to the Cont Acq&Graph Voltage-Ext Clk.vi but it only allows me to use the Onboardclock source.

 

I am looking for a sample rate of 5kS/s over a period of several seconds.  For example if a acquire data for 60 seconds I should see 300,000 elements in an array but I am not seeing that.  You mentioned with continuous acquisition in a while loop, you will see an acquisition gathering of 5000 samples for every second the program runs.  However I am only seeing 65 elements with the parameters mentioned in my previous posting.  As for the stop condition I am ramping up to a maximum voltage on the 9263.  When the max voltage is reached the stop condition is true exiting the while loop.

 

I am only using one channel on the 9215 which if I'm not mistaken is capable of a sample rate of 20kS/s.  How can a capture this into an array?

 

Regards,

Jeff

 

0 Kudos
Message 3 of 7
(3,643 Views)

Hi Jeff,

 

Why does the internal clock example not work?  Does it throw an error?  65 elements versus 5000 is very large, so I'm wondering how you are displaying that information.  You say you have a 2D array indicator, are you acquiring off multiple channels?  If you are doing one channel, it should be a 1D array or waveform, so you might want to try a single channel first to see if you get the same results.  You mention you have indexing available, are you using a for loop somewhere in your code?  It might be helpful to post the code you are using so I can run it on my side and see if I get the same results.  Let me know, thank you.

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 4 of 7
(3,631 Views)
Hi Kyle, 

The internal clock example does not error out when I run it.  Using the internal clock example please tell/show me how to fill a 1D array with 300,000 elements of data at a rate of 5kS/s (60 seconds of data).  In other words please tell me how to set up the internal clock example with a 1D array capturing 300,000 records over a period of 1 minute.

 Thanks,

Jeff

 
0 Kudos
Message 5 of 7
(3,602 Views)

Hi Jeff,

 

I want you to try your setup with the values I have set below.  I will include the code for this to show that it is the same code as the example, with the slight modification of showing the size of the array coming out of the DAQmx Read and also the building of an array of points so that the output will be a complete array.  As a side note, when testing this out I would suggest removing all modules but the module you are testing just to isolate the one card, then add the modules back in when you have the program working correctly.  The main difference here is that the read samples is 10x less than the sample rate.

 

VoltageWfmEx.png

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 6 of 7
(3,586 Views)
Hi Kyle, 

Thanks for the example!  My code now works!  It appears I needed to use the functions “Get Waveform Components” and “Insert Into Array” along with a shift register in order to get the data out at the rate I was looking for.

 

Thanks again,

Jeff

 

0 Kudos
Message 7 of 7
(3,569 Views)