Page 1 of 1
Trying to get i2C lcd working with Flowcode
Posted: Tue Mar 29, 2016 4:53 am
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
Re: Trying to get i2C lcd working with Flowcode
Posted: Tue Mar 29, 2016 6:08 am
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:
Martin
Re: Trying to get i2C lcd working with Flowcode
Posted: Wed Mar 30, 2016 6:55 pm
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
Re: Trying to get i2C lcd working with Flowcode
Posted: Wed Mar 30, 2016 6:58 pm
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
Re: Trying to get i2C lcd working with Flowcode
Posted: Wed Mar 30, 2016 7:28 pm
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

Re: Trying to get i2C lcd working with Flowcode
Posted: Wed Mar 30, 2016 7:59 pm
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.
Re: Trying to get i2C lcd working with Flowcode
Posted: Wed Mar 30, 2016 9:29 pm
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
Re: Trying to get i2C lcd working with Flowcode
Posted: Thu Mar 31, 2016 1:18 am
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?
Re: Trying to get i2C lcd working with Flowcode
Posted: Thu Mar 31, 2016 1:55 am
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!

Re: Trying to get i2C lcd working with Flowcode
Posted: Thu Mar 31, 2016 3:16 am
by GTF
Re: Trying to get i2C lcd working with Flowcode
Posted: Thu Mar 31, 2016 8:10 pm
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
Re: Trying to get i2C lcd working with Flowcode
Posted: Thu Mar 31, 2016 8:51 pm
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
Re: Trying to get i2C lcd working with Flowcode
Posted: Thu Mar 31, 2016 9:11 pm
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.
Re: Trying to get i2C lcd working with Flowcode
Posted: Thu Mar 31, 2016 11:03 pm
by GTF
If that worked with the current backpack, then your device address should also be 0x27(39) in FC.
Re: Trying to get i2C lcd working with Flowcode
Posted: Thu Mar 31, 2016 11:07 pm
by Werner
Correct Grant that is what I have:
Re: Trying to get i2C lcd working with Flowcode
Posted: Thu Mar 31, 2016 11:16 pm
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
Re: Trying to get i2C lcd working with Flowcode
Posted: Thu Mar 31, 2016 11:21 pm
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!
Re: Trying to get i2C lcd working with Flowcode
Posted: Fri Apr 01, 2016 12:21 am
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
Re: Trying to get i2C lcd working with Flowcode
Posted: Fri Apr 01, 2016 4:00 pm
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.
Re: Trying to get i2C lcd working with Flowcode
Posted: Fri Apr 01, 2016 6:12 pm
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

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
Re: Trying to get i2C lcd working with Flowcode
Posted: Fri Apr 01, 2016 8:36 pm
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
Re: Trying to get i2C lcd working with Flowcode
Posted: Thu Apr 07, 2016 9:46 am
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