I2C Help Urgent
hi
i made a I2C aquisition central the other day with a 18f452 and C18 and it work very well.
look my I2C init routine :
void i2c_init(void)
{
DDRCbits.RC3 = 1; // SCL (PORTC,3) en entrée
DDRCbits.RC4 = 1; // SDA (PORTC,4) en entrée
SSPSTAT = 0x80; // Slew rate control disabled for Standard Speed mode (100 kHz and 1 MHz)
SSPCON1= 0x28; // WCOL SSPOV SSPEN CKP SSPM3:SSPM0
// efface WCOL et SSPOV, active I2C, I2C mode maitre horloge=FOSC/(4*(SSPADD+1))
//SSPSTATbits.SMP=1;
//SSPADD = 0x31; // ((20Mhz/100k)/4)-1=49 for 100k operation
SSPADD = (unsigned char)(49);
SSPCON2 = 0x00; // Clear MSSP Conrol Bits
}