.include "m8def.inc" ; Stack configuration ldi temp,high(RAMEND); Main program start out SPH,temp ; Set Stack Pointer to top of RAM ldi temp,low(RAMEND) out SPL,temp .equ lcd_port=PORTC .equ lcd_ddr=DDRC .equ lcd_rs=4 .equ lcd_e=5 ;.equ lcd_rw=>auf masse legen (nur schreiben) .def temp=r16 .def temp2=r17 .def temp3=r20 .def zeichen=r18 .def command=r19 main: ldi temp, (1<werte übernehmen*** lcd_enable: nop nop nop nop sbi lcd_port, lcd_e ; Enable high nop ; 8 Taktzyklen warten=1us nop nop nop nop nop nop nop cbi lcd_port, lcd_e ; Enable wieder low nop nop nop nop ret ;***Display löschen*** lcd_clear: ldi command, 0b00000001 ; Display löschen rcall lcd_send_command rcall wait_5ms rcall wait_5ms rcall wait_5ms ret ;***Cursor Homeposition*** lcd_homepos: ldi command, 0b00000010 ; Cursor Home rcall lcd_send_command rcall wait_5ms rcall wait_5ms rcall wait_5ms ret ;***50µs warten*** wait_50us: push temp ldi temp,195 loop50us: dec temp brne loop50us pop temp ret ;***5ms warten*** wait_5ms: push temp push temp2 ldi temp,0xFF ;low byte ldi temp2,52 ;high byte loop5ms: dec temp ;low byte brne loop5ms dec temp2 ;high byte brne loop5ms pop temp pop temp2 ret