mvl Guest
|
18F4620 SPI communication |
Posted: Wed Sep 20, 2006 5:06 am |
|
|
Here is my sample code:
//---------------------------------------------
setup_spi(SPI_SLAVE|SPI_L_TO_H|SPI_CLK_DIV_4);
while(1)
{
while( !spi_data_is_in() )
{ }
Var1 = spi_read();
printf("Received : %d\n\r", Var1);
}
//----------------------------------------------
And Iam sending SPI data from another microcontroller.
Data is 0,1,2,3,..100 with 500ms intervals. Iam using
PIC18F4620 and CCS C V4.010. But I read
0,3,4,7,8,11,12,15,16,19,20,23,24,27,28,31... values
in 18F4620. You see that there is a characteristic
error (Always same values are disappearing). When I
use PIC18F452 there is no problem and I can see
0,1,2,3,4,5,6,7,8,9,... rigth values. What is problem
whit 18F4620. |
|