Difference between revisions of "Component: IO Expander (MCP23017) (MCP23017) (General Input)"
From Flowcode Help
Jump to navigationJump to searchLine 5: | Line 5: | ||
|- | |- | ||
| width="20%" style="color:gray;" | Version | | width="20%" style="color:gray;" | Version | ||
− | | | + | | 5.5 |
|- | |- | ||
| width="20%" style="color:gray;" | Category | | width="20%" style="color:gray;" | Category | ||
Line 15: | Line 15: | ||
Provides 16 digital input/output pins arranged into two 8-bit ports using a I2C bus connection. Up to eight expanders can be connected to the same I2C peripheral by means of three address pins. | Provides 16 digital input/output pins arranged into two 8-bit ports using a I2C bus connection. Up to eight expanders can be connected to the same I2C peripheral by means of three address pins. | ||
− | == | + | ==Version information== |
− | |||
− | |||
− | + | Library Version, Component Version, Date, Author, Info | |
==Detailed description== | ==Detailed description== | ||
Line 112: | Line 110: | ||
==Macro reference== | ==Macro reference== | ||
+ | |||
+ | ===ConfigureIOC=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ConfigureIOC''' | ||
+ | |- | ||
+ | | colspan="2" | Configures theinterupts for the two ports. Disabled on all pins by default. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | PortA | ||
+ | |- | ||
+ | | colspan="2" | Port A IOC sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | PortB | ||
+ | |- | ||
+ | | colspan="2" | Port B IOC sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
===ConfigureInversion=== | ===ConfigureInversion=== | ||
Line 125: | Line 147: | ||
| width="90%" | PortA | | width="90%" | PortA | ||
|- | |- | ||
− | | colspan="2" | Port A inversion sent as an 8-bit value, 0 = Disabled, 1 = Enabled | + | | colspan="2" | Port A inversion sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" | PortB | | width="90%" | PortB | ||
|- | |- | ||
− | | colspan="2" | Port B inversion sent as an 8-bit value, 0 = Disabled, 1 = Enabled | + | | colspan="2" | Port B inversion sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled |
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 149: | Line 171: | ||
| width="90%" | PortA | | width="90%" | PortA | ||
|- | |- | ||
− | | colspan="2" | Port A pull ups sent as an 8-bit value, 0 = Disabled, 1 = Enabled | + | | colspan="2" | Port A pull ups sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" | PortB | | width="90%" | PortB | ||
|- | |- | ||
− | | colspan="2" | Port B pull ups sent as an 8-bit value, 0 = Disabled, 1 = Enabled | + | | colspan="2" | Port B pull ups sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled |
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 171: | Line 193: | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===ReadINTFlag=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadINTFlag''' | ||
+ | |- | ||
+ | | colspan="2" | Reads a value of the INT flag with a mask. E.g if reading the whole port and the value is 18 = 0b00010010 then pins 4 and 1 triggered the interrupt INT flags are cleared by reading the associated ports. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Port | ||
+ | |- | ||
+ | | colspan="2" | 0=PortA, 1=PortB | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Mask | ||
+ | |- | ||
+ | | colspan="2" | Allows Interrupt flag bits to be read without effecting other bits, 255 = Read full interrupt flag register. | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
Line 419: | Line 465: | ||
| colspan="2" | | | colspan="2" | | ||
|} | |} | ||
+ | |||
+ | ==Component Source Code== | ||
+ | |||
+ | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_MCP23017.fcfx FC_Comp_Source_MCP23017.fcfx] | ||
+ | |||
+ | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_MCP23017.fcfx FC_Comp_Source_MCP23017.fcfx] |
Latest revision as of 08:59, 9 June 2025
Author | Matrix TSL |
Version | 5.5 |
Category | General Input |
Contents
IO Expander (MCP23017) component
Provides 16 digital input/output pins arranged into two 8-bit ports using a I2C bus connection. Up to eight expanders can be connected to the same I2C peripheral by means of three address pins.
Version information
Library Version, Component Version, Date, Author, Info
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
ConfigureIOC
ConfigureInversion
ConfigurePullups
Initialise
![]() |
Initialise |
![]() |
Return |
ReadINTFlag
ReadPort
ReadPortPin
ReadRegister
![]() |
ReadRegister |
Reads an 8-bit value from a register on the I/O expander device. | |
![]() |
Address |
Register address to write to. Range: 0-15 | |
![]() |
Return |
SetAddress
![]() |
SetAddress |
Allows the slave address to be overridden to allow multiple modules to be controlled using a single component. | |
![]() |
Address |
Range: 0-7 | |
![]() |
Return |
WritePort
WritePortPin
WriteRegister
![]() |
WriteRegister |
Writes an 8-bit value to a register on the I/O expander device. | |
![]() |
Address |
Register address to write to. Range: 0-15 | |
![]() |
Value |
Value to write. Range: 0-255 | |
![]() |
Return |
Property reference
Component Source Code
Please click here to download the component source project: FC_Comp_Source_MCP23017.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_MCP23017.fcfx