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

Highest speed possible with software I2C?

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



Joined: 13 Jul 2005
Posts: 25
Location: Maryland

View user's profile Send private message

Highest speed possible with software I2C?
PostPosted: Mon Apr 03, 2006 12:44 pm     Reply with quote

Hello all,
I am stuck having to use SPI and I2C on the same PIC18F458 device. Based on info from previous postings, I am using 10MHz SPI using the dedicated hardware lines, and will use I2C on some other two I/O lines , not using the HW I2C module on this PIC. Does anyone know what kind of speed I could be looking at with the SW I2C? Could I meet the 400 kHz of the fast I2C spec?
Thanks,
Vadim
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

PostPosted: Mon Apr 03, 2006 12:52 pm     Reply with quote

No one can answer that question without knowing the clock speed of the micro! Why do you have to meet the 400KHz spec? You do realize that is the max rate and slower rates are okay.
dima2882



Joined: 13 Jul 2005
Posts: 25
Location: Maryland

View user's profile Send private message

PostPosted: Tue Apr 04, 2006 9:14 am     Reply with quote

Sorry, I didn't put the clock of the PIC... its 40 MHz, thus allowing for the afore-mentioned 10 MHz SPI. I would really like to have a sampling rate of 200 kHz with the I2C sensor I'm using, so its higher than the standard 100 kHz spec. I figured I'd need to go to 400 kHz next.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

PostPosted: Tue Apr 04, 2006 11:05 am     Reply with quote

You can't sample a device at 200KHz if you communicate to it @ 400K BITS PER SECOND. Think about it. That would only allow 2 bits per sample.
dima2882



Joined: 13 Jul 2005
Posts: 25
Location: Maryland

View user's profile Send private message

PostPosted: Tue Apr 04, 2006 11:43 am     Reply with quote

Of course not, I simply meant that the minimum the design would have needed is 200 kHz. It can go higher, but not lower, hence the full speed 400k I2C spec is the ticket. In any case, I got it on a breadboad working off two general I/O pins, and got the I2C packets at 400 kHz, so it does seem to work.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Apr 04, 2006 12:43 pm     Reply with quote

I think you miss Mark's point that you don't have to choose between 100kHz and 400kHz. Those numbers are limits, not exact speeds like an RS232 asynchronous serial link. If you want to use 200kHz go ahead, or 210kHz, or anything less than 400kHz. The master sets the speed and the slave just has to keep up with it. You can even stop in the middle of a byte, service a short interrupt, and continue the byte.
_________________
The search for better is endless. Instead simply find very good and get the job done.
dima2882



Joined: 13 Jul 2005
Posts: 25
Location: Maryland

View user's profile Send private message

PostPosted: Tue Apr 04, 2006 3:01 pm     Reply with quote

Ahh, I see now. Well that clears things up. Thanks for your help guys.
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