Sanguino, LCD, and Card Reader, LCD Coding Issues

Inspired by JP's project over here: http://www.hackmiami.org/forum/viewtopic.php?f=4&t=52, I decided to give it a whirl. I have used all of the same components: Sanguino 1.0, GDM1602K LCD, and the Mag Reader from Panasonic. My goal is to get this working first and then add an IR Sensor for counting. My trouble is that I am not getting the correct output on the LCD seen in the sketch at that same URL. Beyond what is listed there, I have modified the lines 44-48 in LCD4Bit.cpp of the LCD4Bit library:

int RS = 22;
int RW = 17;
int Enable = 23;
int DB[] = {18, 19, 20, 21};

Currently, the LCD is doing the following: On startup, the LCD blinks the cursor in the upper-right. First card-pull out, getting a 0 in the bottom-right, cursor in the upper left with an arrow. Second card-pull out, mumbo-jumbo of question marks.

If anyone has any insight or thoughts that would be great! Thank you for reading. --I have contacted the dev (JP) and he is too busy to help right now and that forum from the URL is not very active.

If it were me, I'd work on getting the Arduino talking to the LCD before adding the Mag Reader. Just have the Arduino write some known text to a known location.

Exactly my plan! :)

Hmm, can’t get my LCD working, looking for some help. Just looking for what I would need to do just to simply write “Hello World.”

Sanguino Pins:
18,19,20,21 = DB4~7
22 = RS
23 = E

16x2 LCD Pins (HD 44780 compatible):
1-3 = 10K trimpot for LCD contrast
4 = RS
5 = GND
6 = E
11-14 = DB4~7
15 = 120ohm to 5V
16 = GND

Using the LCD4Bit library, I have made these modifications to the .cpp:

int RS = 22;
int RW = 11;
int Enable = 23;
int DB[] = {18, 19, 20, 21};
...
...
...
void LCD4Bit::pushNibble(int value){
  int val_nibble= value & 0x0F;

  for (int i=0; i <= 3; i++) {
    digitalWrite(DB[i],val_nibble & 01);
    val_nibble >>= 1;
  }
  pulseEnablePin();
}

Anyone have a couple line sketch that would work? If not, what do I need to fix?

Thank you!!

Using the LCD4Bit library, ...

Why don't you try the LiquidCrystal library that comes with Arduino v0017?

Don

I have tried that, still no luck with this sketch (same pins as my post above):

/*
  LiquidCrystal Library - Hello World
 
 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the 
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.
 
 This sketch prints "Hello World!" to the LCD
 and shows the time.
 
  The circuit:
 * LCD RS pin to digital pin 22
 * LCD Enable pin to digital pin 23
 * LCD D4 pin to digital pin 18
 * LCD D5 pin to digital pin 19
 * LCD D6 pin to digital pin 20
 * LCD D7 pin to digital pin 21
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 
 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 25 July 2009
 by David A. Mellis
 
 
 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

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

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(22, 23, 18, 19, 20, 21);

void setup() {
  // set up the LCD's number of rows and columns: 
  lcd.begin(16, 2);
  // 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);
}

still no luck with this sketch

The sketch is correct but not as complete as it could be. It is missing the reminder that since, as written, it does not implement the R/W signal it is up to the user to ground pin 5 of the LCD module.

Don

All working!! Pin 18 on my sanguino board was acting funny and causing the LCD to misbehave. All set.