LCD problems: "Hola Car"

Hi

I'm new to arduino (4 days) and i have been following the tutorials, everything have worked ok except for some problems to control a lcd, i'm geting half the characters: "Hola Car". any clue?

Thanks for making such a great tool!

Problem solved!
The LCD wasn’t a 16x1, it was a 8x2 display, so here´s my modifications to the original code.
Maybe it will help someone.

Cheers

 /* LCD Hola
 * --------
 *
 * This is the first example in how to use an LCD screen
 * configured with data transfers over 8 bits. The example
 * uses all the digital pins on the Arduino board, but can
 * easily display data on the display
 *
 * There are the following pins to be considered:
 * 
 * - DI, RW, DB0..DB7, Enable (11 in total)
 *
 * the pinout for LCD displays is standard and there is plenty
 * of documentation to be found on the internet.
 *
 * (cleft) 2005 DojoDave for K3
 *
 */

int DI = 12;
int RW = 11;
int DB[] = {3, 4, 5, 6, 7, 8, 9, 10};
int Enable = 2;

void LcdCommandWrite(int value) {
 // poll all the pins
 int i = 0;
 for (i=DB[0]; i <= DI; i++) {
   digitalWrite(i,value & 01);
   value >>= 1;
 }
 digitalWrite(Enable,LOW);
 delayMicroseconds(1);
 // send a pulse to enable
 digitalWrite(Enable,HIGH);
 delayMicroseconds(1);  // pause 1 ms according to datasheet
 digitalWrite(Enable,LOW);
 delayMicroseconds(1);  // pause 1 ms according to datasheet
}

void LcdDataWrite(int value) {
 // poll all the pins
 int i = 0;
 digitalWrite(DI, HIGH);
 digitalWrite(RW, LOW);
 for (i=DB[0]; i <= DB[7]; i++) {
   digitalWrite(i,value & 01);
   value >>= 1;
 }
 digitalWrite(Enable,LOW);
 delayMicroseconds(1);
 // send a pulse to enable
 digitalWrite(Enable,HIGH);
 delayMicroseconds(1);
 digitalWrite(Enable,LOW);
 delayMicroseconds(1);  // pause 1 ms according to datasheet
}

void setup (void) {
 int i = 0;
 for (i=Enable; i <= DI; i++) {
   pinMode(i,OUTPUT);
 }
 delay(100);
 // initiatize lcd after a short pause
 // needed by the LCDs controller
 LcdCommandWrite(0x38);  // function set:
                         // 8-bit interface, 2 display lines, 5x7 font
 delay(64);                      
 LcdCommandWrite(0x38);  // function set:
                         // 8-bit interface, 2 display lines, 5x7 font
 delay(50);                      
 LcdCommandWrite(0x38);  // function set:
                         // 8-bit interface, 2 display lines, 5x7 font
 delay(20);                      
 LcdCommandWrite(0x06);  // entry mode set:
                         // increment automatically, no display shift
 delay(20);                      
 LcdCommandWrite(0x0E);  // display control:
                         // turn display on, cursor on, no blinking
 delay(20);                      
 LcdCommandWrite(0x01);  // clear display, set cursor position to zero  
 delay(100);                      
 LcdCommandWrite(0x80);  // display control:
                         // turn display on, cursor on, no blinking
 delay(20);                      
}

void loop (void) {
  LcdCommandWrite(0x02);  // set cursor position to zero  
  delay(10);                     
  // Write the welcome message 
  LcdDataWrite('H');
  LcdDataWrite('o');
  LcdDataWrite('l');
  LcdDataWrite('a');
  LcdDataWrite(' ');
  LcdDataWrite('C');
  LcdDataWrite('a');
  LcdDataWrite('r');
  LcdCommandWrite(0x0C0); // moves cursor to second line
  LcdDataWrite('a');
  LcdDataWrite('c');
  LcdDataWrite('o');
  LcdDataWrite('l');
  LcdDataWrite('a');
  delay(500);
}

just had to add, a few years later, that the lcd display is, in terms of user interface a 16x1, but for protocol interfacing, a 8x16 "Hola Car", is because of the tutorial "Hola Caracola" cheers

Well, that was certainly out of the blue. Have you been up to anything since then? Do you have another login, because you've only had 5 posts (counting your last one)...? It just seems strange that you would make a few posts regarding the Arduino, then "drop off the face of the earth"...then pop in again!

;D

Francisco:

If you want to find out why the 16x1 display has to be set up as an 8x2 then follow the LCD Addressing link at http://web.alfredstate.edu/weimandn.

If you want to find out how to correctly initialize the LCD controller then follow the LCD Initialization link at the same URL.

Why are you writing a static message in loop() instead of in setup()?

Don