Page 1 of 1

CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Posted: Mon Sep 14, 2020 8:32 pm
by electron67
Hello
I want to connect two equal sensors with I2C_MASTER communication in the same PIC to be read by the same Display; I found the PIC18F26J11. . . I see that this PIC has 2 communication ports I2C_MASTER (CHANEL1 AND SOFTWARE).
Can someone please guide me if it is possible to connect those 2 sensors before buying.

Thanks
Enrique

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Posted: Tue Sep 15, 2020 12:40 pm
by Benj
Hello,

Let me see if I'm reading this correctly.

You would have a single PIC device with a connected display operating as the Master to two sensor devices. Yes this should work fine if either both sensors have different I2C addresses or they are on seperate I2C channel pins.

Another thought I had was if there were two masters operating on the same sensor. This might get more tricky to get right.

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Posted: Tue Sep 15, 2020 5:06 pm
by electron67
Hello Benj,

Ok, so they are 2 identical sensors with the same address connected to a PIC; I found a PIC16F1847 has two I2C_master ports (CHANNEL 1 B1 B4 and CHANNEL 2 B2 B5) and the LCDI2C display connected to I2C SOFTWARE A1 A2.
Theoretically possible to do this?

Thank You Benj

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Posted: Fri Sep 18, 2020 9:07 am
by stefan.erni
Hi electron


You are on the right way.

To choose a pic, there is an online tool. There you can select:
8Bit Pic and 3pcs i2c and you will not found even one. If you reduce to 2pcs i2C you will found a lot.
or if you select:
16Bit and 3pcs i2c, you will found a lot

There is a thing about the tool. It shows you just new/popular pic. If you like to see all (your favorit PIC16F1847) you have to click ShowALLProducts

regards

Stefan

https://www.microchip.com/ParamChartSea ... nchID=1005
press_it.PNG
press_it.PNG (21.11 KiB) Viewed 5559 times

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Posted: Sat Sep 19, 2020 1:28 am
by electron67
Thanks for your help :D
Enrique

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Posted: Thu Sep 24, 2020 5:36 pm
by Benj
As long as each sensor has it's own I2C pins then it should work fine.

You can always use software I2C if you don't want to move to a device with two I2C peripherals. The software mode is fairly robust and works well though probably not quite as fast as the dedicated hardware.

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Posted: Thu Sep 24, 2020 9:38 pm
by electron67
Thanks Benj. :D