04-11-2012 09:43 PM
Hi,
I am trying to write a VI that will count ticks of a rotating encoder wheel. I was able to run the test panel in MAX and count total ticks during rotation with no problem.
Next, I tried writing a VI that would do the same, but, I am getting errors that I do not understand, especially, " 200284, Some or all of the samples requested have not yet been acquired." It also tells me to supply an external clock...how do you do that, and how do you know which external clock is the correct one? I tried many clock options, but, continue to get this error...
Ultimately, I would like to have a VI that counts ticks per unit time, e.g. ticks/100ms etc. For now, I am trying just to get it to count total ticks, and I am stuck here. Really stuck.
I am using cDAQ 9174 and NI 9401.
Thanks!!! Please help!!!
Dave
04-12-2012 08:21 PM - edited 04-12-2012 08:27 PM
Hi dav2010,
An explanation of error -200284 can be found here. Furthermore, I would recommend starting from a shipping example, when developing your counter measurement task. Lastly, the NI cDAQ-917x User Manual contains information about the various counter input applications, starting on page 5-3.
The default sample mode for the DAQmx Timing.vi is Finite. The sample clock for the counter task(s) may be set to Continuous but if the sample clock is not set to Continuous it is set to the default value (Finite). When the sample clock is set to finite without the samples per channel wired, it will set a default buffer size based on the rate. Once the buffer is full the sample clock stops and the counter task stops latching the counts because the clock source has stopped. The counter task(s) which are set to continuous will continue expecting more clock edges but will timeout giving error 200284 when it doesn't receive any more. Setting the sample clock source to Continuous will allow the clock to continue providing clock edges for the buffered counting task(s).
04-12-2012 09:19 PM
Hi Tunde,
Thanks for the advice. Can you tell me what is meant by the phrase "a shipping example?" Also, I will study the links you included in your note.
Is it possible to achieve what I want, which is to repeatedly measure counts per unit time, or alternatively, measure the time required for a fixed number of ticks on the encoder wheel to be counted with the 9401?
Thank you,
Dave
04-13-2012 03:09 PM
You can find more information about the NI-DAQmx Shipping Examples in LabVIEW here.
With your cDAQ hardware, you should be able to count digital events with no problem, as you proved with MAX. For time duration, you can always compare the before and after timestamps to determine how many counts occurred over a period of time.