]> hackdaworld.org Git - my-code/atmel.git/commitdiff
test_uart: -> 8mhz 9600 bps. rgb_mali: added rgb mode (not working .. but why?)
authorhackbard <hackbard>
Thu, 18 Nov 2004 03:04:29 +0000 (03:04 +0000)
committerhackbard <hackbard>
Thu, 18 Nov 2004 03:04:29 +0000 (03:04 +0000)
beginners/rgb_mali.asm
beginners/test_uart.asm

index 3cdbda3afb07b73f6d73c67c123517e7cbcae2cd..8b26baf21807403e2a1ece070ad5ad60cd826fcf 100644 (file)
@@ -83,7 +83,7 @@ out TIMSK,tmp
 ; enable uart + rx complete interrupt
 ldi tmp,51 ; 9600 baud, 0,2% error @ 8mhz
 out UBRR,tmp
-ldi tmp,((1<<RXCIE)|(1<<RXEN))
+ldi tmp,((1<<RXCIE)|(1<<RXEN)|(1<<TXEN))
 out UCR,tmp
 ; init registers
 ldi tmp,1
@@ -114,6 +114,11 @@ cpi mode,cm
 breq CM_ACTION
 reti
 
+;
+; specify action
+;
+
+
 ;
 ; continuous mode action
 ;
@@ -292,5 +297,72 @@ rjmp LOOP
 ; receive from uart
 ;
 UART_RECEIVE:
+cp uart_count,zero
+breq GET_MODE
+cpi uart_count,1
+breq GET_R_VALUE
+cpi uart_count,2
+breq GET_G_VALUE
+cpi uart_count,3
+breq GET_B_VALUE
+
+;
+; get mode
+;
+GET_MODE:
+in tmp,UDR
+cpi tmp,0x63 ; 0x63 = 'c'
+breq SET_CONTINUOUS_MODE
+cpi tmp,0x73 ; 0x73 = 's'
+breq SET_SPECIFY_MODE
+ldi uart_count,0
+reti
+
+;
+; set cmode
+;
+SET_CONTINUOUS_MODE:
+ldi mode,cm
+ldi uart_count,0
+reti
+
+;
+; set specify mode
+;
+SET_SPECIFY_MODE:
+ldi mode,rgb
+add uart_count,one
+; check
+out UDR,mode
+reti
+
+;
+; get red value
+;
+GET_R_VALUE:
+in RED,UDR
+add uart_count,one
+; check
+out UDR,RED
+reti
+
+;
+; get green value
+;
+GET_G_VALUE:
+in GREEN,UDR
+add uart_count,one
+; check
+out UDR,GREEN
+reti
+
+;
+; get blue value
+;
+GET_B_VALUE:
+in BLUE,UDR
+mov uart_count,zero
+; check
+out UDR,BLUE
 reti
 
index 815f1092f1eef02c592a5b0c2bba34a20b9de6b9..6ec9b5602d99b98ec78b0bf02bd1e459b8735097 100644 (file)
@@ -2,7 +2,7 @@
 .include "../include/2313def.inc"
 
 ; baudrate einstellen
-ldi r16, 11 ; "38400 bps wert" in r16
+ldi r16, 51 ; "9600 bps @ 8mhz" in r16
 out UBRR, r16 ; write to uart baudrate register
 sbi UCR, TXEN ; enable tx at uart control register