I2C-communication between PIC16F88 MCUs (how to?)

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

Post Reply
Andreas
Posts: 17
Joined: Tue Jan 17, 2017 6:10 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

I2C-communication between PIC16F88 MCUs (how to?)

Post by Andreas »

Hey

I'm working on a project where I would like to make two (maybe more as things evolve) microcontrollers communicate, and I found I2C, which is supported by FlowCode v7, as an obvious choice.

Unfortunately I have not been working with it before, and I can't seem to make anything work at all. I have been searching around the internet without finding a solution that works. It just made me more confused because FlowCode seem to have two different i2c-protocol/-component implementations. One is found under "Comms" and the other is found under tools. So my first question is about the difference of these two. People seem to be using both, as if they do the same thing (more or less).

I have programs for both component-types, but none of them seems to work (Both pair of programs is attached: The master sends out the addres (100) and afterwards the value (8). The Master outputs the ACK-bits on port A0 and A1, and the slave outputs the recieved value on port A). I am using PIC16F88, which only have slave compability in hardware, thus flowcode forces me to use software for both master and slave program (otherwise it wont compile)

Unfortunately, I do not have access to an oscilloscope, so i cannot conclude if the error is found is at the master, which controls the communication lines, or at the slave. The more, it would be nice if someone could tell me if I am using the FC-buld-in components correct.

Also i'm a bit in doubt about the addressing. Should i left-shift the address before i send it, or does FlowCode take this into account.

4k7 pull-up-resistors is placed at both communication-lines.

Thanks in advance

- Andreas
Attachments
i2c.zip
Two slaves and two masters are found: one from Comms and one from Tools menu
(8.69 KiB) Downloaded 236 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: I2C-communication between PIC16F88 MCUs (how to?)

Post by Benj »

Hello Andreas,

The I2C components under Tools is the low level CAL I2C calls to allow you to add I2C into a component.

The I2C components under Comms contain the CAL components and also extra features such as the simulated IO flasher, console data and more.

Unless you are building a component and want to create your own panel GUI I would use the components under comms.

Have you seen the master / slave examples here, hopefully they should show you how to get the communications working.

http://www.matrixtsl.com/wikiv7/index.p ... Interface)

Andreas
Posts: 17
Joined: Tue Jan 17, 2017 6:10 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: I2C-communication between PIC16F88 MCUs (how to?)

Post by Andreas »

Hey Benj

Thank you for sorting it out for me. I might not be good enough at FlowCode (yet) to fully understand when to use the low-level-version, but as I just want to make the communication work, I will stick to your adwice and use the Comms version.

I have already been looking at the page you recommended. However the examples on this page all uses the low-level-component from the tools-menu, even though the page describes the slave I2C component of the Comms menu (It was actually that page that got me a bit frustrated about the different i2c-component-types).

I have even tried to program the controllers with the examples, without any luck (but as mentioned, I was a bit frustrated and confused at the time, so I may have given up too fast).

So my question would still be: How to make it work ;) Especially with the Comms versions, because I haven't found any examples which explains both master and slave.

Andreas

Post Reply