01-22-2010 09:41 AM
Hello all,
I'm working on a code that does edge counts on the cfo input of USB 6009. I have a signal coming into the DAQ every 200ms. However the VI calculation for the difference in time fluctuates between 180ms and 200ms. I'm looking if somebody explain why is my time diff changing. Please post your inputs.
thanks.
01-22-2010 11:08 AM
to add to my previous question, it looks like the time difference is rounding to 1/64th of a second. Any thoughts?
01-22-2010 11:32 AM
I would imagine you are doing this on a Windows machine? Windows is a non deterministic operating system, meaning things will not happen when you tell them to but can vary depending on what other processes you have running. Because you are using software to timestamp your events it seems you are falling victim to this. I'm actually impressed you are getting within 20 ms of the actual values.
What you really should be doing if measuring the period of the signal with a counter, this will perform a hardware (real time) measurement that can be accurate to within the accuracy of the counter clock. Unfortunately the 6009 only supports the edge count task that you are currently doing. I would recommend upgrading to a card that is more suited to your application. Alternatively you could switch to a real time operating system which would allow for more accurate timestamps to your edge count events.
01-22-2010 12:49 PM
Another approach might be to record the signal on an analog input. Then detect the edges from the analog data and calculate the timing from the sample rate information.
You should be able to get resolution to about a millisecond, depending on the required sample rate and the number of samples you collect.
Lynn
01-22-2010 12:51 PM
Johnsold,
Could you please provide me an example?
thanks.
01-22-2010 01:05 PM
I cannot send you an example because DAQmx is not supported on the Mac. I can give you some ideas. To convert the VI you posted change the Create Channel to produce an Analog Input task. I think you may need to add a timing VI following the task creation and before the loop to set the sampling rate. Inside the loop change the DAQmx Read to Analog Input, Single Channel, Multiple Samples, Waveform.
The waveform output will have the timing data as one of its attributes. I would start by displaying the waveform on a graph to make sure you are getting good data. Then look at the Pulse Measurements VI in the Waveform >> Analog >> Measurements palette to see if it can give you the data you need.
Lynn