Go Down

Topic: Problem with lcd.print ? (Read 1 time) previous topic - next topic

melw

Hi all,

I'm new to Arduino, and I'm just trying to hook up an LCD display with datatransfer over SPI.

My LCD is a DogLcd, DOGM162, and I'm using a Uno R3.

I set it up as according to the wiki:
http://www.pjrc.com/teensy/td_libs_DogLcd.html

My contrast is fine (see the attached picture), and I can set the cursor...
Using the blink example provided in LiquidCrystal Library, my cursor moves around but nothing is printed on the screen.

This is the code I'm using:
Besides using DogLcd.h, I virtually didn't change a thing..

Code: [Select]

#include <DogLcd.h>
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
DogLcd lcd(2, 3, 4, 5);
// these constants won't change.  But you can change the size of
// your LCD using them:
const int numRows = 2;
const int numCols = 16;

void setup() {
   Serial.begin(9600);
  // set up the LCD type and the contrast setting for the display
  lcd.begin(DOG_LCD_M162);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
   
  // loop from ASCII 'a' to ASCII 'z':
  for (int thisLetter = 'a'; thisLetter <= 'z'; thisLetter++) {
    // loop over the columns:
    for (int thisCol = 0; thisCol < numRows; thisCol++) {
      // loop over the rows:
      for (int thisRow = 0; thisRow < numCols; thisRow++) {
        // set the cursor position:
        lcd.setCursor(thisRow,thisCol);
        // print the letter:
        lcd.write(thisLetter);
        delay(200);
      }
    }
  }
}


I've checked the connectivity of the pins, and they are soldered fine.
Also if I detach the wire for D0-D3, then the lcd cursor doesn't rotate anymore, as expected.

I really can't figure out what's going on besides that the LCD is faulty... but I have two of these DogLCDs and they are doing exactly the same thing :(


Any input is appreciated!!!
Thanks a lot!!!

Goldfile

found the problem, in the code it says you need to use from pin 2 up. now you have got it on pin 1 (tx)
see if that helped, if not give me a message!

kind regards,
-Goldfile
Need help? Don't hesitate to ask me!

melw

Hi Goldfile,

Thanks for the reply, but I think I am connected from pin2 up?
I accidentally broke my header too short, but pin0 doesn't have a header, pin1 has a header but not connected, and pin2-5 are connected?

And I shifted the headers around too, but that made the cursor stops moving around even..

Thanks!

Goldfile

Hi!
A couple of days ago I encountered the problem of me seeing only blocks,  with a LCM1603 IIC V1 board. which was 4 line display, since yours is 2 line. I recommend running this code, and see what happens.
http://arduino-info.wikispaces.com/LCD-Blue-I2C#v1

NOTE: use the analog side:
gnd - gnd
Vcc - 5v
sca - A4
sda -A5
Need help? Don't hesitate to ask me!

melw

Hey,

I don't think my LCD has I2C support. I only have 4/8 bit and SPI..

Thanks!

Goldfile

Hello!
Check the ebay site from the seller you got it from, because most cases, there will be a downloadable file you can put in your libraries folder, and you can make it run examples of that.
message me for more help if needed!

kind regards,
-Goldfile
Need help? Don't hesitate to ask me!

melw

Hey,

This is the seller's wiki:
http://code.google.com/p/doglcd/downloads/list

And I did downloaded this and used included in my sketch
Code: [Select]
#include <DogLcd.h>

I also ran the example the DogLcd library provided (http://code.google.com/p/doglcd/wiki/Code), and it exhibits the same behavior as the example from the Arduino official LiquidCrystal library..

The setCursor() function works, but print() and write() don't.

Thanks!


Goldfile

Hey! the code you originally posted and the one on the sellers page are different. Remember that the seller's code is directly aimed at YOUR lcd. Try that one and see what happens!
keep me updated.

kind regards,
-Goldfile
Need help? Don't hesitate to ask me!

melw

Hi,

The seller's code was the first one that I tried.
But all it did was having the cursor at the defined position on the lcd without any characters.
I am able to move the cursor around by using the setCursor() function, but the lcd does not print anything...

Code: [Select]
/*
  DogLcd Library - Hello World

  Demonstrates the basic use of a DOGM text LCD display.
This sketch prints "Hello World!" to the LCD
and shows the time.

See the hardware-documention for wiring instuctions
We assume  the following pins are connected:
* LCD SI pin to digital pin 2
* LCD CLK pin to digital pin 3
* LCD RS pin to digital pin 4
* LCD CSB pin to digital pin 5
* LCD RESET pin is not used
* LCD Backlight pin is not used

http://code.google.com/p/doglcd/w/edit/Code
*/

// include the library code:
#include <DogLcd.h>

// initialize the library with the numbers of the interface pins
DogLcd lcd(2, 3, 4, 5);

void setup() {
  // set up the LCD type and the contrast setting for the display
  lcd.begin(DOG_LCD_M162);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}


Thanks!


Goldfile

to be honest, I have no idea how to help you any further.
But what I will do though, tomorrow, (It is in the middle of the night now) I will post some pictures of my setup and code.

kind regards,
-Goldfile
Need help? Don't hesitate to ask me!

Go Up