hi all

i m also doing the same pic to pic comm via spi.i m using 16f877a.
i have written the code in C.soma junk value is displayed n the receiver side lcd.but my opinion is there s no communication between two pic,if i switch off the transmitter pic then also the lcd s displaying the same junk value.

void transmit(char *str)
{
int i;
char dum;
SSPBUF=0;
for(i=0;i<6;i++)
{
SSPBUF=str[i];
//delay();
dum=SSPBUF;
delay();
}
}
void init_spi()
{
STATUS.f6=0;
STATUS.f5=1;
TRISC=0;
TRISB.f1=0;
TRISE.f2=0;
STATUS.f5=0;
PORTC=0;
TRISC.f5=0;
TRISC.f3=0;
TRISC.f4=1;
STATUS.f5=1;
SSPSTAT.f7=0;
SSPSTAT.f6=0;
STATUS.f5=0;
//SSPCON&=0xf0;
SSPCON.f5=1;
SSPCON.f4=0 ;
SSPCON.f0=0 ;
SSPCON.f1=0 ;
SSPCON.f2=0 ;
SSPCON.f3=0 ;
}
void main()
{
init_spi();
transmit("sakthi");
}

the above code s for transmitting side.i have used two seperate pic board.



void receive()
{
int i;
char rx[10];
STATUS.f5=0;
STATUS.f6=0;
PIR1.f3=0;
SSPBUF=0;
for(i=0;i<6;i++)
{
while(SSPSTAT.f0==0)
{}
while(PIR1.f3==0)
{}
rx[i]=SSPBUF;
//delay();
toggle();
SSPBUF=0;
SSPSTAT.f0=0;
PIR1.f3=0;

}
}
void init_spi()
{
STATUS.f6=0;
STATUS.f5=1;
TRISC.f4=1;
TRISC.f5=0;
TRISC.f3=1;
STATUS.f5=1;
TRISA.f5=0;
SSPSTAT.f7=0;
SSPSTAT.f6=1;
STATUS.f5=0;
SSPCON.f5=1;
SSPCON.f4=1 ;
SSPCON.f0=0 ;
SSPCON.f1=1 ;
SSPCON.f2=0 ;
SSPCON.f3=0 ;
}
void main()
{
STATUS.f5=1;
STATUs.f6=0;
SSPCON.f5=0;
init_spi();
receive();
init_lcd();
display(rx);
}


the above code s for reception .plz any one help me to solve the problem.i have the doubt in the register enabling.plzzzzzzzzzzzzz help me