mrclolveira
Junior Member level 1

Hi guys,
I am using Pic24fj128gb202 on i2c aplication, but I can not make it work!
Nothing happens in the SDA/SCL pins.
I am using the following code for init
I am using de SDA1/SCL1 so in the configuration bits are
In datasheet says:
But i cant understand what is "writable from SW only", someone can help me?
I am using Pic24fj128gb202 on i2c aplication, but I can not make it work!
Nothing happens in the SDA/SCL pins.
I am using the following code for init
Code:
void initI2C()
{
long Fscl = 100000;
I2C1BRG = (FCY/(2*Fscl))-1; // baud rate 100 KHz
I2C1CONLbits.I2CEN = 0;
I2C1CONLbits.A10M = 0;
I2C1CONLbits.SCLREL = 1;
I2C1CONLbits.I2CSIDL = 1;
I2C1CONLbits.DISSLW = 1;
I2C1CONLbits.SMEN = 0;
I2C1CONHbits.SDAHT = 0;
I2C1CONLbits.I2CEN = 1;
}
I am using de SDA1/SCL1 so in the configuration bits are
Code:
I2C1SEL_DISABLE
In datasheet says:
bit 15 I2CEN: I2Cx Enable bit (writable from SW only)
1 = Enables the I2C™ module, and configures the SDAx and SCLx pins as serial port pins
0 = Disables I2C module; all I2C pins are controlled by port functions
But i cant understand what is "writable from SW only", someone can help me?