grindylow
Newbie level 6
SPI String
I have successfully used SPI communications between two microcontrollers. That was when I am sending 1-byte data, but when I used to transfer a string the slave seems to be getting only the first byte, can you tell why is this happening?
here is the master code:
here is the slave code:
I have successfully used SPI communications between two microcontrollers. That was when I am sending 1-byte data, but when I used to transfer a string the slave seems to be getting only the first byte, can you tell why is this happening?
here is the master code:
Code:
if(slave == TRUE)
{
CSpin=0;
Delay10TCYx(50);
putsSPI(slave_stream);
CSpin=1;
count++;
if(count==10) {
slave = FALSE;
count=0;
}
}
Code:
if(DataRdySPI()) {
getsSPI(master_stream, 5);
received_data0 = master_stream[0];
received_data1 = master_stream[1];
received_data2 = master_stream[2];
received_data3 = master_stream[3];
switch(received_data0)
{
case 'A':
LED=0;
for(i=0;i<8;i++)
Delay10KTCYx(0);
Delay10KTCYx(176);
Delay10KTCYx(176);
break;
case 'B':
servo0=0xFBC6;
break;
case 'N':
servo0=0xF1FD;
break;
default: break;
}
if(received_data1 == 'N') { //<-------------this part doesn't get executed
for(i=0;i<8;i++)
Delay10KTCYx(0);
Delay10KTCYx(176);
Delay10KTCYx(176);
servo0=0xF883;
}
}