How to write data to SPI slave device in MCP23S17 IC?

Thread Starter

shetsachin

Joined Jul 5, 2017
19
Hello,
I am working on SPI MCP23S17 16bit I/O expander IC,as a output mode, to turn on LED's. Need to know how to write data to this IC bit by bit,How many byte cycle need to run to glow all the LED ON in PORT A and PORT B. One cycle consist of how many bits. can anyone help regarding this.
and if it is multiple slaves will the address remain same or not,
Please need a help, as I am new in SPI communication.
 

jpanhalt

Joined Jan 18, 2008
10,080
What is your level of experience with any digital peripheral?
What will you be using as the master controller?
What language will you be using?
 

Picbuster

Joined Dec 2, 2013
1,020
Hello,
I am working on SPI MCP23S17 16bit I/O expander IC,as a output mode, to turn on LED's. Need to know how to write data to this IC bit by bit,How many byte cycle need to run to glow all the LED ON in PORT A and PORT B. One cycle consist of how many bits. can anyone help regarding this.
and if it is multiple slaves will the address remain same or not,
Please need a help, as I am new in SPI communication.
As MCP is a Microchip product you could use the Microchip IDE and compiler.
Microchip has a lot of information, program examples and very clear descriptions about SPI.
Spi is a simple serial protocol in a master/slave environment controlled by enable pin and forwarded by a clock but that's all written in Microchips documentation.

it could be as simple as;
for (n=0;n<Size;n++)
{
SSP1CON1bits.WCOL=0; // ignore collision
SSP1BUF = FTDI_Msg[n]; // send byte to FTDI VNC2_32
__delay_us(Byte_Wait); // delay defined by receiver's process
}


Picbuster.
 
Top