View previous topic :: View next topic |
Author |
Message |
Gerd
Joined: 15 Dec 2003 Posts: 6
|
I2C Slave problem |
Posted: Mon Dec 15, 2003 12:02 pm |
|
|
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 |
Posted: Thu Dec 18, 2003 11:05 am |
|
|
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
|
|
Posted: Thu Dec 18, 2003 5:08 pm |
|
|
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. |
|
|
|