HD44780 assembly driver
Assembly driver for HD44780 LCD works in 4-bit mode without read of status register. This code can be use with any AVR device.


I/O definitions
Before use this driver, You must defined connections between MCU and LCD. Example definitions are shown below:

.equ LCD_DDR   = DDRB
.equ LCD_PIN   = PINB

.equ LCD_D4    = 0
.equ LCD_D5    = 1
.equ LCD_D6    = 2
.equ LCD_D7    = 3

.equ LCD_RS    = 4
.equ LCD_EN    = 6

Available routines
  LCD_Init - initialization of LCD
  LCD_WriteCommand - write to command register
  LCD_WriteData - write to data register
  LCD_WriteString - display string from program memory
  LCD_SetAddressDD - sets address in Display Data RAM
  LCD_SetAddressCG - sets address in Character Generator RAM

How to use HD44780 library
In file with entry code place include directive :

#include "hd44780.asm" ; AVR Assembler v.2 style

// or

.include "hd44780.asm" ; AVR Assembler v. 1 style

Example of use LCD_SetAddressDD routine:

  ldi   r16, 4
  rcall LCD_SetAddressDD ; Set address to fifth char in first row

Example of use LCD_WriteString routine:

  ldi   ZL, LOW(ConstText << 1)
  ldi   ZH, HIGH(ConstText << 1)
  rcall LCD_WriteString

Download source code of HD44780.asm file : HD44780.zip


(c) Radosław Kwiecień