Close

New FW release!

A project log for I2C Encoder V2

Upgraded version of the small board for connect multiple rotary encoders on the I2C bus.

saimonSaimon 09/20/2021 at 10:310 Comments

I have made an update about the detection of the encoder rotation.

In the previous version for detecting the encoder steps and direction it was used the CLC feature of the PIC16F18345., this method works but sometime some errors can appear.

In the Mini version the detection is made in FW with the lookup table method, this way is very efficient and it make very few mistake. For this reason i have decided to use the same way also in the I2C Encoder V2. The CLC are still used but for debouncing the encoder signals.

I have found this application note from Microchip where it use two CLC module and a timer for creating a robust debouncing circuit. 

Following the application note i have used the CLC 1 and 3 for the A signal and the CLC 4 and 2 for the B signal. The timer 0 is used for feeding the filp-flops

Here the logic:

The frequency of the timer 0 is configurable with the 8bit register ANTBOUNC, before this register was used for a similar function.  The range is from 0.192ms to 49.152ms that correspond to a frequency 5200Hz to 20Hz. Each step correspond to 0.192ms.

The old functionality of the ANTBOUNC is removed, so there is no the delay when the direction it changed. This make the encoder more reactive.

Discussions