AVR Assembler-Code for HD44780 Displays

Description

The following assembler code is from some another project. The parameters of the procedures are passed through the registers RP0, RP1 and RP2, the return value is located in the register RRet after the call. These register names have to be defined before the code can be used. To use this code the file inttimer16.asm is also required. It contains two delay-routines that are able put the processor into sleep mode to save power.

The code consists of the following routines and macros:

disp_instruction and disp_data: (macro) Puts the display into data or instruction mode.

disp_put_byte: Writes a byte to the display. Example:

disp_data
ldi RP0, 'A'
rcall disp_put_byte
ldi RP0, 'B'
rcall disp_put_byte

disp_read_byte: Reads a byte from the display

disp_reset: Resets the display to default values. The contents of the display are erased and the cursor is moved to the position of the first character.

disp_write_string: Writes a null-terminated string out of program memory to the display. Example:

CSEG: 
string_hello_world: 
.db 'H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!', 0 

ldi RP0, LOW( 2 * string_hello_world ) 
ldi RP1, HIGH( 2 * string_hello_world ) 
rcall disp_write_string

Download

avr_hd44780.zip

LinkedIn logo mail logo