Pages: 1 [2] 3   Go Down
Author Topic: LCD4Bit for 20x4 displays!  (Read 8422 times)
0 Members and 1 Guest are viewing this topic.
Switzerland
Offline Offline
Sr. Member
****
Karma: 0
Posts: 276
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hmm one question:
I always get this error after compiling:
Couldn't determine program size:

What's the matter?

cheers
Geko
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you forgot to show your error, but maybe this helps. I had errors to when compiling. The reason was that i had more liberies to control the lcd in the libary directory that use the same files.
Try to tempery move other libs and try again.

I hope this hepls you.
Logged

Switzerland
Offline Offline
Sr. Member
****
Karma: 0
Posts: 276
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hmm that worked!

Ok but now as I uploaded the sketch nothing
appears on the screen.

Hmm could you pls send me your library and sketch...
I think I messed it up...

PS: The Display shows:


Geko
« Last Edit: August 19, 2008, 01:03:41 am by GekoCH » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
hmm that worked!

Hmm could you pls send me your library and sketch...
I think I messed it up...
Geko

This evenig i wil send it to you when i'am home.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I put my library online at:
http://www.ineonline.nl/download/LCD4Bit.zip

Good luck.
Logged

Switzerland
Offline Offline
Sr. Member
****
Karma: 0
Posts: 276
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

thx a lot.
I'm gonna try this...

Geko
« Last Edit: August 19, 2008, 02:03:45 pm by GekoCH » Logged

Switzerland
Offline Offline
Sr. Member
****
Karma: 0
Posts: 276
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

ok great your code works for a 4x20 Display
It does work on my 4x40 Display but of course it
does show the second line on the first line just 20
characters to the right smiley

So I changed your cpp to:
Code:
void LCD4Bit::cursorTo(int line_num, int x){
  //first, put cursor home
  commandWrite(CMD_HOME);
  if (x>39)
  {
        x=39;
  }
switch (line_num)
  {
 case 1:
    x+=0x00 ; break;
  case 2:
    x+= 0x80 ; break;
  case 3:
    x+= 0x28 ; break; // In fact, line 3 is an extension of the line 1 (beyond the 20 first characters)
  case 4:
    x+= 0xa8 ; break; // Line 4 is an extension of line 2
  }
  //
  commandWrite(0x80+x);
}

but it does not work. Could you help me pls....

Geko
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My quistion to you is, don't you have 2 enable pins on you LCD?
in that case look at the repost in this trat Reply #7 from legba7


Else, tray to play with the x e.d. : x+= 0x80 ,0x14 0x54

I don't have your LCD so i can't try.

Good luck, and let us no if it works and with what values.
« Last Edit: August 20, 2008, 01:39:30 pm by billyboy » Logged

Switzerland
Offline Offline
Sr. Member
****
Karma: 0
Posts: 276
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes I know I posted this link put it does not work for my LCD.
Nothing appears the LCD is just empty....

Phu that's a hard nut....

Geko
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here it is: http://bjonnh.free.fr/LCD4Bit.zip This is the old version, I'm using this one for now (an urgent project to do)
Logged

Switzerland
Offline Offline
Sr. Member
****
Karma: 0
Posts: 276
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Here it is: http://bjonnh.free.fr/LCD4Bit.zip This is the old version, I'm using this one for now (an urgent project to do)
so do you have a 4x40 Display running with this code?
Hmm mine does not work. I got 2 Enable signals so I
could just connect one of them...

Thx
geko
Logged

London
Offline Offline
Sr. Member
****
Karma: 1
Posts: 330
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Hi, I was looking for something like this and it works for me on an mtc-c204dply-1n 4x20 lcd display with 1 enable pin.

Gordon
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm stuck! I can't get any text to display, and it seems to be hanging up somewhere since the debug LED never goes off.

I'm using a WH2004A 4x20 with the KS0066 driver.

I'm at a loss at what to do, any ideas?

*edit*

A bit of an update. I'm fairly sure that the Freeduino is talking to the LCD, since the lcd.clear command is working. Also, I inserted a small debug script for the LED, it blinks once for the first command, twice for the second ect. It's not just staying on anymore, it's blinking like it's supposed to (the LED) but I still don't have any text output on the display. Here's the code I've been using, any suggestions?


//example use of LCD4Bit library

#include <LCD4Bit.h>
//create object to control an LCD.  
//number of lines in display=1
LCD4Bit lcd = LCD4Bit(4);



void setup() {
  pinMode(13, OUTPUT);  //we'll use the debug LED to output a heartbeat

  lcd.init();
  //optionally, now set up our application-specific display settings, overriding whatever the lcd did in lcd.init()
  //lcd.commandWrite(0x0F);//cursor on, display on, blink on.  (nasty!)

}

void loop() {  
  digitalWrite(13, HIGH);  //light the debug LED
  delay(200);
  digitalWrite(13, LOW);
  delay(1000);
  
  //lcd.clear();
  digitalWrite(13, HIGH);  //debug lcd.clear
  delay(200);  
  digitalWrite(13, LOW);
  delay(1000);
  
  lcd.cursorTo(1,0);
  lcd.printIn("Line 1");
  digitalWrite(13, HIGH); //debug first line of print
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(13, LOW);
  delay(1000);
  
  lcd.cursorTo(2,0);
  lcd.printIn("Line 2");
  digitalWrite(13, HIGH); // debug second line
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(13, LOW);
  delay(1000);

  
  lcd.cursorTo(3,0);
  lcd.printIn("Line 3");
  digitalWrite(13, HIGH);  //debug third line
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(13, LOW);
  delay(1000);
  
  lcd.cursorTo(4,0);
  lcd.printIn("Line 4");
  digitalWrite(13, HIGH);  //debug fourth line
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(13, LOW);
  delay(1000);
  
  
  delay(1000);
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);  //end debug LED

 }



*another edit*

Yes I did comment out the lcd.clear command on purpose, just to see if it was clearing the 2 lines of blocks when I powered it up, and yes it does, if it's commented out, the blocks stay on the screen.

*yet another edit*

Ok, for some reason, when the cursor goes to line 3, the blocks dissapear. I'm guessing that there's no problem in communication, as things are happening, it's just that I'm getting no text output on the screen.
« Last Edit: October 15, 2008, 04:55:45 am by Stormrider » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I am using the code below to write user-defined code, but it is not working. I am using HD44780 4x20 LCD module.

Quote
void LCD4Bit::WriteCGRAM(int adress, char code[]) {
   commandWrite(0x40+(adress<<3));

   for (int i=0 ; i <= 7 ; i++)
        {
                print(code);
        }
   commandWrite(CMD_HOME);
}
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 153
veroboaring is the new XGame - Extreme Veroboarder
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all!
I'm using to a 4x20 LCD a wintec 2004.

Now i have it working and what i note in it is this, to print the complete scren needs a little bit time   :'(, so what i do is minimize all the delays() inside the lcd4bit lib.

Now works great, but what will be nice is send the complete screen and then turn on the display, i meen charge it first and then show the text. :o

Can be done? using what cmd ? ;D

Best Regads
Frank
Logged

Pages: 1 [2] 3   Go Up
Jump to: