Pages: [1]   Go Down
Author Topic: 128x64 glcd trouble.... (newbie)  (Read 2364 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am currently using an ATMEGA1280 with a TM12864L-2 (128x64 glcd) which from everything i have been reading is a clone of the ever popular KS0108. I have checked my wiring against pin-out tables a thousand times over, and tried a bunch of pre-written sketches for the KS0108 but no dice. Whenever i run the "bigdemo" sketch i keep getting errors when i try to validate the sketch such as, and not limited to, " 'TM12864L-2'was not declared in this scope " in reference to the third line in....

PX_HOUR = PX_MINUTE = PX_SECOND = x_centre ;
PY_HOUR = PY_MINUTE = PY_SECOND = y_centre ;
TM12864L-2_MEGA.DrawCircle (x,y  r+3,BLACK) ;

i have been reading and reading and reading trying to figure out what is wrong with the code. When i got the kit the lcd was hooked up and displaying the big demo sketch. Unfortunately, not knowing what i was doing, i unplugged all the wires, hooked up a single led and started playing with the "blink" sketch without saving the sketch that was pre-loaded and running the lcd. So if anyone has any insight as to what i need to do to get something on this lcd other than a screen full of solid pixels, PLEASE help me. : )

~ Dan9287
« Last Edit: April 27, 2011, 04:14:03 pm by Dan9287 » Logged

...but they are ALL blue wires!!!!!

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

BUMP!!! need help please!!!!
Logged

...but they are ALL blue wires!!!!!

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2738
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A digital camera can be your best friend.  smiley-grin
I often use a digital camera to take photos of how things are assembled before I take
them apart so I can refer back to it.
(might not work too well if all the wires were the same color though..)

First question I have, is where did you get the glcd library software?
Did it come with the glcd module?

The lines you show are very similar to 3 lines that are in the glcd v3 library
in the file glcd/examples/GLCD_BigDemo/AnalogClock.cpp

However, the 3rd line in the glcd v3 library is
GLCD.DrawCircle (x,y  r+3,BLACK) ;

Did you by chance accidentally modify this line or did the glcd module come
with its own software?

And what pin-out tables were you using or did you try?
Because wiring up the glcd incorrectly can damage the glcd.

Are you absolutely sure you have a TM12864L-2 ?
Is it labeled on the back of the glcd?
I can't help much until I know exactly what glcd module you have.
If it is that module or another ks0108 module,  I can help you get it up and working
with the latest glcd v3 library software.

But in the mean time, don't run or play with the arduino board with the glcd attached/plugged-in
because incorrect wiring can fry the glcd.

And if possible, tell me how you hooked everything up,
all 20 pins including how you hooked up the 3 wires on the contrast pot and
if/how you hooked up the current limiting resistor for the backlight.


There was some discussion about this same or similar glcd a bit earlier:
http://arduino.cc/forum/index.php?topic=54881.0

The OP never came back in that thread, so it is unknown if he ever got his display working.

The latest glcd v3 software can be found here:
http://code.google.com/p/glcd-arduino/downloads/list

Best thing is just report back here, and I'll be happy to help you get the wiring
straightened out.


--- bill


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I bought an ATMEGA1280 with a TM12864L-2 (128x64 glcd)...glcd example work, but i can't write anything...I'm new please help me...I would like to use it for acquarium and i need to see temperature, ph....
This is my program to check temperature and I would like to see temperature on my glcd

#include <OneWire.h>
 
// DS18S20 Temperature chip i/o
OneWire ds(10);  // on pin 10
 
void setup(void) {
  // initialize inputs/outputs
  // start serial port
  Serial.begin(9600);
}
 
int HighByte, LowByte, TReading, SignBit, Tc_100, Whole, Fract;
 
