Author
|
Matrix TSL
|
Version
|
1.0
|
Category
|
General Input
|
IO Expander (MCP23S17) component
Provides 16 digital input/output pins arranged into two 8-bit ports using a SPI bus connection. Multiple expanders can be connected to the same SPI peripheral by means of individual chip select pins.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_MCP23S17.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_MCP23S17.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
|
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
|
|
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 = Disabled, 1 = Enabled
|
- BYTE
|
PortB
|
Port B inversion sent as an 8-bit value, 0 = Disabled, 1 = Enabled
|
- VOID
|
Return
|
|
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
|
|
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
|
|
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
|
|
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 = Disabled, 1 = Enabled
|
- BYTE
|
PortB
|
Port B pull ups sent as an 8-bit value, 0 = Disabled, 1 = Enabled
|
- VOID
|
Return
|
|
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
|
|
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
|
|
Initialise
|
|
- VOID
|
Return
|
Property reference
|
Properties
|
|
SPI Communications
|
|
External Address
|
Selects the value of the three address pins for the MCP23S17.
|
|
Channel
|
SPI Channel selector
|
|
Prescale
|
Prescale option selector
|
|
MOSI
|
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.
|
|
MISO
|
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.
|
|
CLK
|
SPI Clock Pin CLK - The Clock signal is driven by the SPI master.
|
|
CS / SS
|
Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.
|
|
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
|
|
==Macro reference==
|
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
|
|
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 = Disabled, 1 = Enabled
|
- BYTE
|
PortB
|
Port B inversion sent as an 8-bit value, 0 = Disabled, 1 = Enabled
|
- VOID
|
Return
|
|
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
|
|
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
|
|
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
|
|
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 = Disabled, 1 = Enabled
|
- BYTE
|
PortB
|
Port B pull ups sent as an 8-bit value, 0 = Disabled, 1 = Enabled
|
- VOID
|
Return
|
|
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
|
|
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
|
|
Initialise
|
|
- VOID
|
Return
|
Property reference
|
Properties
|
|
SPI Communications
|
|
External Address
|
Selects the value of the three address pins for the MCP23S17.
|
|
Channel
|
SPI Channel selector
|
|
Prescale
|
Prescale option selector
|
|
MOSI
|
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.
|
|
MISO
|
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.
|
|
CLK
|
SPI Clock Pin CLK - The Clock signal is driven by the SPI master.
|
|
CS / SS
|
Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.
|
|
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
|
|
==Macro reference==
|
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
|
|
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 = Disabled, 1 = Enabled
|
- BYTE
|
PortB
|
Port B inversion sent as an 8-bit value, 0 = Disabled, 1 = Enabled
|
- VOID
|
Return
|
|
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
|
|
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
|
|
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
|
|
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 = Disabled, 1 = Enabled
|
- BYTE
|
PortB
|
Port B pull ups sent as an 8-bit value, 0 = Disabled, 1 = Enabled
|
- VOID
|
Return
|
|
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
|
|
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
|
|
Initialise
|
|
- VOID
|
Return
|
Property reference
|
Properties
|
|
SPI Communications
|
|
External Address
|
Selects the value of the three address pins for the MCP23S17.
|
|
Channel
|
SPI Channel selector
|
|
Prescale
|
Prescale option selector
|
|
MOSI
|
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.
|
|
MISO
|
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.
|
|
CLK
|
SPI Clock Pin CLK - The Clock signal is driven by the SPI master.
|
|
CS / SS
|
Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.
|
|
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
|
|