projects
/
my-code
/
atmel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
full intensity 2/3 *0xff
[my-code/atmel.git]
/
beginners
/
season_junior.asm
diff --git
a/beginners/season_junior.asm
b/beginners/season_junior.asm
index
86873a6
..
9171e7c
100644
(file)
--- a/
beginners/season_junior.asm
+++ b/
beginners/season_junior.asm
@@
-133,11
+133,11
@@
cbi PORTD,PD4
ldi tmp,low(RAMEND)
out SPL,tmp
ldi tmp,low(RAMEND)
out SPL,tmp
-; enable interrupts int0,int1
+; enable interrupts int0,int1
,sleep
ldi tmp,((1<<INT0)|(1<<INT1))
out GIMSK,tmp
; int0/1 setup
ldi tmp,((1<<INT0)|(1<<INT1))
out GIMSK,tmp
; int0/1 setup
-ldi tmp,((1<<ISC01)|(0<<ISC00)|(1<<ISC11)|(0<<ISC10))
+ldi tmp,((1<<ISC01)|(0<<ISC00)|(1<<ISC11)|(0<<ISC10)
|(1<<SE)
)
out MCUCR,tmp
; enable t/c overflow interrupt and icp
out MCUCR,tmp
; enable t/c overflow interrupt and icp
@@
-151,6
+151,11
@@
out TCCR1B,tmp
ldi tmp,baudrate
out UBRR,tmp
sbi UCR,TXEN
ldi tmp,baudrate
out UBRR,tmp
sbi UCR,TXEN
+; debug
+.ifdef DEBUG
+ldi tmp,0x49
+out UDR,tmp
+.endif
; enable pullups on int0, int1, clk, icp io ports
ldi tmp,((1<<PD2)|(1<<PD3)|(1<<PD5)|(1<<PD6))
; enable pullups on int0, int1, clk, icp io ports
ldi tmp,((1<<PD2)|(1<<PD3)|(1<<PD5)|(1<<PD6))
@@
-190,7
+195,16
@@
rjmp MAIN
MAIN:
MAIN:
-; loop and wait for interrupts
+; debug
+.ifdef DEBUG
+ldi tmp,0x4d
+out UDR,tmp
+.endif
+
+; sleep/wait for next interrupt
+sleep
+
+; go to sleep again
rjmp MAIN
; ----------------
rjmp MAIN
; ----------------
@@
-199,6
+213,11
@@
rjmp MAIN
REC_CARD:
REC_CARD:
+.ifdef DEBUG
+ldi tmp,0x52
+out UDR,tmp
+.endif
+
; input & pullup
cbi DDRD,DDD6
sbi PORTD,PD6
; input & pullup
cbi DDRD,DDD6
sbi PORTD,PD6
@@
-234,6
+253,11
@@
reti
CALC_DELTA_CLOCK:
CALC_DELTA_CLOCK:
+.ifdef DEBUG
+ldi tmp,0x63
+out UDR,tmp
+.endif
+
; store counters
mov counter_l_tmp,counter_l
mov counter_h_tmp,counter_h
; store counters
mov counter_l_tmp,counter_l
mov counter_h_tmp,counter_h
@@
-253,6
+277,11
@@
ret
TOGGLE_ICP_SENSE:
TOGGLE_ICP_SENSE:
+.ifdef DEBUG
+ldi tmp,0x54
+out UDR,tmp
+.endif
+
; toggle according to state
in tmp,TCCR1B
cbr tmp,ICES1
; toggle according to state
in tmp,TCCR1B
cbr tmp,ICES1
@@
-269,6
+298,11
@@
ret
FWD_TO_CAM:
FWD_TO_CAM:
+.ifdef DEBUG
+ldi tmp,0x66
+out UDR,tmp
+.endif
+
; activate led
sbi PORTB,LED_FWD_TO_CARD
cbi PORTB,LED_FWD_TO_CAM
; activate led
sbi PORTB,LED_FWD_TO_CARD
cbi PORTB,LED_FWD_TO_CAM
@@
-301,6
+335,11
@@
ret
PREPARE_UART:
PREPARE_UART:
+.ifdef DEBUG
+ldi tmp,0x50
+out UDR,tmp
+.endif
+
; write transfer data to sram
ldi ZL,0x60
st Z+,counter_l
; write transfer data to sram
ldi ZL,0x60
st Z+,counter_l
@@
-321,6
+360,11
@@
ret
REC_CAM:
REC_CAM:
+.ifdef DEBUG
+ldi tmp,0x72
+out UDR,tmp
+.endif
+
; first thing - pullup on
cbi DDRD,DDD3
sbi DDRD,PD3
; first thing - pullup on
cbi DDRD,DDD3
sbi DDRD,PD3
@@
-352,6
+396,11
@@
reti
TOGGLE_INT_SENSE:
TOGGLE_INT_SENSE:
+.ifdef DEBUG
+ldi tmp,0x73
+out UDR,tmp
+.endif
+
in tmp,MCUCR
cbr tmp,ISC10
sbrs state,HIGH_F
in tmp,MCUCR
cbr tmp,ISC10
sbrs state,HIGH_F
@@
-367,6
+416,11
@@
ret
FWD_TO_CARD:
FWD_TO_CARD:
+.ifdef DEBUG
+ldi tmp,0x46
+out UDR,tmp
+.endif
+
; activate led
sbi PORTB,LED_FWD_TO_CAM
cbi PORTB,LED_FWD_TO_CARD
; activate led
sbi PORTB,LED_FWD_TO_CAM
cbi PORTB,LED_FWD_TO_CARD
@@
-399,6
+453,11
@@
ret
T1_OVERFLOW:
T1_OVERFLOW:
+.ifdef DEBUG
+ldi tmp,0x74
+out UDR,tmp
+.endif
+
; increment counter overflow
add overflow_counter,one
; increment counter overflow
add overflow_counter,one
@@
-418,6
+477,11
@@
reti
RST_CAM:
RST_CAM:
+.ifdef DEBUG
+ldi tmp,0x69
+out UDR,tmp
+.endif
+
; by now just jump to init
rjmp INIT
; by now just jump to init
rjmp INIT