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

using both I2c and SPI

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








using both I2c and SPI
PostPosted: Mon Nov 14, 2005 6:44 am     Reply with quote

hi,

I need to use the pic16c74 with i2c for memory 24cX and SPI for interfacing CAN controller.

The pin's for i2c and SPI are the same so a multiplex of some kind needs to be done.

What is recommened in Hardware and software to implimant it ?
MikeValencia



Joined: 04 Aug 2004
Posts: 238
Location: Chicago

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Mon Nov 14, 2005 8:31 am     Reply with quote

There is no easy way to multiplex i2c and spi communication if you plan to switch off between the two in the hardware module.

If this is okay with you, the easiest way would be to do SPI in hardware mode with the MSSP module, and to do software i2c with two other pins.
Guest








PostPosted: Mon Nov 14, 2005 1:15 pm     Reply with quote

It is possible to do it.
why to do spi in Hw and i2c in software ?
what is more demanding in terms of code and speed ?


does the compiler nows to impliant the software i2c when other pins are used ?
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Mon Nov 14, 2005 1:52 pm     Reply with quote

Anonymous wrote:
why to do spi in Hw and i2c in software ?
what is more demanding in terms of code and speed ?

SPI is usually faster then I2C, and the SPI devices tend to generate more data (e.g. higher sample rates for D/A and A/D). There is a twist, though. If your PIC is an I2C or SPI slave, you pretty much have to have hardware I2C or SPI.
Guest








PostPosted: Tue Nov 15, 2005 1:00 pm     Reply with quote

well,

The i2c is in master mode.
The microchip CAN controller is a slave so The SPI should be master too.

What is the Hw best configuration ??
Is there a simper way to do it ???

thanks,
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Tue Nov 15, 2005 4:44 pm     Reply with quote

As you are describing it, the simplest way is to have the h/w SPI and s/w I2C. However, the utterly simple way is to use a PIC with a biult-in CAN controller (such as 18F258, 18F248 etc).
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Nov 15, 2005 6:55 pm     Reply with quote

Anonymous wrote:
well,
The i2c is in master mode.
The microchip CAN controller is a slave so The SPI should be master too.

What is the Hw best configuration ??
Is there a simper way to do it ???,


Replace the I2C 24cxx with a SPI version 25cxx.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
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