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

i2C clock Speed

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








i2C clock Speed
PostPosted: Mon Aug 16, 2004 1:03 pm     Reply with quote

Hi all,

I use formula osc/4 * (SSPADD+1) to get the colck speed I want.

Code as folows:
Code:

#include <16f877.H>
#fuses hs, NOPROTECT, BROWNOUT, PUT, NOWDT, NOLVP
#use delay(clock= 20000000)
#use i2c(Master,fast,sda=PIN_C4, scl=PIN_C3, FORCE_HW)

//========================
#byte SSPADD = 0x93
main ()
{
SSPADD = 0x20;   
output_float(PIN_C3);
output_float(PIN_C4);
i2c_start();
i2c_write(0x1E);
i2c_write(0x0f);
i2c_start();
i2c_write(0x1f);
i2c_read(0);
i2c_stop();
while(1)
{
;

}

}


Here is the result I got

SSPADD cloock Speed Formula
B 385KHZ 417KHZ
C 357KHZ 385KHZ
D 333KHZ 357KHZ
20 147KHZ 333KHZ


It looks like if I change formula to OSC/4*(SSPADD+2), results match formula.

I use 1 K pull up resistor, will this affect speed?

Thanks in advance

Minmin
valemike
Guest







PostPosted: Mon Aug 16, 2004 3:53 pm     Reply with quote

I think the pullup resistor only affects how long it takes to swing the logic level up and down. As long as this swing happens well ahead of time for the rate of the SCL, in time for SDA to sample an unambiguous level, you should be fine, I think. Someone correct me if i'm wrong.
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