void loop(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
 
  if ( !ds.search(addr)) {
//      Serial.print("No more addresses.\n");
      ds.reset_search();
      return;
  }
 
//  Serial.print("R=");
//  for( i = 0; i < 8; i++) {
//    Serial.print(addr, HEX);
//    Serial.print(" ");
//  }
 
//  if ( OneWire::crc8( addr, 7) != addr[7]) {
//      Serial.print("CRC is not valid!\n");
//      return;
//  }
 
//  if ( addr[0] == 0x10) {
//      Serial.print("Device is a DS18S20 family device.\n");
//  }
//  else if ( addr[0] == 0x28) {
//      Serial.print("Device is a DS18B20 family device.\n");
//  }
//  else {
//      Serial.print("Device family is not recognized: 0x");
//      Serial.println(addr[0],HEX);
//      return;
//  }
 
  ds.reset();
  ds.select(addr);
  ds.write(0x44,1);         // start conversion, with parasite power on at the end
 
  delay(1000);     // maybe 750ms is enough, maybe not
  // we might do a ds.depower() here, but the reset will take care of it.
 
  present = ds.reset();
  ds.select(addr);   
  ds.write(0xBE);         // Read Scratchpad
 
//  Serial.print("P=");
//  Serial.print(present,HEX);
//  Serial.print(" ");
  for ( i = 0; i < 9; i++) {           // we need 9 bytes
    data = ds.read();
//    Serial.print(data, HEX);
//    Serial.print(" ");
  }
//  Serial.print(" CRC=");
//  Serial.print( OneWire::crc8( data, smiley-cool, HEX);
//  Serial.println();
 
  LowByte = data[0];
  HighByte = data[1];
  TReading = (HighByte << smiley-cool + LowByte;
  SignBit = TReading & 0x8000;  // test most sig bit
  if (SignBit) // negative
  {
    TReading = (TReading ^ 0xffff) + 1; // 2's comp
  }
  Tc_100 = (6 * TReading) + TReading / 4;    // multiply by (100 * 0.0625) or 6.25

  Whole = Tc_100 / 100;  // separate off the whole and fractional portions
  Fract = Tc_100 % 100;


  if (SignBit) // If its negative
  {
     Serial.print("-");
  }
  Serial.print(Whole);
  Serial.print(".");
  if (Fract < 10)
  {
     Serial.print("0");
  }
  Serial.print(Fract);

  Serial.print("\n");
}

Please help me...... smiley-sad
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2738
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is quite a bit of information about using the glcd library in the included documentation
down in the glcd/doc directory of the library.
Click on glcd/doc/GLCDref.htm to bring it up in your browser.
While a bit daunting at first, it is actually pretty easy to output simple text to the display.
Many of the text api calls are very similar to the liquidcrystal API functions.

Attached is a very simple hello world sketch that I'll include in the next version of the API
to show a minimal example of how to print something on the display.

BTW, it would be better to start your own thread for asking your questions
since your questions seem to be a bit different than the original topic.

--- bill

* HelloWorld.pde (0.77 KB - downloaded 11 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks bill for your answer....I'm new in programming and I don't know anything....but I'm also determinate to understand....I started to study c 3 weeks ago and I followed tutorial. To day I found this:
Quote
  #include <ks0108.h>  // library header
  #include <Arial14.h>  // font definition for 14 point Arial font.
  #include "SystemFont5x7.h"   // system font
  #include "ArduinoIcon.h"     // bitmap 
 
void setup(){
  GLCD.Init(NON_INVERTED);   // initialise the library
  GLCD.ClearScreen(); 
   GLCD.SelectFont(System5x7);       // select fixed width system font
}
void loop(){ // run over and over again
 
  GLCD.ClearScreen();               // clear the screen 
  GLCD.CursorTo(5,2);              // positon cursor 
  GLCD.Puts("Hello World");               // print a text string 
 
 }

It works....Now I'm working with temperature sensor, but it's very hard. I can see temperature value on serial monitor, but i would like to use glcd.
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2738
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

andy,
I see you are using the older v2 version of the library.
(that example was for the older v2 library)

Go get the newer v3 version of the library.
You can get it here:
http://code.google.com/p/glcd-arduino/downloads/list
Get the RC2 version. Currently, it is the most recent version that I've posted.
This link is also on the ks0108 playground but is not quite so obvious.
v3 is backward compatible with v2, much faster and adds many new features,
several examples, and lots of documentation as well.

the glcd v3 library supports the full Print class so you can print to the glcd using
glcd.print() just like you can on the serial port.

BTW, if you want some full featured, easy to use Temperature stuff that supports
multiple sensors, consider using the Dallas temperature library:
http://www.milesburton.com/Dallas_Temperature_Control_Library

--- bill
Logged

Portugal
Offline Offline
Edison Member
*
Karma: 37
Posts: 1593
Pretending you know everything then you will learn nothing.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Like last post says just use this
Code:
GLCD.ClearScreen();               // clear the screen
  GLCD.CursorTo(5,2);              // positon cursor
  GLCD.Puts(temp_variable);               // print the variable value on lcd
Code:
Logged

Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B


Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2738
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Like last post says just use this
Code:
GLCD.ClearScreen();               // clear the screen
  GLCD.CursorTo(5,2);              // positon cursor
  GLCD.Puts(temp_variable);               // print the variable value on lcd

This is incorrect.
The Puts() function is only for simple null terminated stings.
You cannot use it to print a numeric variable.
For simple output I recommend using the Print class so you would use
GLCD.print() to print your information. The Print class automatically determines
the data type and knows how to print it.

So to get the information on the glcd instead of the serial port you simply replace
Serial.print() with GLCD.print(). You could even leave in both if you want to
see in both places while you debug things.
By default the glcd library will treat the glcd display like a mini terminal.
i.e. it will wrap lines and scroll the display when the display fills.

Do make sure you upgrade your library to the v3 version as v2 does
not have all these capabilities.

But please for further help, start a new thread.

--- bill
« Last Edit: September 14, 2011, 11:39:00 pm by bperrybap » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Bill
thanks for your answer and  sorry for my late answer but I was very busy....I'll try to follow your instructions...I also find a post about GLCD and dallas sensor....I will study it
Logged

Pages: [1]   Go Up
Jump to: