LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

help with counter on USB 6009

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.

0 Kudos
Message 1 of 6
(3,797 Views)

to add to my previous question, it looks like the time difference is rounding to 1/64th of a second. Any thoughts?

0 Kudos
Message 2 of 6
(3,778 Views)

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.

Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
0 Kudos
Message 3 of 6
(3,770 Views)

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 

0 Kudos
Message 4 of 6
(3,755 Views)

Johnsold,

 

         Could you please provide me an example?

 

thanks.

0 Kudos
Message 5 of 6
(3,753 Views)

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 

0 Kudos
Message 6 of 6
(3,748 Views)