09-15-2011 08:40 AM
Dear Senior Engineers,
I got a problem using ni6143 with the on-demand method based on the file "aiex2.cpp" provided on the website. It is about the actual rate of sampling. It is said on the data sheet that the ni6143 could have the ability of acquiring data with the speed of 250kHz per channel, meaning that each data could be acquired in 4e-6 second. Then here is my question: if I use all the 8 channels (each at 250kHz), does it mean that I have to use 8[channels]*4e-6[seconds]=32e-6[seconds] to get a set of data (one data in each channel), or I can use only 4e-6[seconds] to get it? I use the on-demand method based on aiex2.cpp for the testing experiment. Inorder to check out what exactly is the rate of sampling, I use the digital I/O to set a signal at high before on-demand acquiring, and set it low when the data acquiring is finished. It shows on the oscillograph that the actual time for acquiring a set of data (one data in each channel) when I use 8 channels (each at 250kHz) is about 32e-6[seconds], which means that the device is acquiring data one channel by one channel, not simultaneously. I want to know whether there is any parameter I have to set with the registers, or the on-demand method could not acquire data with 8 channels simultaneously. My code is exactly the same with the file "aiex2.cpp".
Thanks for help.
Solved! Go to Solution.
09-28-2011 10:37 AM
The NI 6143 is advertised as 250KSamples/second/channel. This means that the on-board clocks on the board are able to trigger each ADC on the board to acquire at a rate of 250KSamples/second and each ADC will be sampling simultaniously with the other ADC's configured for the measurement.
That said, it's impossible to achieve these rates using the on-demand method. Instead of an on-board clock triggering the measurement, a register access is doing the job. A register access of course takes time. Then reading the data from the FIFO takes time (remember, the example reads the data before telling the next measurement to happen).
What are you trying to accomplish?
10-13-2011 09:52 AM
Thank you very much for your reply
I am trying to write a program to control a 7-axies motion system. The servo-period of this system is 200us, and I need to sample 5 times for each channel to reduce noise within a servo-period. If the on-demand method could not be used for simultaniously sampling at 250KHz, could you give me a suggestion for solution?
10-18-2011 09:32 AM
Since you need a faster rate than you can achieve with the on-demand access. You should use aiex1.cpp. It demonstrates how to configure the on-board clocks to trigger the acquisitions on all ADCs at the same time. The rate is configurable, so you can change it to meet your needs.
Is there a reason why you can't use this mode?
10-18-2011 08:06 PM
Thanks again for your kind and patient reply
Actually I am now trying to ues the mode described in aiex1.cpp. But the example just teaches me how to acquire data with a fix number of samples. If I want to use it in a servo-period system that runs continuously, meaning that I need to acquire a set of data in every servo-period, what should I change in the codes?
10-28-2011 12:44 PM
Yes, the example only shows how to acquire a fixed number of samples. One of the function calls that sets up the acquisition will allow you to set the hardware to continuously acquire...
aiNumberOfSamples(theSTC, numberOfSamples, kFalse); //false for finite, true for continuous
So you can set this to kTrue to make the acquisition continuous. In order for the task to keep running, your application needs to be able to access the data FIFO fast enough so that it does not overflow.
Secondly, every continuous acquisition must end sometime. When your loop has acquired all the data that the application want, it must issue some commands to stop the acquisition. The STC manual details the steps that can be taken to stop a continuous acquisition.
http://www.ni.com/pdf/manuals/340934b.pdf (check section 18.104.22.168)