Page 1 of 1

MCP23017 - One I2C transaction for stepper motor control

Posted: Wed May 20, 2026 10:16 am
by Zhmil1789
Hi,
I am using Flowcode with MCP23017 I2C expander to control a stepper motor.
I have two pins on PORTA:

Pin 0 = direction
Pin 1 = step

Currently I use WritePortPin macro in a loop with delays between steps. This creates separate I2C transaction for each step.
According to MCP23017 datasheet, Byte mode (IOCON.SEQOP) allows continuous writing to the same register without sending address each time.
My question: Is it possible in Flowcode to keep I2C transaction open between WritePort/WritePortPin calls, so I can send multiple step pulses with delays inside one transaction? Or is there a way to access raw I2C bus directly while using MCP23017 component?

Thank you

Re: MCP23017 - One I2C transaction for stepper motor control

Posted: Wed May 20, 2026 10:26 am
by BenR
Hello,

Both are possible yes.

The straightforward way is to look at the generated C code, specifically the MCP23017 component macros and then copy and paste this C code into your own function using the C code icon. You can then edit the C code as required.

The more customised way would be to take the MCP23017 component source from the wiki and add the functionality you need directly into the component creating your own customised version of the component.

Re: MCP23017 - One I2C transaction for stepper motor control

Posted: Wed May 20, 2026 10:51 am
by Zhmil1789
Thank you for your reply! Could you tell me exactly what you mean by custom version? In flowcode, can I download the components myself and customize them?


With respect
Zhmil1789