Trying to get i2C lcd working with Flowcode
Moderator: Benj
-
- 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
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
Thanks for the help!
Have a great day!
Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
-
- 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
Hi Werner,
If can't then: Martin
Can or can't?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.
If can't then: Martin
Martin
-
- 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
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
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
- 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"
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
-
- 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
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
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
- QMESAR
- 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
I am no way and expert with I2C however in my understanding the lines should be pulled upWerner 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
![Very Happy :D](./images/smilies/icon_biggrin.gif)
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- 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
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.
-
- 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
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
Click here to get the Scanner: http://playground.arduino.cc/Main/I2cScanner
Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
-
- 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
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?
-
- 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
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! ![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
-
- 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
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
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 (177.75 KiB) Viewed 20823 times
-
- 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
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
Have a great day!
Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
-
- 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
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
Do you have a simple test flowchart for the LCD?
Grant
-
- 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
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.
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
-
- 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
If that worked with the current backpack, then your device address should also be 0x27(39) in FC.
-
- 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
Correct Grant that is what I have:
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
-
- 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
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
-
- 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
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!
Thanks again!
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
-
- 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
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
-
- 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
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: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
............................(addr, en,rw,rs,d4,d5,d6,d7,bl,blpol)Werner wrote:LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
This appears to match the pinout on my backpacks.
-
- 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
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
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Have great day Buddy!
Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
-
- 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
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
Thanks for the help!
Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"
Re: Trying to get i2C lcd working with Flowcode
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
this type of error to different behavior unpredictable, it is still the error of string too long