From: hackbard Date: Sun, 14 Nov 2004 04:16:53 +0000 (+0000) Subject: added rgb_mali asm code X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=a60a7ce4e8364077700c3b9a9c954ed1082b7639;p=my-code%2Fatmel.git added rgb_mali asm code --- diff --git a/beginners/rgb_mali.asm b/beginners/rgb_mali.asm new file mode 100644 index 0000000..fc89777 --- /dev/null +++ b/beginners/rgb_mali.asm @@ -0,0 +1,179 @@ +; rgb_mali.asm +; +; 3 leds (red, green, blue) on different ports. +; cm mode: continuous mixed colors +; rgb mode: keep one special color +; +; modes switchable by uart +; +; author: hackbard@hackdaworld.dyndns.org + + +.include "../include/2313def.inc" + +; defines & equals +.def zero = r0 +.def one = r1 +.def tmp = r16 +.def uart_count = r17 +.def count = r18 +.def R = r19 +.def G = r20 +.def B = r21 +.def mode r22 +.equ cm 0 +.equ rgb 1 +.def OUTR = r23 +.def FULLR = r24 +.equ LED_R PD2 +.equ LED_G PD3 +.equ LED_B PD4 +.equ LED_PORT PORTD + +; +; interrupt voctors +; +; reset +rjmp INIT +; int0 +reti +; int1 +reti +; timer/counter capt 1 +reti +; timer/counter compare +reti +; timer/counter overflow 1 +reti +; timer/counter overflow 0 +reti +; uart rx complete +rjmp UART_RECEIVE +; uart data register empty +reti +; uart tx complete +reti +; analog comparator +reti + +; +; init routine +; +INIT: +; alloc stack pointer +ldi r16,low(RAMEND) +out SPL,r16 +; enable uart + rx complete interrupt +ldi tmp,51 ; 9600 baud, 0,2% error @ 8mhz +out UBRR,tmp +ldi tmp,((1<