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

switch between SPI & I2c in software

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



Joined: 29 Aug 2004
Posts: 12

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

switch between SPI & I2c in software
PostPosted: Mon Sep 06, 2004 5:15 am     Reply with quote

i want use spi & i2c in time .i read datasheet & it wrote that only
one of them can be use at the time.
Can i switch between SPI & I2c in software?
is threre any thing wrong with the device that is i2c when i use spi?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Sep 06, 2004 5:30 am     Reply with quote

The PIC hardware supports only one of either SPI and I2C. The CCS software however contains a good software I2C driver.
So you can use both: SPI in hardware and at the same time I2C in software (ofcourse not on the same i/o pins).
Ttelmah
Guest







Re: switch between SPI & I2c in software
PostPosted: Mon Sep 06, 2004 10:44 am     Reply with quote

nader wrote:
i want use spi & i2c in time .i read datasheet & it wrote that only
one of them can be use at the time.
Can i switch between SPI & I2c in software?
is threre any thing wrong with the device that is i2c when i use spi?

Technically, there is nothing to stop you switching the hardware in the chip between SPI, and I2C modes, _but_ there are some significant external hardware problems externally. If the chips support a proper 'select' line, so you can ensure only one is listening at a time, then this should be do-able. Otherwise you would have to look through all possible states in each interface, and check these against the data sheets, to see what responses the chips would general. 95% of the possible problems would only lead to data problems, _but_ you have to remember that an I2C slave, can pull the data line low, when extending a transactiion, while on SPI, this line is only ever driven by the master. The potential would then exist for the drivers to be fighting...
Provided you have enough pins, you would be better off, using software I2C, on a seperate pair of pins. This was discussed recently on the forum, and in fine. For instance, I have a 18252, which functions as an SPI slave, using the hardware interface, and controls two other I2C devices using the software interface.

Best Wishes
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