for master
void main()
{
TRISC=0x10;//SCK is output (Master), SDI is input,
TRISA=0x00;//Slave Select Bit
ADCON1=0x06;
SSPSTAT=0x40;//Mode 1,1 SPI, middle of output time sampling
SSPCON=0x31;//Mode 1,1 SPI Master, 1/16 Tosc bit, SSP is on
SSPIF=0;
WCOL=0;
SSPBUF=0;
lcd_init();
do{
i=0;
ss=0;//also tried always tying Slave SS pin to gnd instead of switching
lcd_putc("\fDATA TRANSMIT\n");delay_ms(2000);
while(wcol);
SSPBUF='b';
while(!SSPIF);
SSPIF=0;
ss=1;//also tried always tying Slave SS pin to gnd instead of switching
printf(lcd_putc,"\fDATA done:1 %C",SSPBUF); delay_ms(3000);
ss=0;//also tried always tying Slave SS pin to gnd instead of switching
lcd_putc("\fDATA TRANSMIT\n");delay_ms(2000);
while(wcol);
SSPBUF='a';
while(!SSPIF);
SSPIF=0;
ss=1;//also tried always tying Slave SS pin to gnd instead of switching
lcd_putc("\fDATA done:2"); delay_ms(3000);
}while(1);
}