]> hackdaworld.org Git - my-code/atmel.git/commitdiff
all leds on (multiplexed!)
authorhackbard <hackbard@hackdaworld.org>
Sun, 31 May 2009 05:40:07 +0000 (07:40 +0200)
committerhackbard <hackbard@hackdaworld.org>
Sun, 31 May 2009 05:40:07 +0000 (07:40 +0200)
led_plex/main.asm
led_plex/timer.asm

index 23b33c37deec5bcf948d3b2eb1bc084bd8926050..8a03d53ee219358e90b4fac8de1d3f69ba3a2a68 100644 (file)
@@ -86,8 +86,11 @@ INIT:
        ; gio port init
        rcall PORT_INIT
 
-       ; timer init
-       ;rcall TIMER_INIT
+       ; timer0 init
+       rcall TIMER0_INIT
+
+       ; timer0 interrupt enable
+       rcall TIMER0_INT_INIT
 
        ; uart init
        rcall UART_INIT
@@ -100,18 +103,16 @@ INIT:
        out SPL,tmp1
 
        ; global interrupt enable
-       ;sei 
+       sei 
 
        ; signal ready output
        ldi uart_rxtx,0x68
        rcall UART_TX
 
-       ; testing ... DO NOT CONNECT LEDS BY NOW !!!
+       ; led init
        ldi hc595_sink,0xff
-       ldi hc595_source,0xff
+       ldi hc595_source,0x01
        rcall SET_HC595
-       ldi uart_rxtx,0x61
-       rcall UART_TX
 
 MAIN:
 
@@ -133,6 +134,15 @@ T1_OVF:
        reti
 
 T0_OVF:
+
+       ; shift source
+       rol hc595_source
+
+       ; update sink
+
+       ; set hc595
+       rcall SET_HC595
+
        reti
 
 UART_RECEIVE:
index e371f65095ab9f87f14599ad602fd1bf0cb594cd..e6b8aec8ca8f7601f7aeaf98b38e1751c82b56d1 100644 (file)
@@ -1,2 +1,18 @@
 ; timer functions
 
+TIMER0_INIT:
+
+       ; clock select
+       ldi tmp1,0x01
+       out TCCR0B,tmp1
+
+       ret
+
+TIMER0_INT_INIT:
+
+       ; overflow interrupt
+       ldi tmp1,0x02
+       out TIMSK,tmp1
+
+       ret
+