20x4 lcd pixel draw

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
timi
 
Posts: 29
Joined: Tue Jan 10, 2012 10:35 am

20x4 lcd pixel draw

Post by timi »

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

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: 20x4 lcd pixel draw

Post by adafruit_support_rick »

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.

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

Re: 20x4 lcd pixel draw

Post by timi »

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

#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

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: 20x4 lcd pixel draw

Post by adafruit_support_rick »

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

#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(){}

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

Re: 20x4 lcd pixel draw

Post by timi »

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

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

Re: 20x4 lcd pixel draw

Post by timi »

PS: I am using your liquidcrystal library for i2c backpack

thanks

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: 20x4 lcd pixel draw

Post by adafruit_support_rick »

Did you try changing the code as I suggested?

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

Re: 20x4 lcd pixel draw

Post by timi »

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

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: 20x4 lcd pixel draw

Post by adafruit_support_rick »

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

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

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

Re: 20x4 lcd pixel draw

Post by timi »

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

Z_p2
 
Posts: 3
Joined: Tue Feb 12, 2013 9:14 am

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

Post by Z_p2 »

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

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: 20x4 lcd pixel draw

Post by adafruit_support_rick »

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.

Z_p2
 
Posts: 3
Joined: Tue Feb 12, 2013 9:14 am

Re: 20x4 lcd pixel draw

Post by Z_p2 »

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.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: 20x4 lcd pixel draw

Post by adafruit_support_rick »

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

Z_p2
 
Posts: 3
Joined: Tue Feb 12, 2013 9:14 am

Re: 20x4 lcd pixel draw

Post by Z_p2 »

ahhh! right!! thanks!! so when I read 70,4 x 20,8 (for the black grid) it must be milimeters i guess.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”