I cant communicate two pic16f877 throu SPI.
I've made the hw connections I dont think there's a problem there.
But I would like to ask for someone If can give me some code example
for programming the SPI in slave mode,
I know that the SPI should be initialize this way
Code: Select all
SPI1_Init_Advanced(_SPI_SLAVE_SS_ENABLE,
_SPI_DATA_SAMPLE_MIDDLE,
_SPI_CLK_IDLE_LOW,
_SPI_LOW_2_HIGH)
and for the master:
Code: Select all
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4,
_SPI_DATA_SAMPLE_MIDDLE,
_SPI_CLK_IDLE_LOW,
_SPI_LOW_2_HIGH) ' Inicia SPI
I've made the program for a PIC as master and device MCP4921
just like the Mikro Examples.
And everythings goes ok!
But now, the slave mode is totally diferent I think
Please help!