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 CCS Technical Support

Master and Slave SPI interfaces on one PIC?

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



Joined: 01 Apr 2007
Posts: 195

View user's profile Send private message

Master and Slave SPI interfaces on one PIC?
PostPosted: Sat Mar 07, 2009 3:41 pm     Reply with quote

I've checked the code listings but haven't seen anything related to this topic other than I2C interfaces.

Has anyone used a "lower" level PIC (18LFxxx family) with simulataneous Master and Slave SPI ports? I have used the built-in hardware port for connection to an SD card interface successfully but I need to act as an SPI Slave for an upstream device and an SPI Master to some downstream devices.

I know the newer PIC32 devices have multiple SPI (and I2C) hardware ports but that would be overkill for my small application.

Compiler version: 3.249
Ttelmah
Guest







PostPosted: Sat Mar 07, 2009 3:51 pm     Reply with quote

For master, software SPI, is easy. If you look at the example files, many of them perform SPI, by simple bit-banging, without making any use of the SPI hardware. The latter (V4) compilers, also allow a software SPI implementation, without having to do the bit-banging yourself. _Slave_, is impossible at faster data rates without the hardware. It can be done at (very) low rates.
Remember also, that one master can drive multiple slave devices, provided you are using a select line on the slaves.

Best Wishes
starfire151



Joined: 01 Apr 2007
Posts: 195

View user's profile Send private message

master/slave spi
PostPosted: Sat Mar 07, 2009 4:02 pm     Reply with quote

Thanks very much for the reply!

I only need the one upstream Slave interface so I will dedicate it to the hardware port of my 18LF2620. I should be able to bit-bang the downstream (Master interface) devices at a slower rate.

Thanks, again, for the response.


Dave
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Mar 07, 2009 5:31 pm     Reply with quote

Example:
http://www.ccsinfo.com/forum/viewtopic.php?t=26888
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