News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

2 I2c

Started by tolyan249, Oct 07, 2026, 05:52 PM

Previous topic - Next topic

tolyan249

Question: how can I create 2 I2C ports?
Since the speeds are very different, one hardware port works with an OLED display, and I need a second software port for the equipment. For the second port, I want to use the I2C_software.inc file for PIC12F1840.

Thank you.

Frizie

You can opt for the software variant using the I2CIn and I2COut instructions.
Ohm sweet Ohm | www.picbasic.nl

trastikata

You can still use the same hardware I2C port, just change the speed before accessing the devices. Use the SSP1ADD to set the new speed, you can calculate it as shown on page 259, equation 25-1.

tolyan249

Thanks everyone.

tolyan249

One more question. If the controller is powered by 5V and the OLED display is also powered by 5V, do we need to match the SCL and SDA levels? Or will it work like this?
Since the display has a 3.3V stabilizer.

trastikata

Check the datasheet for the required voltage levels on those I2C pins - if 3.3v is sufficient, then just connect the pull-up resistors to the 3.3v rail.

▲