Friday, January 13, 2012

Arduino 128x64 display TM12864L-2

Remember, these details only  refer to the TM12864L-2 display interfaced to the Arduino Mega2560

Connections used in my setup
The connections for the potentiometer must be set this way as the normal ground to 5volt method will blow the chip. The reset connection on pin 17 of the display must not be connected to reset on the Arduino as it will inhibit the loading of sketches. The connections marked in red must be checked as making a mistake here will, at best, result in the display not working. Getting pins 1 and 2 wrong could blow the display.
Be warned!


In addition to the standard libraries, you will also need the GLCD and Time libraries from here and here.

I finally managed to get my syntax correct yesterday evening and my sketch now works the way I wanted it to. The code is a bit big for posting here so I shall only post the relevant part in order to demonstrate the method used.

void loop() {
    // set the cursor to column 0, line 0
  // (note: line 1 is the second row, since counting begins with 0):
  GLCD.CursorTo(0, 0);
  // print from 0 to 9:
  for (int thisChar = 0; thisChar < 10; thisChar++)
  GLCD.print(thisChar);
  delay(500);
  GLCD.print("  ");
  // print the number of seconds since reset:
  GLCD.print(millis()/1000);

  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  GLCD.CursorTo(0, 1);
  // print from 0 to 9:
  for (int thisChar = 0; thisChar < 10; thisChar++)
  GLCD.print(thisChar);
  delay(500);
  GLCD.print("  ");
  // print the number of seconds since reset:
  GLCD.print(millis()/1000);
  // and so on up to .CursorTo (0, 7);

The intent is to write a line to each row on the GLCD screen of a count to ten followed by two spaces and then  the number of seconds since the last reset on a constantly updating screen.
Enhanced by Zemanta

No comments:

Post a Comment

Please add your comments here. We check most days and all suitable comments will be published.

Kardoma:

fills the stage with flags!
Free counters!