From: hackbard Date: Thu, 17 Feb 2011 08:57:25 +0000 (+0100) Subject: some more debug X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9e6ded1910b07f37d30e24c69ac6c9bf5438178;p=my-code%2Fatmel.git some more debug --- diff --git a/monolyzer/main.asm b/monolyzer/main.asm index b41f3b3..8795636 100644 --- a/monolyzer/main.asm +++ b/monolyzer/main.asm @@ -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 diff --git a/monolyzer/timer.asm b/monolyzer/timer.asm index 3327547..91cfba8 100644 --- a/monolyzer/timer.asm +++ b/monolyzer/timer.asm @@ -2,11 +2,11 @@ TIMER1_INIT: - ; clock select, prescaler 8 + ; clock select, prescaler 64 in tmp1,TCCR1B cbr tmp1,(1<