Please give me guidance regarding the SPI communication with 2 pics and Mikroc codes.It is very greatfull if any one can give simple Mikroc codes to communicate between two pics(16f877A).I'm giving code that i have tried,but it does not work.Please give your guidance for success my project
// code for spi master
void main()
{
Spi_Init_Advanced(MASTER_OSC_DIV64,DATA_SAMPLE_MIDDLE,CLK_IDLE_LOW,HIGH_2_LOW);
while(1)
{
Spi_Write(0X11);
}
}
// code for spi slave
void main()
unsigned short Spi_Read(unsigned char buffer);
{
unsigned char buffer,gdata=0x00;
buffer=0xFF;
TRISB=0X00;
portb=0X00;
Spi_Init_Advanced(SLAVE_SS_ENABLE,DATA_SAMPLE_MIDDLE,CLK_IDLE_LOW,HIGH_2_LOW);
while(1)
{
gdata=Spi_Read(buffer);
if(gdata==0X11)
{
portb=1;
}
}
}