From 53d316267896aecc52934e3592227cbca9802bbb Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Sat, 15 Jan 2011 23:54:52 +0100 Subject: [PATCH] lcd/progs: progamm ein wenig verbessert :) --- progs/lcd.s | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/progs/lcd.s b/progs/lcd.s index 6c7dbb9..84e59d2 100644 --- a/progs/lcd.s +++ b/progs/lcd.s @@ -24,21 +24,38 @@ main: call lcd_home ldis r1, 0x44 ; 'D' call u_send_byte - - call delay5ms ; print 'E' on LCD and UART - ldis r1, 0x45 ; 'E' - push r1 - call lcd_data - pop r1 - call+ u_send_byte call+ u_send_newline + ldis r0, 0x00 ; init line var (we begin at line 0 ofc) + push r0 + loop: call+ u_recv_byte ; print received Char on LCD + cmpi r0, 0x0d ; change line on '\r' + breq l_nl addi r1, r0, 0 call+ lcd_data br loop +l_nl: + pop r1 + cmpi r1, 0 + brnq l_ln1 +l_ln0: + ldis r1, 1 + push r1 + ldis r1, 0xc0 ; jump to second line + call+ lcd_command + call delay5ms + br+ loop + +l_ln1: + ldis r1, 0 + push r1 + ldis r1, 0x80 ; jump to first line + call+ lcd_command + br+ loop + hang: br+ hang .define LCD_BASE, 0x2050 @@ -132,11 +149,12 @@ powerupwait: call+ lcd_enable call+ delay5ms - ldis r1, 0x24 + ; ldis r1, 0x24 + ldis r1, 0x2c ; 4bit interface, 2/4zeiliges display, 5x10 font call+ lcd_command - ldis r1, 0xc + ldis r1, 0xf ; display an, cursor an, cursor blinkt call+ lcd_command - ldis r1, 0x4 + ldis r1, 0x4 ; display fest call+ lcd_command ret -- 2.25.1