To ensure accurate response from the tone measurement function, DFGray is right that one of the most important things to consider is ensuring you are capturing a sufficient number of periods of your signal.
In your code you have chosen not to configure a record length or a sampling rate and are using the read function to read all available samples. So the NI-5105 will default to 1Mhz, and 1000 samples which will be brought in each iteration of the loop. Since your frequencies are fairly slow you are getting much less than 1 period. You need to have approximately 2ms of data to capture a single period of the 512 hz waveform, but at 1000samples/1Msamples/second you are only getting 1ms of data or half a period.
So to get reliable and steady numbers you will need to greatly increase the number of samples you collect, or reduce your sampling rate or both to ensure you capture 10 or more periods of your signal, which is eqivalent to 20ms or more of data.
By setting the sampling rate to 100ks/s and reading 10k samples of data (100 milliseconds) using the "configure horizontal timing.vi" function I was able to accurately measure the 3 tones. I will attach a screenshot for your reference.
A few other things to note in the screenshot are that I set the vertical range to 6 instead of 5. Each digitizer has a discrete number of ranges you can select from, they can be found in your specifications document or the High Speed Digitizers Help. If you choose a number other than one of those ranges, the digitizer will coerce up to the next available range. In the case of the NI-5105, 5V will be coerced to 6V. I also added error handling to the stop condition of the loop with an "unbundle" and "or" function. This will stop the application if an error occurs. You may already be aware of both of these points, but they are common issues I do run across so I thought I would point them out.
- Jennifer O.
Message Edited by Jennifer O on
08-06-2008 04:45 PM