cancel
Showing results for 
Search instead for 
Did you mean: 

How to control 6 rotary encoders with single MCU

YHodo.1
Associate

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

2 REPLIES 2
KiptonM
Lead

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

http://www.mstarlabs.com/apeng/techniques/qdec.html

Thank you! 👌