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 support@ccsinfo.com

I2C Slave problem

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



Joined: 15 Dec 2003
Posts: 6

View user's profile Send private message

I2C Slave problem
PostPosted: Mon Dec 15, 2003 12:02 pm     Reply with quote

Hi,

I'm trying to get a Master-Slave configuration between to Pic to work.

Master is a 16F876A, use programm code 2416.c
Slave is a 16F872, using Ex_slave.c

After 20 to 60sek the Slave is looked, SDA is constandly low.

I recompiler my software for a different Hardware with a 16F876A and it runs perfektly for days.

Is there anything spezial on the 16F872? I tryed more the one hardware with the 16F872, it's not the PIC.

Any help? Thanks
Guest








i2s slave and master
PostPosted: Thu Dec 18, 2003 11:05 am     Reply with quote

Hello!
I try to do maybe the same thing like you : I have the PIC16f877 in master and the PIC16f873 in slave, but I have no idea to how make the i2c communication can you help me?
Guest








PostPosted: Thu Dec 18, 2003 5:08 pm     Reply with quote

Hi Guest,

not sure what you mean.

You kann copy Ex_slave.c for your 16F873.
In your main you fill your buffer with the data, you want to send.

void main ()
{
int i;

fState = NOTHING;
address = 0x00;
for (i=0;i<0x10;i++)
buffer[i] = 0x00;

enable_interrupts(GLOBAL);
enable_interrupts(INT_SSP);

while (TRUE)
{
buffer[0] = Data0;
buffer[1] = Data1;
buffer[2] = Data2;
}
}


For your Master use code from eg. 2416.c

if you put this lines into your main in should read Data0 to Data2
Zahl0 = read_ext_eeprom(0x00);
Zahl1 = read_ext_eeprom(0x01);
Zahl2 = read_ext_eeprom(0x02);


Hope this helps.
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