...und das LCD

;; also was ist zu tun

.include "m8def.inc"

ldi r16, HIGH (RAMEND)
out SPH, r16
ldi r16, LOW (RAMEND)
out SPL, r16

ldi r16, 0xff
out DDRD, r16

rcall lcd_init

ldi r16, 'H'
rcall send_data
ldi r16, 'a'
rcall send_data
ldi r16, 'l'
rcall send_data
ldi r16, 'l'
rcall send_data
ldi r16, 'o'
rcall send_data
ldi r16, '!'
rcall send_data

end: rjmp end

;; jetzt nibble senden:

send_enable:
sbi PORTD, 5
nop
nop
nop
cbi PORTD, 5
ret

send_cmd:
mov r17, r16
swap r16
andi r16, 0b00001111
out PORTD, r16
rcall send_enable
andi r17, 0b00001111
out PORTD, r17
rcall send_enable
rcall sleep
ret

send_data:
mov r17, r16
swap r16
andi r16, 0x0f
ori r16, 0b00010000
out PORTD, r16
rcall send_enable
andi r17, 0x0f
ori r17, 0b00010000
out PORTD, r17
rcall send_enable
rcall sleep
ret

sleep:
push r17
ldi r17, 0xff
sleep_loop1:
dec r17
brne sleep_loop1
pop r17
ret

lcd_init:
rcall sleep
ldi r16, 0x03
out PORTD, r16
rcall send_enable
rcall sleep
ldi r16, 0x03
out PORTD, r16
rcall send_enable
rcall sleep
ldi r16, 0x03
out PORTD, r16
rcall send_enable
rcall sleep
ldi r16, 0x02
rcall send_cmd
ldi r16, 0x20
rcall send_cmd
ret
Image IMG_5136

Image IMG_5137

;; also was ist zu tun

.include "m8def.inc"

ldi r16, HIGH (RAMEND)
out SPH, r16
ldi r16, LOW (RAMEND)
out SPL, r16

ldi r16, 0xff
out DDRD, r16

rcall lcd_init


ldi r16, 0x01
rcall send_cmd
ldi r16, 0x02
rcall send_cmd
ldi r16, 'H'
rcall send_data
ldi r16, 'a'
rcall send_data
ldi r16, 'l'
rcall send_data
ldi r16, 'l'
rcall send_data
ldi r16, 'o'
rcall send_data
ldi r16, '!'
rcall send_data

end: rjmp end

;; jetzt nibble senden:

send_enable:
sbi PORTD, 5
nop
nop
nop
cbi PORTD, 5
ret

send_cmd:
mov r17, r16
swap r16
andi r16, 0b00001111
out PORTD, r16
rcall send_enable
andi r17, 0b00001111
out PORTD, r17
rcall send_enable
rcall sleep
ret

send_data:
mov r17, r16
swap r16
andi r16, 0x0f
ori r16, 0b00010000
out PORTD, r16
rcall send_enable
andi r17, 0x0f
ori r17, 0b00010000
out PORTD, r17
rcall send_enable
rcall sleep
ret

sleep:
push r17
ldi r17, 0xff
sleep_loop1:
dec r17
brne sleep_loop1
pop r17
ret

lcd_init:
rcall sleep
ldi r16, 0x03
out PORTD, r16
rcall send_enable
rcall sleep
ldi r16, 0x03
out PORTD, r16
rcall send_enable
rcall sleep
ldi r16, 0x03
out PORTD, r16
rcall send_enable
rcall sleep
ldi r16, 0x02
rcall send_cmd
ldi r16, 0x20
rcall send_cmd
ret

Image IMG_5138

Image IMG_5139

Image IMG_5140