projects
/
my-code
/
atmel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
82117e0
)
test_uart: -> 8mhz 9600 bps. rgb_mali: added rgb mode (not working .. but why?)
author
hackbard
<hackbard>
Thu, 18 Nov 2004 03:04:29 +0000
(
03:04
+0000)
committer
hackbard
<hackbard>
Thu, 18 Nov 2004 03:04:29 +0000
(
03:04
+0000)
beginners/rgb_mali.asm
patch
|
blob
|
history
beginners/test_uart.asm
patch
|
blob
|
history
diff --git
a/beginners/rgb_mali.asm
b/beginners/rgb_mali.asm
index
3cdbda3
..
8b26baf
100644
(file)
--- a/
beginners/rgb_mali.asm
+++ b/
beginners/rgb_mali.asm
@@
-83,7
+83,7
@@
out TIMSK,tmp
; enable uart + rx complete interrupt
ldi tmp,51 ; 9600 baud, 0,2% error @ 8mhz
out UBRR,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
out UCR,tmp
; init registers
ldi tmp,1
@@
-114,6
+114,11
@@
cpi mode,cm
breq CM_ACTION
reti
breq CM_ACTION
reti
+;
+; specify action
+;
+
+
;
; continuous mode action
;
;
; continuous mode action
;
@@
-292,5
+297,72
@@
rjmp LOOP
; receive from uart
;
UART_RECEIVE:
; 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
reti
diff --git
a/beginners/test_uart.asm
b/beginners/test_uart.asm
index
815f109
..
6ec9b56
100644
(file)
--- a/
beginners/test_uart.asm
+++ b/
beginners/test_uart.asm
@@
-2,7
+2,7
@@
.include "../include/2313def.inc"
; baudrate einstellen
.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
out UBRR, r16 ; write to uart baudrate register
sbi UCR, TXEN ; enable tx at uart control register