getting started with I2C

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Alberta2012
Flowcode v5 User
Posts: 63
Joined: Fri Apr 19, 2013 2:18 am
Has thanked: 10 times
Been thanked: 14 times
Contact:

getting started with I2C

Post by Alberta2012 »

Hi Everyone,

I wanted to experiment with I2C, so I bought an I2C driver for a standard 1602 LCD

http://www.ebay.com/itm/261210115256?ss ... 4098wt_932

They say master address is 0x27...That's all I know.

I have absolutely no clue on where to start.... I'm planning on using it with an Atmel CPU ( have some ATTINY2313, or ATTINY4313 or ATTINY44A or ATTINY861V or ATTINY48 or ATTINY28V)

Can someone provide me an example ? I just need to display any message: I can figure out the rest !

Thanks !

L'exemple peut etre en francais aussi !

Stanga
Posts: 35
Joined: Sat Aug 07, 2010 10:17 am
Been thanked: 2 times
Contact:

Re: getting started with I2C

Post by Stanga »

I would be interested in this as well. But I would like to use a PIC chip like the PIC16F88 etc.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: getting started with I2C

Post by dazz »

Hi Alberta
If you do a search on here for i2c lcd, there are a few examples there was a recent thread on it, might be worth starting with those posts

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Alberta2012
Flowcode v5 User
Posts: 63
Joined: Fri Apr 19, 2013 2:18 am
Has thanked: 10 times
Been thanked: 14 times
Contact:

Re: getting started with I2C

Post by Alberta2012 »

Hi (again) Dazz,

Prior to post, I looked at the following:
http://www.matrixmultimedia.com/mmforum ... i2c#p48562

It is very, very simple....but .....

It was originally made for a PIC, but I'm guessing , that once converted to AVR, the principle should be the same with AVR. I could not figure out how it works....

- Where is the slave address set ? could not find any where, where an address is entered...
- The LCD is configured to use a bunch of port... I would have expect no port to be configured for the LCD, as it should communicate via I2C ?!?!

As I mentioned, I'm totally new with I2C....I would have expected a communication macro command, that would specify the destination, and the data to be sent .... Didn't see anything close ....

Is it possible that some code was lost when imported as an AVR project ?

Regards,

Jasmin

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: getting started with I2C

Post by dazz »

HI Jasmin

The I2c components are added into the code in that fcf, open the flowchart in that thread, right click the lcd component in the panel, select custom code, then when the code box opens select the start and click edit code, you will see the i2c code added for the start of the lcd, check all the other macros, make a note of the i2c stuff then add your slave address where needed etc, i'm not too clever with i2c, but if you read through as i suggested you should be able to pick it up, there are other examples, but the basics will be the same, i've also attached an i2c spec pdf ,it may pay to read through it

Regards
Dazz
Attachments
I2c spec.pdf
(1.31 MiB) Downloaded 240 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times
Contact:

Re: getting started with I2C

Post by Mantas »

Hi,

here are some sample macros that I made and use very often:
master_read_i2c.fcm
read
(5.36 KiB) Downloaded 304 times
master_write_i2c.fcm
write
(3.74 KiB) Downloaded 268 times
Hope it helps.

BR,
Mantas
Science is my true religion.

Alberta2012
Flowcode v5 User
Posts: 63
Joined: Fri Apr 19, 2013 2:18 am
Has thanked: 10 times
Been thanked: 14 times
Contact:

Re: getting started with I2C

Post by Alberta2012 »

Mantas:

Finally got back from work site. I wanted to try your example, but I could not open them.

My guess is that the .FCM extension, is for the "full blown Microchip version" of Flowcode... Can you confirm ?

If it's the case, that might explain why I could not open it: my version is for the Atmel(AVR) family ....

To Everyone:

Any volunteer to write a quick example of I2C writing to an LCD (address 27) ??

Thanks everyone (and you too Mantas !!)

Jasmin

kersing
Valued Contributor
Valued Contributor
Posts: 2000
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 551 times
Been thanked: 1077 times
Contact:

Re: getting started with I2C

Post by kersing »

FCM is a macro. Use Macro Import to include it into your flow chart.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Post Reply