<FreqCount.h> Can I measure 2 frequencies at the same time? (On 2 pins?) Teensy 3.5

Status
Not open for further replies.

laptophead

Well-known member
<FreqCount.h> Can I measure 2 frequencies at the same time? (On 2 pins?) Teensy 3.5

I have to control 2 DC motors with quadrature encoders. I must maintain similar speed on both for number of pulses in order for my application to work. For pulse count I used Encoder.h and worked well, I thank the authors.

However if I use 2 PIDs to drive the motors to my destination based on the number of pulses, the speed varies too much along the way, based on mechanical frictions, etc...

So I would rather target speed in my PIDs and stop them abruptly at the by a "while-do". The desired speed might be around 3000 pulses per sec, so not very very high...

Are 2 channels at 3Khz doable? Is there processing power left for the PID math?

Thanks a lot.
Mitch
 
No, sorry. FreqCount uses the LPTMR timer for counting. There's only one of those in the chip.

You could use a Teensy LC or 3.2 to count the 2nd frequency, since both of those have one LPTMR. Not ideal hardware-wise, but easy to do for the software side.
 
Status
Not open for further replies.
Back
Top