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

problems switching from Master to Slave in I2C

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



Joined: 19 Nov 2005
Posts: 5
Location: Devon, England

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

problems switching from Master to Slave in I2C
PostPosted: Thu Dec 22, 2005 12:51 pm     Reply with quote

Hi.

I am using a PIC18F452 and for most of the time I want the PIC to act as a master on the i2c bus. Occassionally it needs to be a slave.
I initialise the i2c port with:
#use i2c(MASTER, sda=PIN_C4, scl=PIN_C3,FORCE_HW)
Later on in the code when I need to receive data from another device I try to change the I2c port by:
#use i2c(SLAVE, sda=PIN_C4, scl=PIN_C3, Address=0xA0)
But it doesn't work!! The PIC stays as a master.
If I look at the CCS listing there is no new code added where I want the change to take effect.
How do you change from master to slave and back again and why does the compiler ignore the directive?

Thanks.
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