Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Interfacing / Re: LCD4Bit for 20x4 displays! on: October 15, 2008, 04:30:03 am
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.
Pages: [1]