MCP23017 - One I2C transaction for stepper motor control

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Zhmil1789
Posts: 10
http://meble-kuchenne.info.pl
Joined: Sun Mar 01, 2026 6:50 pm
Has thanked: 9 times

Flowcode v10 MCP23017 - One I2C transaction for stepper motor control

Post 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

BenR
Matrix Staff
Posts: 2207
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 605 times
Been thanked: 803 times

Re: MCP23017 - One I2C transaction for stepper motor control

Post 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.

Zhmil1789
Posts: 10
Joined: Sun Mar 01, 2026 6:50 pm
Has thanked: 9 times

Re: MCP23017 - One I2C transaction for stepper motor control

Post 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

Post Reply