4x16 lcd routine in assembler

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

i need an routine in assembler to initialize and put out some words on a 4x16 lcd which is hd44780 compatible.
i've got an stk500 and i d'like to try this with a at90s2313 and a at90s8515.
maybe anyone has allready tried this in own projects!
please help me!

admin's test signature
 

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

This is how I initialized and wrote big messages to the screens. I had to put an .org instruction in front of each message in order to make the labels point to the right place. Good Luck.

admin's test signature
 

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

Oliver,

The trick is to remember the display order.
In *MOST* cases with the 44780 controller the first and thrid lines are the same line, as are the second and fourth, for example say you send the alphabet to the first line;-

ABCDEFGHIJKLMNOPQRSTUVWXYZ

What you will see is;-

ABCDEFGHIJKLMNOP
(second line)
QRSTUVWXYZ
(fourth line)

another trick is to have predefined positions for things ;-
.EQU setline0 =0B10000000
.EQU setline1=0B11000000
.EQU setline1pos1 =0B11000001
.EQU setline1pos2 =0B11000010
.EQU setline2 =0B10010100
.EQU setline3 =0B11010100

For a code example take a look here ;-
http://www.wavesynth.com/modulus...
Theres the whole pile of LCD functions there (look at MIDI DISPLAY) it works with an STK200 and 4 line LCD, I cant see there would be any difference in the wireing of the LCD connector in the STK500

Have fun

Paul Maddox

http://www.wavesynth.com/

admin's test signature
 

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

To me it is not that the code is wrong, its not that the wiring is wrong, its that the code and the wiring are not using the same pins. So...

What The AVR LCD World needs is a standard on how the LCD display is connected to the AVR.

Assuming almost everyone is using an STKx00...
The STK300 comes with its own LCD connector arrangement. (I have one of these) But when I was using it with an LCD I used a 4 pin interface, not the memory mapped pins on the STK300.

The STK500 does not have a dedicated LCD connector but using CodeVision's spelling out what pins of PORTC go to what pins of an LCD display... I set mine up that way, trying to go with somewhat of a standard. Pavel also uses a 4 pin data interface through PORTC so all control of the LCD can be done with a single port. I/O pins are precious.

CodeVision LCD interface
1 GND- 9 GND
2 +5V- 10 VCC
3 VLC- LCD HEADER Vo
4 RS - 1 PC0
5 RD - 2 PC1
6 EN - 3 PC2
11 D4 - 5 PC4
12 D5 - 6 PC5
13 D6 - 7 PC6
14 D7 - 8 PC7

So what I am starting to use as a standard is the listing above. It is a big world and enough room for more than one standard. A 4 pin and an 8 pin standard. Or may be an ImageCraft 4 pin and a CodeVision 4 pin and a xxx 4 pin. Just like there is an Hitachi LCD standard... Can you imagine using an LCD with the Hitachi standard? Know of anyone that uses such an animal? That person must like to suffer.

Mike

admin's test signature
 

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

There is no need for such a standard. All you had to do is to make a headerfile there you make some defines of the connections. Like #define LCD_PORT PORTC, #define LCD_RS BIT1. Just use the defined names in your code and you end up with a routine that you can easily change to whatever hardware you have. I write all my drivers using that method. No need for changes in the code, just the headerfile.

/Bengt