Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

New Articles From Microcontroller Tips

Back
Top