03-14-2007 09:28 PM
Hi. I have a quadrature encoder connected to a counter measuring the pulse frequency so I can get velocity. I'm using
DAQmxCreateCIFreqChan, and a corresponding read function, but it only updates (or returns) when there is some active frequency. In other words I can't measure a frequency of zero (no movement). This is very frustrating, as my entire program comes to a standstill if there's no user input. Is there anyway to make this function return a zero? Or return at all if there's no input?
It's a 6601 board, i'm using VC++ and Nidaqmx.
Thanks
03-15-2007 04:05 PM
Ok. So If I setup my frequency measurement to use.. DAQmx_Val_HighFreq2Ctr then I can set duplicate count prevention to TRUE and it will fill the buffer with zeros for zero Hz. However, since I'm using DAQmx_Val_LowFreq1Ctr to measure low frequency signals, and this method has my input connected to the gate (PFI 26) instead of the source (PFI 27) like DAQmx_Val_HighFreq2Ctr does, then duplicate count prevention has no effect.
Is there any way around this???
Thanks!
03-21-2007 09:40 PM
03-22-2007 01:36 PM
Hi. I've actually solved this problem. Setting duplicate count prevention returns no error codes with the low freq cntr method. I spoke with a technician at NI and he devised a work around for this issue.
Now I simply set the readcounter function for a timeout of a few milliseconds, this effectively times out when no pulses have been recorded at the gate. Then condition on the error code from the timeout to decay my last known velocity to zero within a few program cycles. That solves it.