| 
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| JakobDM 
 
 
 Joined: 15 Jun 2011
 Posts: 1
 
 
 
			    
 
 | 
			
				| Using Hardware i2c as slave and a software i2c as Master |  
				|  Posted: Wed Jun 15, 2011 1:27 pm |   |  
				| 
 |  
				| Hi 
 In a current project I need to be communicating to a few devices via i2c, but my PIC18F2455 is already a i2c slave.
 The documentation mentions for i2c FORCE_SW.  Is it possible to do the following:
 
 
  	  | Code: |  	  | #use I2C(slave,sda=PIN_B0,scl=PIN_B1, FORCE_HW)
 #use I2C(master,sda=PIN_B5,scl=PIN_B6, FORCE_SW)
 
 | 
 
 Would you need to write any code in order to make the master part work?
 
 Best regards
 Jakob
 |  |  
		|  |  
		| PCM programmer 
 
 
 Joined: 06 Sep 2003
 Posts: 21708
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Jun 15, 2011 2:01 pm |   |  
				| 
 |  
				| You should add the stream parameter to each one and give each stream a unique name.  Then use the stream ID in i2c_start(),
 i2c_write(), i2c_read(), i2c_stop(), etc.
 
 Also, you are using the debugger's clock pin (Pin B6) for the Master,
 so don't expect to be able to debug the program with your ICD.
 |  |  
		|  |  
		|  |  
  
	| 
 
 | 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
 
 |