времянки по RCALL не привожу.
кусок схемы - от тини2313
;######################
; init LCD
rcall LCD_INIT ;Display initialisieren
rcall LCD_CLEAR ;clear LCD
rcall REDEFINE_CHARS
rcall LCD_JMP1STLINE
;#################################################
;# LCD_INIT (start)
LCD_INIT:
ldi temp3,50
powerupwait:
rcall delay5ms
dec temp3
brne powerupwait
ldi temp1, 0b00110000 ;muss 3mal hintereinander gesendet
out PORTB, temp1 ;werden zur Initialisierung
rcall LCD_ENABLE ;1
rcall delay5ms
rcall LCD_ENABLE ;2
rcall delay5ms
rcall LCD_ENABLE ;und 3!
rcall delay5ms
ldi temp1, 0b00100000 ;4bit-Modus einstellen
out PORTB, temp1
rcall LCD_ENABLE
rcall delay5ms
ldi temp1, 0b00100000 ; Function set
out PORTB, temp1 ; DB7,DB6 are clr
rcall LCD_ENABLE ; DB5=1 allways
rcall delay5ms
ldi temp1, 0b10000000 ; DB4:1=8-bit interface data
out PORTB, temp1 ; DB3:0=single-line display
rcall LCD_ENABLE ; DB2:0=5x8 character font
rcall delay5ms
ldi temp1, 0b00000000 ; Display and cursor control
out PORTB, temp1 ; DB7..DB4 are clr
rcall LCD_ENABLE ; DB3=1 allways
rcall delay5ms
ldi temp1, 0b11000000 ; DB2:1=display ON
out PORTB, temp1 ; DB1:1=cursor ON
rcall LCD_ENABLE ; DB0:1=cursor position blinking
rcall delay5ms
ret
;# LCD_INIT (end)
;#################################################
;#################################################
; LCD_CLEAR (start)
LCD_CLEAR:
;# 0b00000001
ldi temp1, 0b00000000 ; clear display
out PORTB, temp1 ; clear display
rcall LCD_ENABLE ; clear display
rcall delay5ms
ldi temp1, 0b00010000 ; clear display
out PORTB, temp1 ; clear display
rcall LCD_ENABLE ; clear display
rcall delay5ms
ret
; (end)
;#################################################
;#################################################
; LCD_JMP1STLINE (start)
LCD_JMP1STLINE:
;#0b10000000
ldi temp1, 0b10000000 ; set DD RAM address to the first
out PORTB, temp1 ; position of the _first_ line
rcall LCD_ENABLE ; DB7=1 always
rcall delay5ms
ldi temp1, 0b00000000 ; DDRAM adress for first line
out PORTB, temp1 ; is always d01.
rcall LCD_ENABLE ; also: b10000000
rcall delay5ms
ret
; LCD_JMP1STLINE (end)
;#################################################
;#################################################
; LCD_ENABLE (start)
LCD_ENABLE:
sbi PORTB,3
rcall delay50us
cbi PORTB,3
ret
; LCD_ENABLE (end)
;#################################################