Need help, STK500/525 and Char LCD

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok so take 2, with getting help for this project.

So I am trying to drive a char lcd using a AT90USB1287, on a STK525 mounted on an STK500.

At this point I have figured out that my D/I line is being loaded down so the LCD never sees it go high. So this being the case I can initalize the lcd (get a cursor etc) but once I need to write the above happens. I disconnected the LCD and it still happens.

I initialize the Port using:

//Controls (E, RS, R/W) 
#define DDRD_Setup     0b11111111    
#define PORTD_Setup    0b00000000 

#define R_W 2 //assigned to port d pins 1-3 //bgr-012-rs/rw/e
#define E   1
#define D_I 0

Then init

DDRD  = DDRD_Setup;
PORTD = PORTD_Setup;

Then in the write portion

void write(char i)
{
PORTA = i; //put data on output Port
PORTD |= (1<<D_I);
PORTD &= (0<<R_W);
PORTD |= (1<<E);
_delay_ms(100); //enable pulse width >= 300ns
PORTD &= (0<<E);
_delay_ms(10);
}

Does anyone know if I missed a fuse or accidentally turn it on or something like that might be the issue?

Also if you want the full code just ask.

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The _delay_ms() in there suggest this is avr-gcc. You do know it comes with tried/tested LCD code don't you:

http://www.nongnu.org/avr-libc/u...

and if you want more configurability over which PORT/bits to use then use Petere Fleury's widely respected code:

http://homepage.hispeed.ch/peter...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't think the code is directly the problem, after further probing I figured out its actually that pin doesn't stay high.

Using my scope I figured out that DI is only staying high for about 2us. I don't know why since the code sets it but doesn't clear it until it sets the cursor to line 2.

I would really like to know why rather than just plug in someone else's code.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I would really like to know why rather than just plug in someone else's code.
How do you think ANYBODY can help when you've given almost nothing ?!

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

indianajones11 wrote:
Quote:
I would really like to know why rather than just plug in someone else's code.
How do you think ANYBODY can help when you've given almost nothing ?!

First of all I have given as much as I thought was necessary. If it wasn't enough I invited people to ask for more if they had an idea of where to go.

That being said no need for help I figured it out on my own. I accidentally wrote my bit clears wrong.

I had

PORTD &= (0<<D_I);

when I should have used

PORTD &= ~(1<<D_I);

and so I was effecting all of the other bits on the port.

Thanks clawson You are always willing to help I really appreciate it.