Inter uC Comms - I2C

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Docara
Posts: 315
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Inter uC Comms - I2C

Post by Docara »

Hi

Need some help understanding I2C process using FC components and Interrupts.

I will probably be using 2x Atmel328P based uC'ers.

It looks Like I will need to implement 3 or 4 byte communication occasionally between the two. I see no mention of interrupts or ISR's when I drag the component to the dash board or the component icon to the tree.

So how do I implement a 'transparent; comms system utilising the onbaord hardware I2C port

thanks
Matt

Docara
Posts: 315
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: Inter uC Comms - I2C

Post by Docara »

anyone?

mnf
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Inter uC Comms - I2C

Post by mnf »

I managed to get an Arduino to communicate successfully with two (or more) slave boards (all 328p)

See http://www.matrixtsl.com/mmforums/viewt ... 71&t=20043

My ultimate goal was to create a circular communications system with each slave passing the (altered) message to the next slave before it was ultimately passed back to the original master - you can see my (non-working) effort in the same topic. I've had little time to work on it because of other commitments - but will come back to it at some point and hopefully progress a little further.

Unfortunately the Flowcode doesn't utilise the interrupt facility of the AVR hardware (and I guess this would be very difficult to do in whilst supporting multiple targets)

Hope this helps a little - what are you trying to achieve?

Martin

Docara
Posts: 315
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: Inter uC Comms - I2C

Post by Docara »

Hi Martin,
mnf wrote:Unfortunately the Flowcode doesn't utilise the interrupt facility of the AVR hardware (and I guess this would be very difficult to do in whilst supporting multiple targets)
Sorry - this is going to sound really rude - How do you know I2C Interrupts are not supported. - hands on experience or from Matrix?

This seems a massive omission for a comms based system.

Matt

mnf
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Inter uC Comms - I2C

Post by mnf »

Partly from use and partly because I thought I'd read it in the forums:

For example viewtopic.php?f=7&t=19166&p=84617&hilit ... upt#p84617

But that was back in October and FC7 - now there's the whole new world of FC8.

- and I'd love to be proved wrong; an interrupt based system would make for some neater code!


Martin

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Inter uC Comms - I2C

Post by LeighM »

Hi,
I've done a quick edit to the ATMEGA328P fcd (Flowcode V8) to add a TWI interrupt option.
It's experimental as I have not had chance to test it, but if you want to give it a go, attached
Attachments
ATMEGA328P.fcdx
(20.91 KiB) Downloaded 173 times

Docara
Posts: 315
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: Inter uC Comms - I2C

Post by Docara »

Hi Leigh,

Can I use that with FC7?

Also, I notice in the 'Latest' FC7 than Ben posted that there has been some work generally on the ATMEL328P does this included work on the trigger levels of the Pin Change interrupts (triggering on both rising and falling edges)

Matt

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Inter uC Comms - I2C

Post by LeighM »

Also, I notice in the 'Latest' FC7 than Ben posted that there has been some work generally on the ATMEL328P does this included work on the trigger levels of the Pin Change interrupts (triggering on both rising and falling edges)
At a quick glance, it looks like it
Can I use that with FC7?
V7 version attached
Attachments
ATMEGA328P.fcdx
(20.25 KiB) Downloaded 174 times

Post Reply