View previous topic :: View next topic |
Author |
Message |
regall
Joined: 15 Jan 2005 Posts: 6 Location: Turkey
|
1 bit shifting to right on 3-wire serial communication. why? |
Posted: Sat Feb 19, 2005 3:39 am |
|
|
what is the reason of shifting 1 bit to the right on 3-wire serial communication?
#fuses HS,NOWDT
#use delay (clock=8000000)
#use RS232(BAUD=9600, XMIT=PIN_C6, RCV=PIN_C7, STREAM=COM1)
data=fgetc(COM1);
spi_write(data);
spi_read();
delay_ms(10);
data1=spi_read(0);
data1=data1<<1; //solving the problem like that
printf("The Response=%x\n\r",data1); |
|
 |
TSchultz
Joined: 08 Sep 2003 Posts: 66 Location: Toronto, Canada
|
|
Posted: Sat Feb 19, 2005 8:22 am |
|
|
I suspect you may be using the wrong signaling with your SPI. You can setup the SPI for any of the 4 modes. Using the wrong mode can cause a problem like this. Also it looks like you are shifting left.
What is the device you are communication to with SPI?
How have you setup the SPI?
We need this information to try and help you out. |
|
 |
|