Mikroelektronika MIKROE-738 Datenbogen

Seite von 682
mikroC PRO for PIC32
MikroElektronika
387
Expander_Init_Advanced
Prototype
void Expander_Init_Advanced(char *rstPort, char rstPin, char haen);
Description Initializes Port Expander using SPI communication.
Parameters 
rstPort
: Port Expander’s reset port 
rstPin
: Port Expander’s reset pin 
haen
: Port Expander’s hardware address 
Returns
Nothing.
Requires
SPExpanderCS
: Chip Select line 
SPExpanderRST
: Reset line 
SPExpanderCS_Direction
: Direction of the Chip Select pin 
SPExpanderRST_Direction
: Direction of the Reset pin 
must be defined before using this function. 
SPI module needs to be initialized. See SPIx_Init and SPIx_Init_Advanced routines. 
Example
// Port Expander module connections
sbit  SPExpanderRST at RF0_bit;
sbit  SPExpanderCS  at RF1_bit;
sbit  SPExpanderRST_Direction at TRISF0_bit;
sbit  SPExpanderCS_Direction  at TRISF1_bit;
// End Port Expander module connections
...
// If Port Expander Library uses SPI module
SPI1_Init();        // Initialize SPI1 module used with PortExpander
Expander_Init_Advanced(&PORTB, 0, 0);         // Initialize Port Expander
Notes
None.