Hi,
I am using the Component Works CWCounter object with a PCI-6025E DAQ card to measure frequency of a squarewave input to the PFI9 pin. The frequency ranges from 20Khz to 95Khz and seems to measure correctly except that when the measurement is repeated say 20 times, then about 3 out of 20 times the frequency comes back wrong at almost double the actual frequency! This occurs at random.
Is it something I'm doing incorrectly or could it be a Windows/CPU speed/resource/interrupt type of problem?
Here is the basic setup in VB6 where it measures pulse period and then inverts the result to convert to frequency:
Form1.CWDAQTools1.RouteSignal 1, cwrsPinPFI9, cwrsSourceNone
With Form1.CWCounter1
.Rese
t
.CountDirection = cwctrUpDir
.Counter = 0
.MeasurementType = cwctrPulsePeriodFallingEdge
.TimebaseSource = cwctrNIDAQChoosesTB
.TimebaseSignal = 20000000
.Configure
End With
Form1.CWCounter1.Configure
Form1.CWCounter1.start
While IsRunning = True And TimeOut > 0 ' wait until measurement is completed
DoEvents
TimeOut = TimeOut - 1
Wend
If period > 0 Then Freq = 1 / CSng(period)
Private Sub CWCounter1_AcquiredData(Measurement As Variant, ByVal OverFlow As Boolean)
period = Measurement
IsRunning = False
End Sub
Any suggestions? I can't seem to figure out why the measurement is correct only about 85% of the time. Are there some options or configurations that I'm not utilizing on the CWCounter object? Any help is appreciated.
Thanks,
Tony Gioiosa