CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
electron67
Posts: 302
Joined: Sat Jan 12, 2008 2:08 am
Contact:

CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Post 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

User avatar
Benj
Matrix Staff
Posts: 15009
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Post 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.

electron67
Posts: 302
Joined: Sat Jan 12, 2008 2:08 am
Contact:

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Post 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

stefan.erni
Posts: 614
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Contact:

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Post 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 482 times

electron67
Posts: 302
Joined: Sat Jan 12, 2008 2:08 am
Contact:

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Post by electron67 »

Thanks for your help :D
Enrique

User avatar
Benj
Matrix Staff
Posts: 15009
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Post 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.

electron67
Posts: 302
Joined: Sat Jan 12, 2008 2:08 am
Contact:

Re: CONNECT 2 SENSOR I2C_MASTER AT THE SAME PIC

Post by electron67 »

Thanks Benj. :D

Post Reply