20x4 lcd pixel draw
Moderators: adafruit_support_bill, adafruit

20x4 lcd pixel draw

by timi on Sun Feb 03, 2013 12:52 pm

hi,

I have this http://www.adafruit.com/products/198 lcd with the i2c backpack and I want to draw pixel size bars, can I do that with the liquidcrystal library ?

thanks

timi
 
Posts: 29
Joined: Tue Jan 10, 2012 10:35 am

Re: 20x4 lcd pixel draw

by adafruit_support_rick on Sun Feb 03, 2013 1:08 pm

Depending on how you want these bars to look, you can sort-of do it. You'll have to print the bars as character sequences. See the datasheet (page 17,18) for the complete character set.

If none of those characters will work for you, you can define your own characters in "character generator RAM" on the HD44780 chip. See page 13 of the datasheet:
In the character generator RAM, the user can rewrite character patterns by program. For 5 × 8 dots, eight character patterns can be written, and for 5 × 10 dots, four character patterns can be written.

adafruit_support_rick
 
Posts: 12924
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 20x4 lcd pixel draw

by timi on Sun Feb 03, 2013 2:47 pm

I am trying to test this code but it just prints some scrambled pixels
can someone give me a little help with the right code ?:(

Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(0);

byte test[8] = {
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
};

void setup() {
  lcd.createChar(1, test);
  lcd.begin(20, 4); 
  lcd.write(1);
}
void loop(){}


thanks

timi
 
Posts: 29
Joined: Tue Jan 10, 2012 10:35 am

Re: 20x4 lcd pixel draw

by adafruit_support_rick on Mon Feb 04, 2013 12:50 pm

Does the display work otherwise? What happens if you do lcd.write('a'); instead of lcd.write(1)? Do you see the 'a' correctly?

If so, try moving the call to createChar to after the begin:
Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(0);

byte test[8] = {
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
};

void setup() {
  lcd.begin(20, 4); 
  lcd.createChar(1, test);
  lcd.write(1);
}
void loop(){}

adafruit_support_rick
 
Posts: 12924
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 20x4 lcd pixel draw

by timi on Mon Feb 04, 2013 1:31 pm

sure the display works without problems so far and it prints a with lcd.write('a');

here here is a photo of the char displayed with lcd.write(1);
Image

and the lcd.write('a');
Image

timi
 
Posts: 29
Joined: Tue Jan 10, 2012 10:35 am

Re: 20x4 lcd pixel draw

by timi on Mon Feb 04, 2013 1:38 pm

PS: I am using your liquidcrystal library for i2c backpack

thanks

timi
 
Posts: 29
Joined: Tue Jan 10, 2012 10:35 am

Re: 20x4 lcd pixel draw

by adafruit_support_rick on Mon Feb 04, 2013 3:50 pm

Did you try changing the code as I suggested?

adafruit_support_rick
 
Posts: 12924
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 20x4 lcd pixel draw

by timi on Mon Feb 04, 2013 6:52 pm

yes I did, and it prints "a" on lcd

timi
 
Posts: 29
Joined: Tue Jan 10, 2012 10:35 am

Re: 20x4 lcd pixel draw

by adafruit_support_rick on Mon Feb 04, 2013 7:13 pm

No - I meant changing the order of the code in setup(). Moving the call to createChar() to after the call to begin(). See my earlier post..
Code: Select all | TOGGLE FULL SIZE
void setup() {
  lcd.begin(20, 4); 
  lcd.createChar(1, test);
  lcd.write(1);
}

adafruit_support_rick
 
Posts: 12924
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 20x4 lcd pixel draw

by timi on Mon Feb 04, 2013 7:32 pm

awesome, it works, newbie mistake:( also need to set setCursor() or else nothing shows up

timi
 
Posts: 29
Joined: Tue Jan 10, 2012 10:35 am

HD44780 simply what's it's size in centimeters?

by Z_p2 on Tue Feb 12, 2013 9:16 am

Hello
I am just trying to find out what is the size of this HD44780 (inches or cm or whatever! : ) )
Somehow I have not found it on data sheets. :/
Thank you, sorry for really simple question
Z_p2
 
Posts: 3
Joined: Tue Feb 12, 2013 9:14 am

Re: 20x4 lcd pixel draw

by adafruit_support_rick on Tue Feb 12, 2013 10:11 am

The HD44780 is a driver chip common to many different character LCD displays. Are you interested in the dimensions of the chip, or in the dimensions of a particular display?

Display dimensions are available on our product pages. The dimensions for this 20x4 display are available from the data sheet linked to on the product page.

adafruit_support_rick
 
Posts: 12924
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 20x4 lcd pixel draw

by Z_p2 on Tue Feb 12, 2013 12:00 pm

Oh, sorry I gave the wrong ID. I meant the display itself. Yes I found the data sheet of the product " Standard LCD 20x4 + extras - white on blue ID: 198" . Unfortunately having read the 18 pages and searching for the dimensions in cm or inches of the display, I did not find the size of the display that gives 20 characters wide, 4 rows. I do not have it in hand, so I cannot imagine the size or height of characters. Is the display where the characters are > than 10cm wide?
Thank you for your response.
Z_p2
 
Posts: 3
Joined: Tue Feb 12, 2013 9:14 am

Re: 20x4 lcd pixel draw

by adafruit_support_rick on Tue Feb 12, 2013 12:11 pm

Every possible dimension except the designer's shoe size is in the diagram on page 4 of the datasheet. :D

adafruit_support_rick
 
Posts: 12924
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 20x4 lcd pixel draw

by Z_p2 on Tue Feb 12, 2013 12:31 pm

ahhh! right!! thanks!! so when I read 70,4 x 20,8 (for the black grid) it must be milimeters i guess.
Z_p2
 
Posts: 3
Joined: Tue Feb 12, 2013 9:14 am