Page 1 of 1

rotary encoder via MCP23017

Posted: Wed Jan 12, 2022 3:08 pm
by DAVIDJOINER
Hi all

I have used successfully the Flowcode rotary encoder component no problems

But has anyone generated a component or flowchart to to use an encoder / encoders via i2c MCP23017

I want to add up to 3 encoders via MCP23017 i think should be quite possible as MCP23017 has interrupt on change pins

David

Re: rotary encoder via MCP23017

Posted: Wed Jan 12, 2022 3:39 pm
by BenR
Hi David,

Yes certainly should be possible, you would need to enable the interrupt on the MCP23017 device by writing to the registers that control the interrupt. Then connect the INT pin of the MCP23017 to a pin on your MCU and interrupt when the INT pin fires to collect the encoder pin states.

This is the macro code from the quad encoder component if you want to replicate with the MCP23017 pins.
CheckForChanges.fcm
(12.21 KiB) Downloaded 105 times
Simply change pin_a and pin_b with pin states read from the MCP23017.

Re: rotary encoder via MCP23017

Posted: Fri Jan 14, 2022 11:44 am
by DAVIDJOINER
Thanks Ben

I will use your fcm as a basis when i get back to this in a couple of weeks time to generate a new fcm with this added functionality

Will also drop it into this forum so others can potentially use it if required

David