The mikroC PRO for PIC provides a library for communication with the
Microchip’s Port Expander MCP23S17 via SPI interface. Connections of the
PIC compliant MCU and MCP23S17 is given on the schematic at the bottom of this
page.
Important :
- The library uses the SPI module for communication. User must initialize the appropriate SPI module before using the Port Expander Library.
- Library does not use Port Expander interrupts.
External dependencies of Port Expander Library
The following variables must be defined in all projects using Port Expander Library: | Description : | Example : |
---|---|---|
extern sfr sbit SPExpanderRST; |
Reset line. | sbit SPExpanderRST at
RC0_bit; |
extern sfr sbit SPExpanderCS; |
Chip Select line. | sbit SPExpanderCS at
RC1_bit; |
extern sfr sbit SPExpanderRST_Direction; |
Direction of the Reset pin. | sbit SPExpanderRST_Direction at
TRISC0_bit; |
extern sfr sbit SPExpanderCS_Direction; |
Direction of the Chip Select pin. | sbit SPExpanderCS_Direction at
TRISC1_bit; |