Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

wrong counting for the PCI 6251

I used Visual C++.NET,and my application needs to exact counting of an external event.I used this function

DAQmxCreateTask ("",taskHandle);

DAQmxCreateCICountEdgesChan (*taskHandle,counter,"",DAQmx_Val_Falling, 50, DAQmx_Val_CountUp);

DAQmxReadCounterScalarU32 (pro_success, -1, &value, NULL);

but it always yields wrong readings,and i tried to use the example VC_CntDigEv and also gave me wrong readings. some time the counter count with step 3 or 5 or random,more over i tried to generate the pulse with Bush bottum but the same wrong results yielded.I approsciate any idea about this problem.

Mohsen

0 Kudos
Message 1 of 4
(3,330 Views)
As the hysteresis of the counter inputs is very low this type of problem could be caused by noise on your signal lines or by a bouncing switch. You could resolve this issue by using the digital filter capabilities of your board. Please refer to the DAQmx help for futher information. You should use these functions to set the correct filter properties:

  DAQmxGetCIPulseWidthDigFltrTimebaseRate

  DAQmxSetCIPulseWidthDigFltrTimebaseRate

  DAQmxResetCIPulseWidthDigFltrTimebaseRate

I hope that helps,

Jochen Klier
National Instruments Germany
0 Kudos
Message 2 of 4
(3,319 Views)
Actually for a count edges task, you'll want to use the following methods:
 
DAQmxSetCICountEdgesDigFltrEnable()
DAQmxSetCICountEdgesDigFltrMinPulseWidth()
 
You can see the possible filter settings for your M Series device in the M Series Help file.
 
gus.....
0 Kudos
Message 3 of 4
(3,266 Views)
Have you tried using MAX and the test panel for your device.  You should always verify proper hardware operation prior to jumping into the coding of an application.  If you still have this excessive counting then noise or a unexpected signal is most likely to blame.  if it is just some high freq noise a simple low pass filter (could be a simple as a single capacitor) might help.  If the signal is good (check it on a high speed scope) then it is possible that your card is bad (never had this problem in 10 years of using counters).  Good luck,
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 4
(3,255 Views)