09-18-2020 08:23 AM - edited 09-18-2020 08:27 AM
I will try to be simple:
We have one chassis 9189 with 8 modules, two of them are used to take frequency mesurements (9401), let's say module 6 and module 7.
I need mesuring frequency on three encoders, so I configured module 6 ctr 0/1 for frequency 1, module 6 ctr 2/3 for frequency 2, as i'm using 2 counters methods, in that case it works fine.
The problem is that when i added the third mesurement on module 7 ctr 0/1, i got 50103 error as the system considered the ctr 0/1 are reserved even it is on module 6.
What i should do in such configuration?
Also, I tried using encoder angular position reading and proceed to velocity by using captured time interval, it works, but the result is not as smooth as frequency method, I tried to increase calculate interval, i can see improvement but once the program is a little bit busier (sending control signals for instance) the variation came back, is it normal?
Thanks a lots
09-21-2020 12:00 PM
I've been using NI's counters for more than 20 years and I pretty much always use the 1-counter method for measuring frequency. Try that instead. The error you get is probably because your modules don't actually contain counters, they share access to the 4 counters built into the cDAQ chassis.
It's been a long time since I read the docs on the 2-counter methods carefully, but I *do* remember drawing the conclusion that a 1-counter measurement plus some software post-processing could replicate their results. Consequently I never really bothered with the 2-counter approaches.
Another thing you should do is read multiple samples from each task every loop iteration. And then you have some further decisions to make because if you have 3 different frequencies, you won't be acquiring freq measurements at the same rate from each task. Each may have different #'s of samples available.
I'd do a multi-sample read while specifying the magic # (-1) as the # of samples to read. This means, "give me everything available in the buffer right now." And then I'd probably have a separate Chart on the GUI for each set of frequency data. At some point you'll probably also want to learn how to separate the task loop from your GUI updates and any file logging you do with a Producer/Consumer approach.
-Kevin P