| 
	
	|  |  |  
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| Guest 
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				| i2C clock Speed |  
				|  Posted: Mon Aug 16, 2004 1:03 pm |   |  
				| 
 |  
				| 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
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Mon Aug 16, 2004 3:53 pm |   |  
				| 
 |  
				| 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. |  |  
		|  |  
		|  |  
  
	| 
 
 | 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
 
 |