Component: IO Expander (Comms: System): Difference between revisions
Appearance
m Text replacement - "class="wikitable" style="width:60%; background-color:#FFFFFF;"" to "class="mtx-class-macrotable wikitable"" |
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead"" |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 48: | Line 48: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ReadPort''' | ||
|- | |- | ||
| colspan="2" | Reads a value to one of the ports with a mask. Configures the masked bits to be inputs before reading the input value. | | colspan="2" | Reads a value to one of the ports with a mask. Configures the masked bits to be inputs before reading the input value. | ||
| Line 71: | Line 71: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ConfigureInversion''' | ||
|- | |- | ||
| colspan="2" | Configures the pin inversion for the two ports. Disabled on all pins by default. | | colspan="2" | Configures the pin inversion for the two ports. Disabled on all pins by default. | ||
| Line 94: | Line 94: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ReadPortPin''' | ||
|- | |- | ||
| colspan="2" | 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. | | colspan="2" | 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. | ||
| Line 117: | Line 117: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''WritePortPin''' | ||
|- | |- | ||
| colspan="2" | Writes a single port pin on one of the ports. Configures the pins to be an output before writing the input value. | | colspan="2" | Writes a single port pin on one of the ports. Configures the pins to be an output before writing the input value. | ||
| Line 145: | Line 145: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''WritePort''' | ||
|- | |- | ||
| colspan="2" | Writes a value to one of the ports with a mask. Configures the masked bits to be outputs before writing the output value. | | colspan="2" | Writes a value to one of the ports with a mask. Configures the masked bits to be outputs before writing the output value. | ||
| Line 173: | Line 173: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ConfigurePullups''' | ||
|- | |- | ||
| colspan="2" | Configures the pullups for the two ports. Disabled on all pins by default. | | colspan="2" | Configures the pullups for the two ports. Disabled on all pins by default. | ||
| Line 196: | Line 196: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ReadRegister''' | ||
|- | |- | ||
| colspan="2" | Reads an 8-bit value from a register on the I/O expander device. | | colspan="2" | Reads an 8-bit value from a register on the I/O expander device. | ||
| Line 214: | Line 214: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''WriteRegister''' | ||
|- | |- | ||
| colspan="2" | Writes an 8-bit value to a register on the I/O expander device. | | colspan="2" | Writes an 8-bit value to a register on the I/O expander device. | ||
| Line 237: | Line 237: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Initialise''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 250: | Line 250: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Initialise''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 263: | Line 263: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Initialise''' | ||
|- | |- | ||
| colspan="2" | Enables the I²C hardware and performs some initialization. Should be called at the start of the program or at least before any of the other I²C functions are called. | | colspan="2" | Enables the I²C hardware and performs some initialization. Should be called at the start of the program or at least before any of the other I²C functions are called. | ||
| Line 276: | Line 276: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckNetworkStatus''' | ||
|- | |- | ||
| colspan="2" | Returns the state of the GSM network. 0 = Not connected, 1 = connected, 255 = no reply from GSM. | | colspan="2" | Returns the state of the GSM network. 0 = Not connected, 1 = connected, 255 = no reply from GSM. | ||
| Line 289: | Line 289: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckForIncoming''' | ||
|- | |- | ||
| colspan="2" | Checks to see if any incoming phone call or SMS message. 0 = Nothing, 1 = Text Received, 2 = Phone Ringing | | colspan="2" | Checks to see if any incoming phone call or SMS message. 0 = Nothing, 1 = Text Received, 2 = Phone Ringing | ||
| Line 302: | Line 302: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Initialise''' | ||
|- | |- | ||
| colspan="2" | Sets up the GSM module. Returns 0 for OK, 255 for no reply and 254 for command fail. | | colspan="2" | Sets up the GSM module. Returns 0 for OK, 255 for no reply and 254 for command fail. | ||
| Line 319: | Line 319: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|- | |- | ||
| Line 363: | Line 363: | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Connections''' | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Simulations''' | ||
|- | |- | ||
|- | |- | ||
Latest revision as of 14:23, 13 July 2026
| Author | Matrix TSL |
| Version | 1.0 |
| Category | Comms: System |
IO Expander 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.
Detailed description
No detailed description exists yet for this component
Examples
More information on I2C can be found here,
Matrix Flowcode Blog: Simplified communications I2C and SPI
Generic I2C EEPROM
Example file demonstrating how to read and write bytes from a generic I2C EEPROM device.
I2CEEPROM
Downloadable macro reference
| 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 | |
| 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 | |
| Initialise | |
| Return | |
| Initialise | |
| Return | |
| Initialise | |
| Enables the I²C hardware and performs some initialization. Should be called at the start of the program or at least before any of the other I²C functions are called. | |
| Return | |
| CheckNetworkStatus | |
| Returns the state of the GSM network. 0 = Not connected, 1 = connected, 255 = no reply from GSM. | |
| Return | |
| CheckForIncoming | |
| Checks to see if any incoming phone call or SMS message. 0 = Nothing, 1 = Text Received, 2 = Phone Ringing | |
| Return | |
| Initialise | |
| Sets up the GSM module. Returns 0 for OK, 255 for no reply and 254 for command fail. | |
| Return | |