]> hackdaworld.org Git - my-code/atmel.git/commitdiff
some more debug
authorhackbard <hackbard@hackdaworld.org>
Thu, 17 Feb 2011 08:57:25 +0000 (09:57 +0100)
committerhackbard <hackbard@hackdaworld.org>
Thu, 17 Feb 2011 08:57:25 +0000 (09:57 +0100)
monolyzer/main.asm
monolyzer/timer.asm

index b41f3b3af57ad4c516ddf0ac94c0996e898fb137..8795636ee213fef05e12abd34d1b8fd716b77290 100644 (file)
@@ -14,6 +14,7 @@
 .def   uart_rxtx       = r18
 .def   count           = r19
 .def   state           = r20
+.def   scount          = r21
 
 ;
 ; interrupts
@@ -110,10 +111,33 @@ INIT:
        ldi ZL,low(STORAGE)
        ldi ZH,high(STORAGE)
 
+       ldi scount,0
+       ldi tmp1,0x23
+INIT_STORAGE:
+       ; init storage
+       st Z+,tmp1
+       st Z+,tmp1
+       add scount,one
+       cpi scount,55
+       brne INIT_STORAGE
+
+       ; storage pointer again
+       ldi ZL,low(STORAGE)
+       ldi ZH,high(STORAGE)
+
        ; signal ready output
        ldi uart_rxtx,0x72
        rcall UART_TX
 
+DEBUG_PORT:
+       ;rcall UART_RX
+       ;ldi uart_rxtx,0x30
+       ;in tmp1,PIND
+       ;sbrc tmp1,2
+       ;ldi uart_rxtx,0x31
+       ;rcall UART_TX
+       ;rjmp DEBUG_PORT
+
        ; external interrupt enable
        rcall INT0_IR_CONF_INIT
        rcall INT0_IR_ENABLE
@@ -155,7 +179,7 @@ TRANSFER:
        ; reset storage pointer
        ldi ZL,low(STORAGE)
        ldi ZH,high(STORAGE)
-       ldi tmp1,0
+       ldi scount,1
 
        ; transmit number of sampled words
        mov uart_rxtx,count
@@ -163,18 +187,18 @@ TRANSFER:
 
 TRANSFER_LOOP:
 
-       ; check amount of sent data
-       cp tmp1,count
-       breq IDLE
-
-       ; transmit storage
+       ; send data and counter
        ld uart_rxtx,Z+
        rcall UART_TX
        ld uart_rxtx,Z+
        rcall UART_TX
 
        ; count sent data
-       add tmp1,one
+       add scount,one
+
+       ; check amount of data
+       cpi scount,56
+       breq IDLE
 
        rjmp TRANSFER_LOOP
 
@@ -220,6 +244,11 @@ INT0_RUN:
 
        ; inc counter
        add count,one
+       
+       ; reset timer
+       ldi tmp1,0
+       out TCNT1H,tmp1
+       out TCNT1L,tmp1
 
        ; check for left capacity
        cpi count,55
index 3327547b98574fbeceac73ee6abd16558802553d..91cfba80d6a885ec92b39120208d92aff22eb111 100644 (file)
@@ -2,11 +2,11 @@
 
 TIMER1_INIT:
 
-       ; clock select, prescaler 8
+       ; clock select, prescaler 64
        in tmp1,TCCR1B
        cbr tmp1,(1<<CS12)
        sbr tmp1,(1<<CS11)
-       cbr tmp1,(1<<CS10)
+       sbr tmp1,(1<<CS10)
        out TCCR1B,tmp1
 
        ret