CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

1 bit shifting to right on 3-wire serial communication. why?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
regall



Joined: 15 Jan 2005
Posts: 6
Location: Turkey

View user's profile Send private message MSN Messenger

1 bit shifting to right on 3-wire serial communication. why?
PostPosted: Sat Feb 19, 2005 3:39 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Feb 19, 2005 8:22 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group