Jump to content

Component: IO Expander (MCP23017) (MCP23017) (General Input): Difference between revisions

From Flowcode Help
m Text replacement - "style="background-color:#EAE1EA; color:#4B008D;"" to "class="mtx-class-propfolder""
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
Line 398: Line 398:
|-
|-
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" class="mtx-class-propfolder" | I²C Communications
| width="90%" class="mtx-class-propfolder" | I²C Communications
|-
|-
Line 442: Line 442:
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" class="mtx-class-propfolder" | Simulation
| width="90%" class="mtx-class-propfolder" | Simulation
|-
|-

Latest revision as of 14:36, 13 July 2026

Author Matrix TSL
Version 5.5
Category General Input


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
5, 5.0, 25-04-25, MW, Added two extra functions:ConfigureIOC & ReadINTFlag

Detailed description

No detailed description exists yet for this component

Examples

No additional examples








Macro reference

ConfigureIOC

ConfigureIOC
Configures theinterupts for the two ports. Disabled on all pins by default. 
- BYTE PortA
Port A IOC sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled 
- BYTE PortB
Port B IOC sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled 
- VOID Return


ConfigureInversion

ConfigureInversion
Configures the pin inversion for the two ports. Disabled on all pins by default. 
- BYTE PortA
Port A inversion sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled 
- BYTE PortB
Port B inversion sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled 
- VOID Return


ConfigurePullups

ConfigurePullups
Configures the pullups for the two ports. Disabled on all pins by default. 
- BYTE PortA
Port A pull ups sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled 
- BYTE PortB
Port B pull ups sent as an 8-bit value (0 - 255), 0 = Disabled, 1 = Enabled 
- VOID Return


Initialise

Initialise
 
- VOID Return


ReadINTFlag

ReadINTFlag
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. 
- BYTE Port
0=PortA, 1=PortB 
- BYTE Mask
Allows Interrupt flag bits to be read without effecting other bits, 255 = Read full interrupt flag register. 
- BYTE Return


ReadPort

ReadPort
Reads a value to one of the ports with a mask. Configures the masked bits to be inputs before reading the input value. 
- BYTE Port
0=PortA, 1=PortB 
- BYTE Mask
Allows port bits to be modified without effecting other bits, 255 = write full port. 
- BYTE Return


ReadPortPin

ReadPortPin
Reads a single port pin from one of the ports. Configures the pins to be an input before reading the input value. Returns 0 or 1 corresponding to the value on the port pin. 
- BYTE Port
0=PortA, 1=PortB 
- BYTE Pin
Port pin to read. Range: 0-7 
- BYTE Return


ReadRegister

ReadRegister
Reads an 8-bit value from a register on the I/O expander device. 
- BYTE Address
Register address to write to. Range: 0-15 
- BYTE Return


SetAddress

SetAddress
Allows the slave address to be overridden to allow multiple modules to be controlled using a single component. 
- BYTE Address
Range: 0-7 
- VOID Return


WritePort

WritePort
Writes a value to one of the ports with a mask. Configures the masked bits to be outputs before writing the output value. 
- BYTE Port
0=PortA, 1=PortB 
- BYTE Mask
Allows port bits to be modified without effecting other bits, 255 = write full port. 
- BYTE Value
Value to write. Range 0-255 
- VOID Return


WritePortPin

WritePortPin
Writes a single port pin on one of the ports. Configures the pins to be an output before writing the input value.  
- BYTE Port
0=PortA, 1=PortB 
- BYTE Pin
Port pin to read. Range: 0-7 
- BYTE Value
Value to output on the selected pin. Range: 0-1 
- VOID Return


WriteRegister

WriteRegister
Writes an 8-bit value to a register on the I/O expander device. 
- BYTE Address
Register address to write to. Range: 0-15 
- BYTE Value
Value to write. Range: 0-255 
- VOID Return


Property reference

Properties
I²C Communications
External Address
Selects the value of the three address pins for the MCP23S17. 
Channel
Channel selection 
Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
Baud Select
Baud rate option selector 
Baud Rate
Baud rate to be used 
SDA
Pin used for SDA (data signal) 
SCL
Pin used for SCL (clock signal) 
Use Reset
 
Simulation
Label
 
Scope Traces
Selects if the scope traces are automatically generated or not 
Console Data
Selects if the console data is automatically generated or not 
API
 

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