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

SPI in PIC by Software

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



Joined: 23 Jun 2007
Posts: 1

View user's profile Send private message

SPI in PIC by Software
PostPosted: Sat Jun 23, 2007 11:04 am     Reply with quote

Hello!I'm new in this forum.
I need some example to comunicate two pic's with SPI by software (because the pins of SPI are occupied with I2C). I'm novice in this subject Sad Sad

THANKS THANKS THANKS!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jun 24, 2007 1:16 pm     Reply with quote

The SPI master is easy to do in software, but the slave is a problem.
The problem is that SPI protocol uses a clock edge to sample the data.
You could use an interrupt (INT_EXT) to detect the start of a \CS signal.
Then within the interrupt routine, you could poll the SCLK signal to
determine when the clock edge occurs for each data bit. Then you could
read the SDI pin immediately after that.

An SPI slave could be done in software, but the speed will be limited
because clock edge detection has to be done by polling.
(At least it does in my proposed method).
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