lcd/progs: progamm ein wenig verbessert :)
authorBernhard Urban <lewurm@gmail.com>
Sat, 15 Jan 2011 22:54:52 +0000 (23:54 +0100)
committerBernhard Urban <lewurm@gmail.com>
Sat, 15 Jan 2011 22:54:52 +0000 (23:54 +0100)
progs/lcd.s

index 6c7dbb97acc0620fb13761aeb0867b123b99b474..84e59d2eb746874c2b89f562055b1344dba440b1 100644 (file)
@@ -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