sandeepvd
Joined: 29 Dec 2006 Posts: 2
|
Looking for example code MCP23S17 SPI writing to GPIO |
Posted: Fri Dec 29, 2006 8:11 pm |
|
|
[b]I am beginner.
Looking to write outputs to MCP23S17 io expander GPA and GPB separately using PICDEM FSUSB (PIC18F4550) in SPI mode with C18 library?
(A2 A1 A1 is = 000)
Can someone be kind enough to help ?[/b]
__________________________
more sp info if it takes:
PIC18F4550 MCP23S17
RB0 (SDI) SO
RB1 (SCK) SCK
RC7 (SDO) SI
RA4 CS
taking PICDEM FSUSB demo program as reference.
TRISC<7> bit to be cleared for SDO
TRISB<1> bit to be cleared for SCK (Master mode)
TRISA<4> bit to be cleared for CS
A0 A1 and A2 of MCP23S17 are grounded.
Have looked at MCP23S17 tables but some example help on correctly configuring it's GPIO and config reg appreciated. (I could only figure out that 0x40 for writing to the device :( ) |
|