Вот так, например, можно:
Код
#ifndef _HD44780_H_
#define _HD44780_H_
#define RS PORTB_Bit7 // RC4 is RS line of LCD
#define E PORTB_Bit6 // RC5 is E line of LCD
#define LCD_DATA PORTD // RB0-RB3 are D4-D7 of LCD
#define DISP_ON 0x00C // Display on
#define CLR_DISP 0x001 // Clear the Display (команда требует задержки на 5 mS)
#define ENTRY_INC 0x006 //
#define LINE1 0x080 // Начало первой линии
#define LINE2 0x0C0 // Начало второй линии
#define CGRAM 0x040 // CGRAM (0-ой переопределяемый символ)
void send_ins(char data);
void send_char(char data);
void init_LCD(void);
int putchar(int data);
#endif //_HD44780_H_
Код
#include <ioavr.h>
#include <ina90.h>
#include "delay.h"
#include "HD44780.h"
//**************************************************************************
// Send the nibble of 'data' out to the LCD *
//**************************************************************************
void nybble_out(char data)
{
LCD_DATA = (data & 0x0F) | (LCD_DATA & 0xF0);
E = 1;
_NOP();
E = 0;
delay_us(250); // Задержка 250 uS
}
//**************************************************************************
// Send an instruction out to the LCD *
//**************************************************************************
void send_ins(char data)
{
RS = 0;
_NOP();
nybble_out(data >> 4);
nybble_out(data);
}
//**************************************************************************
// Send the character out to the LCD *
//**************************************************************************
void send_char(char data)
//int putchar(int data)
{
RS = 1;
_NOP();
nybble_out(data >> 4);
nybble_out(data);
}
//**************************************************************************
// Initialize the LCD *
//**************************************************************************
void init_LCD(void)
{
delay_ms(40); // Задержка 40 mS
RS = 0;
nybble_out(0x03);
delay_ms(5); // Задержка 5 mS
nybble_out(0x02);
delay_us(250); // Задержка 250 uS
send_ins(0x28); // 4 bit, 2 Line, 5x7 font
send_ins(0x10); // display shift off
send_ins(CLR_DISP); // Clear the Display RAM
delay_ms(5); // Задержка 5 mS
send_ins(ENTRY_INC); // increment cursor
send_ins(0x0C); // display on cursor off
send_ins(LINE1);
}
int putchar(int data)
{
send_char((unsigned char)data);
return data;
}
А потом printf'ами, printf'ами ...