Testing I2C to run an SSD1306 OLED display with PIC16F1938

Status
Not open for further replies.
Port C sda and scl 2 and 3 have to be inputs... right now you have them low and outputs..

portc = 0;
trisc = 0xff; <---- has to be inputs..

Err I thought the SPI signals from the PIC is a "master" right?

Also, weren't these things are configured the moment we used the I2C_init()?
 
Also, weren't these things are configured the moment we used the I2C_init()?
Possibly not! If you select the I2C init from the library manager and right click help, it will tell you if YOU need to set direction... Also!! You may need to specify pins... MikroC is bad for that..

The way I2C works is leave the pins high impedance... The ports are held low, so SCK is high ( because of the pullup ) if you then tris the pin it goes low.. One more tris and it goes high... So in effect you are toggling the pin direction.. Weird, but that's how its done...
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…