rotary encoder via MCP23017

For general Flowcode discussion that does not belong in the other sections.
Post Reply
DAVIDJOINER
Posts: 140
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 7:35 pm
Been thanked: 18 times

rotary encoder via MCP23017

Post 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

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: rotary encoder via MCP23017

Post 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 100 times
Simply change pin_a and pin_b with pin states read from the MCP23017.

DAVIDJOINER
Posts: 140
Joined: Wed Dec 02, 2020 7:35 pm
Been thanked: 18 times

Re: rotary encoder via MCP23017

Post 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

Post Reply