I2C is making me crazy
I tried for 5 days to make i2c working on pic18f47k40 and actually i'm not figuring out why it doesn't work.
i have to simply write the slave address, the LCD register and then the character to display.
I cannot see anything, and if i put a "flag code" after the byte sending (e.g. led turn on) the code is not executed.
So i gather that the instruction "I2C1_WriteNBytes(ADDR_lcd, bytetosend, 1);" is not working because it goes in a sort of while(!bus_available) state, and i cannot fix it.
I connected a pullup resistor in both lines. I'm using the hardware i2c mode with the mssp peripheral.
i configured the internal oscillator at 64MHz and the divider at 32, so i have a freq of 2MHz.
mssp set in i2c mode obviously, master, at freq of 100kHz.
mssp pins sda1 and scl1 set to portc4 portc3. (first time i use mcc, so maybe an error could be here).
Posting the code is useless because i'm searching for a code that will work sure. A simple and working I2C1_WriteNBytes(address, data, lenght);
I tried a couple of days ago to read data from an ADC. Same result, it stops executing when it arrives at the read instruction.
Can someone more experienced than me with i2c, help me find a code and a mcc setting set that works fine with i2c slaves?