2021-03-24 11:31 AM
Hello All!
I have found that I can read encoder information with HAL functions e. q.
HAL_TIM_Encoder_Start
But only few timers have encoder mode
If I need to control 6 encoders I have found STM32F103 RF MCU with enough timers.
Is there another solution to control 6 rotary encoders?
Thank you
2021-03-24 05:58 PM
When you do not have enough hardware you have to do it in software. It becomes a state machine and you have to sample the outputs twice as fast as you think they will change.
This will give you an idea how to do it in software.
https://www.best-microcontroller-projects.com/rotary-encoder.html
Here is a good discussion of a similar problem
https://electronics.stackexchange.com/questions/61697/decoding-multiple-quadrature-rotary-encoders
Xilinx used to have a very clever quadrature encoder state machine in one of their application notes, many years ago. Unfortunately I cannot find it. I have built some in software using their state machine. It was good and easy. It appears lost forever. I remember it from 20 years ago...
TI has a state machine description.
https://www.ti.com/lit/an/slaa795/slaa795.pdf?ts=1616628607708
2021-03-25 12:49 AM
Thank you! :ok_hand: