Trying to get i2C lcd working with Flowcode

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

Moderator: Benj

Post Reply
Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Trying to get i2C lcd working with Flowcode

Post by Werner »

Hi Guys, I have been trying to figure out how to get an i2C LCD working with an Arduino Uno with a lot of trouble. First I can figure out how to get the correct component macro for i2C LCD? I did do some searches with no luck.

Thanks for the help!

Have a great day!

Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by medelec35 »

Hi Werner,
Werner wrote:First I can figure out how to get the correct component macro for i2C LCD? I did do some searches with no luck.
Can or can't?
If can't then:
LCD I2C.png
(66.06 KiB) Downloaded 10981 times
Martin
Martin

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by Werner »

Thanks Martin,
I have everything working great in FC sim however can not get it to work on my boards? One thing I was wondering about is the LCD Address? FC shows 32 where did that come from? Also I am using a i2c backpack on my lcd and have it wired with Gnd, +5 , SCL, SDA. But no backlight will come on. I have thought that using component macro = lcd_i2c1::BacklightControl(true) would take care of it but no luck. I am using an Arduino uno R3 and do have my SCL and SDA hooked up to PC5 and PC4 on the Arduino (See Pic). Any ideas are greatly appreciated! Have a great day Guys!

Werner

Arduino Uno R3 Pinout_768x768_cropped.png
(74.8 KiB) Downloaded 10956 times
Attachments
WB FC LCD properties.png
(30.43 KiB) Downloaded 10956 times
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by Werner »

One other thing I forgot to mention is that I do have two pullup resistors on the SCL/SDA lines of 4.7k installed to +5v.

Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by QMESAR »

Werner wrote:One other thing I forgot to mention is that I do have two pullup resistors on the SCL/SDA lines of 4.7k installed to +5v.
r
I am no way and expert with I2C however in my understanding the lines should be pulled up :D

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by GTF »

I2C address will be from the datasheet for the expander chip on the backpack. And may be fixed or selectable on the backpack board with jumpers.

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by Werner »

Thanks for the feedback Guys! Yeah like usual I didn't word that correctly it is pulling up just through a 4.7k resistor to +5v. I do have the LCD backlight on however I had to wire straight to the A/K pins. I also did verify that the decimal address is correct 0x20 / 32. I had to use a cool little sketch I2C Scanner with the Arduino IDE to find it as I did not have a data sheet for the backpack and nothing at all was printed on it. Any other hints to get my LCD working? Works great in FC just will not work on the boards.

Click here to get the Scanner: http://playground.arduino.cc/Main/I2cScanner

Werner
IMG_20160330_131942223_640x360_cnv.png
(350.63 KiB) Downloaded 10925 times
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by GTF »

Backlights on the ones I have are on as soon as the backpack is powered. I have to turn them off in FC if I don't want them lit. What backpack is it?

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by Werner »

HI GTF, I wish I knew where it came from. I think I got them off Ebay. It is the type that has the two little solder pads for jumping in order to use as SPI. Still no luck! :cry:
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by GTF »

Guessing it is the MCP23008 expander.
http://ww1.microchip.com/downloads/en/D ... 21919e.pdf

Looks like all the ones I have now use the NXP chip.
http://www.nxp.com/documents/data_sheet ... F8574A.pdf
Attachments
backpack.jpg
backpack.jpg (177.75 KiB) Viewed 20822 times

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by Werner »

Hi GTF, the image of the one you showed me is exactly what I was working with. However I never did get that one to work. I picked up another one at Micro Center it's a little different but I got it to work with the Arduino UNO through the Arduino IDE. The one I picked up from Micro Center is more typical like you would see on eBay. It's all black with just four pins coming out the side. Now it looks like I'm back to square one as far as Flowcode is concerned. Having confirmed the address and pins using the Arduino IDE I am at a total loss why it won't work with Flowcode. I have spend a 1 1/2 day just trying to get an LCD to work and it's making me crazy!! Haha Having such a hard time making FC do what I think it should is forcing me to learn programing code and that's what I really did not want to do! Thanks for the help Buddy!

Have a great day!

Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by GTF »

The backpack must use the same read/write format as used in the FC component and the connections between the expander and LCD must match what is in the code. So not every backpack will work without modifications to the FC component. Is data being sent on the SDA line?

Do you have a simple test flowchart for the LCD?

Grant

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by Werner »

Hi Grant, Thanks for the quick reply! Yes this is the simple flowchart that I have been working with: Yes I am using the SDA and SCL lines PC4 and PC5 pins. This is what has worked with the Arduino IDE : LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); and it seems to me to be most typical.
Test code for i2c LDC_402x600.png
(58.49 KiB) Downloaded 10830 times
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by GTF »

If that worked with the current backpack, then your device address should also be 0x27(39) in FC.

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by Werner »

Correct Grant that is what I have:
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by GTF »

Thought you were still using 32.
Werner wrote:I also did verify that the decimal address is correct 0x20 / 32. I had to use a cool little sketch I2C Scanner with the Arduino IDE to find it

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by Werner »

Oooo yes that was the address of the first backpack I tried. Grant have you ever been able to get it to work? How do we go about changing the component macro to work with my backpack? Any ideas?
Thanks again!
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by GTF »

I am using it with PIC devices. The source code is posted on the forum. I think this thread has it: viewtopic.php?f=54&t=16790&p=72517&hili ... ode#p72517

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by GTF »

Werner wrote:One other thing I forgot to mention is that I do have two pullup resistors on the SCL/SDA lines of 4.7k installed to +5v.

Werner
You can likely remove these if your backpack already has them like all mine do. It seems to me I had to do this once to get the I2C working the first time I used one of these. Depends how many pairs of pullups are on the lines and the sizes of the resistors. I think a couple pairs of 4.7K should still work though.
Werner wrote:LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
............................(addr, en,rw,rs,d4,d5,d6,d7,bl,blpol)

This appears to match the pinout on my backpacks.

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by Werner »

Hi Grant, I just wanted to thank you again for the tips and links! This is way more work than I was hoping so I just broke down and bought a Mega no problem with enough pins now. I will just run a million wires to the LCD. Haha :D Do you know if anyone has ever hooked up a one wire serial LCD to using flowcode AVR to program and had it work on hardware?

Have great day Buddy!

Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by Werner »

Here's the next thing I'm wondering if anyone can help me with? I have a real simple program as you see below that writes to the LCD. However the result in simulation is totally different than what I get on the hardware. I am not quite sure why it would do this any ideas?

Thanks for the help!

Werner
IMG_20160401_111254319_HDR_1024x576_cnv.png
(916.69 KiB) Downloaded 10669 times
Code_384x600.png
(42.51 KiB) Downloaded 10669 times
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

User avatar
stregato
Posts: 18
Joined: Tue Feb 25, 2014 12:28 am
Been thanked: 3 times
Contact:

Re: Trying to get i2C lcd working with Flowcode

Post by stregato »

if you verify well the second string exceeds 16 characters display
this type of error to different behavior unpredictable, it is still the error of string too long

Post Reply