Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Get DAQmxCreateCIFreqChan to return even if there's no input..

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

 

 

 

0 Kudos
Message 1 of 4
(3,158 Views)

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!

 

0 Kudos
Message 2 of 4
(3,148 Views)
Hello lxstala,

It looks like you are using our PCI-6601  programming in Visual C++ with the DAQmx driver, to make a frequency measurement. You are having issues measuring low frequencies close to zero.

It looks like you were able to get it to work with the DAQmx_Val_HighFreq2Ctr, but when you use the DAQmx_Val_LowFreq1 Ctr this is not the case. Setting the duplicate count prevention property node does not fill the buffer with zeros. Do you get an error message? What is the error code when you try to do this?

Regards,
  Sandra T.

Applications Engineer | National Instruments
0 Kudos
Message 3 of 4
(3,104 Views)

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.

 

0 Kudos
Message 4 of 4
(3,092 Views)