From a20f57e053845b7a56c66999e6887aa0cb8c711f Mon Sep 17 00:00:00 2001 From: hackbard Date: Sun, 31 May 2009 07:40:07 +0200 Subject: [PATCH] all leds on (multiplexed!) --- led_plex/main.asm | 24 +++++++++++++++++------- led_plex/timer.asm | 16 ++++++++++++++++ 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/led_plex/main.asm b/led_plex/main.asm index 23b33c3..8a03d53 100644 --- a/led_plex/main.asm +++ b/led_plex/main.asm @@ -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: diff --git a/led_plex/timer.asm b/led_plex/timer.asm index e371f65..e6b8aec 100644 --- a/led_plex/timer.asm +++ b/led_plex/timer.asm @@ -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 + -- 2.20.1