Author Topic: LCD problem  (Read 3537 times)

0 Members and 1 Guest are viewing this topic.

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
LCD problem
« on: May 28, 2009, 04:26:20 PM »
I got a couple of used lm016l LCDs http://pdf1.alldatasheet.com/datasheet-pdf/view/146552/HITACHI/LM016L.html free at a robotics meeting. I tried hooking one of them up to my ATmega168 using the code and schematic from here  http://www.pocketmagic.net/?p=447 i modified the makefile for the ATmega168. All the "boxes" on the first line of the lcd light up but that's it. I tripled checked my connections so I'm assuming it's a programming problem.
Robots are awesome!

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: LCD problem
« Reply #1 on: May 28, 2009, 04:31:18 PM »
Arduino has a library for LCDs, you can look into the source code for info. Also you could just run the Arduino program in the mega168 just to test out the LCD.

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: LCD problem
« Reply #2 on: May 29, 2009, 07:03:50 AM »
Here's a picture of my lcd turned on. using this code:
Quote
//  ATMega8 LCD Driver
//
//  (C) 2009 Radu Motisan , [email protected]
//  www.pocketmagic.net
//  All rights reserved.
//
//  test.c: sample test for the HD44780 LCD functions
//  For more details visit the website.



#include "lcd.h"


int main()
{
   int i=0;
   lcd_init();
   
   while(1)
   {
      i = (i+1)%10;
      //lcd_clrscr();
      lcd_home();
   
      lcd_string2("Hello World! %d\npocketmagic.net",i);
   
      for (int i=0;i<10;i++) //some delay
         _auxDelay(1000000);

   }
   return 0;
}
Robots are awesome!

Offline awally88

  • Robot Overlord
  • ****
  • Posts: 212
  • Helpful? 0
Re: LCD problem
« Reply #3 on: May 31, 2009, 04:08:05 AM »
Are you sure its not the LCD? You got it for free... Did try both of the LCD's or just the one?

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: LCD problem
« Reply #4 on: May 31, 2009, 01:18:43 PM »
Yeah It probably is the LCD, as soon as I get the time I'll hook up the other one.
Robots are awesome!

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: LCD problem
« Reply #5 on: May 31, 2009, 01:19:53 PM »
Does the contrast pot adjust the contrast?

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: LCD problem
« Reply #6 on: June 01, 2009, 07:52:09 PM »
yes, the pot adjusts contrast.
Robots are awesome!

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: LCD problem
« Reply #7 on: June 08, 2009, 11:47:50 AM »
Finally got around to connecting the other LCD display, it does the same thing the first one did. I then disconnected everything but power and ground (and the pot), and it still did the same thing. If anyone with an HD44780 LCD screen they know works would test this guys library: http://www.pocketmagic.net/?p=447 (the one I'm using) that would be great!
Robots are awesome!

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
Re: LCD problem
« Reply #8 on: June 08, 2009, 02:21:17 PM »
I may be able to adapt the code to my atmega and see if my lcd woks.  If not I can probably give you a version of the code I'm using.  Are you using the exact same pin out that your link specifies?
« Last Edit: June 08, 2009, 02:29:57 PM by sonictj »

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: LCD problem
« Reply #9 on: June 08, 2009, 03:23:02 PM »
Yep, I'm using the exact same pin configuration that the link specifies. Thanks!
Robots are awesome!

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
Re: LCD problem
« Reply #10 on: June 08, 2009, 04:00:54 PM »
try this code

declare to initialize
LCD_init()

try writing a charter with LCD_write();

if this works I'll send you my print library for strings

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: LCD problem
« Reply #11 on: July 07, 2009, 11:28:33 AM »
I took a bit of a break from this to work on some other stuff. sonictj, this is the code I'm using with your library:
Quote
#include "at8LCD.h"

int main()
{
   LCD_init();
   LCD_write('A');
}
I get these errors when compiling:
LCD.c:5: undefined reference to `LCD_init'
LCD.c:6: undefined reference to `LCD_write'

I'm sure there is something really obvious that I'm doing wrong.   :D
Robots are awesome!

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
Re: LCD problem
« Reply #12 on: July 07, 2009, 11:40:12 AM »
well it shouldn't say LCD.c:5: undefined reference to `LCD_init'. this would mean you have a file LCD.c with the same function. The files I sent were at8LCD.c, and .h

I noticed one issue with my code where I put the wrong variable in write's function prototype. This shouldn't have cause the problem but here is the corrected library

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
Re: LCD problem
« Reply #13 on: July 07, 2009, 11:45:20 AM »
when you get the message undefined refference to some function, this typically means you wrote a function in a .c file, which is recognozed, but the header file doesn't correlate.  Example you forget the function prototype, or you don't link your .c file to the appropriate header file.

You can send me your project folder and I can see if I can get it to compile.

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: LCD problem
« Reply #14 on: July 07, 2009, 12:26:16 PM »
Quote
well it shouldn't say LCD.c:5: undefined reference to `LCD_init'. this would mean you have a file LCD.c with the same function. The files I sent were at8LCD.c, and .h
LCD.c is the file containing this program:
Code: [Select]
#include "at8LCD.h"

int main()
{
   LCD_init();
   LCD_write('A');
}
Robots are awesome!

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
Re: LCD problem
« Reply #15 on: July 07, 2009, 01:06:26 PM »
I don't know if I can help unless I see your project if you can zip it up and attach it I can probably find whats wrong and let you know asap.

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: LCD problem
« Reply #16 on: July 07, 2009, 01:34:05 PM »
Here it is. I realise that there are a bunch of files I don't need.
Robots are awesome!

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
Re: LCD problem
« Reply #17 on: July 07, 2009, 02:36:00 PM »
well I found an error on my part I used LCD.h for the reference to the header file at8LCD ;D, but that didn't fix the problem.  I noticed you were using your own makefile, so for the hell of it I usde the gcc self generating one and everything worked.  I also change main to

Code: [Select]
#include "at8LCD.h"
int main()
{
   while(1){
LCD_init();
LCD_write('A');
}
return 0 ;
}

before your code was reaching the end of main which should never happen.  Here is the corrected version.  Just go into configuration options generate to makefile for your specific device/ settings, and compile.  That should do it.

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: LCD problem
« Reply #18 on: July 07, 2009, 04:24:58 PM »
Thanks, that compiled! I'll get back to you on whether it works or not.
Robots are awesome!

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: LCD problem
« Reply #19 on: July 07, 2009, 05:43:40 PM »
hmmm... still doesn't work.
Robots are awesome!

Offline radhoo

  • Full Member
  • ***
  • Posts: 66
  • Helpful? 1
Re: LCD problem
« Reply #20 on: October 13, 2009, 04:17:33 PM »
A bit late, but is there anything I can do to help?

Cheers,
Radu M.

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: LCD problem
« Reply #21 on: October 14, 2009, 12:14:35 PM »
Turned out it was just a couple of bad LCDs, I got a new one and it works fine.  :-[ Thanks anyway.
Robots are awesome!

Offline radhoo

  • Full Member
  • ***
  • Posts: 66
  • Helpful? 1
Re: LCD problem
« Reply #22 on: October 16, 2009, 03:48:06 PM »
I see. If you're still using my code you might want to get the latest version. It's in the same blog post.

Cheers!

 


Get Your Ad Here