projects
/
my-code
/
atmel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c8b18c7
)
revised init, main + definitions
author
hackbard
<hackbard>
Thu, 22 Jan 2004 01:00:56 +0000
(
01:00
+0000)
committer
hackbard
<hackbard>
Thu, 22 Jan 2004 01:00:56 +0000
(
01:00
+0000)
beginners/season_junior.asm
patch
|
blob
|
history
diff --git
a/beginners/season_junior.asm
b/beginners/season_junior.asm
index
8380e92
..
78c7962
100644
(file)
--- a/
beginners/season_junior.asm
+++ b/
beginners/season_junior.asm
@@
-33,6
+33,33
@@
;
; buffer/parse whole strings and decide whether to send to card or not.
;
; buffer/parse whole strings and decide whether to send to card or not.
+; some defines
+; ------------
+
+; baudrate = clock freq / etu
+; std smartcard etu: 372
+; other smartcards: 625
+.define clock 8000000
+.define clk_h 4000000
+.define etu 625
+.define etu_h 312
+.define baudrate 5 ; UBRR value for 76800 bits/s (8mhz clock)
+
+; names for registers
+.define tmp r16
+.define bitcount r17
+.define tmp1 r18
+.define tmp2 r19
+.define byte r20
+.define overflow_counter r21
+.define one r1
+.define zero r0
+
+
+;
+; programm code
+; -------------
+
;
; interrupt vectors:
;
;
; interrupt vectors:
;
@@
-74,43
+101,41
@@
reti
; init routine
;
; init routine
;
-MAIN:
-rjmp MAIN
-
INIT:
; set stackpointer
INIT:
; set stackpointer
-ldi
r16
,low(RAMEND)
-out SPL,
r16
+ldi
tmp
,low(RAMEND)
+out SPL,
tmp
; enable interrupts int0,int1
; enable interrupts int0,int1
-ldi
r16
,((1<<INT0)|(1<<INT1))
-out GIMSK,
r16
+ldi
tmp
,((1<<INT0)|(1<<INT1))
+out GIMSK,
tmp
; int0/1 setup
; int0/1 setup
-ldi
r16,((1<<ISC01)|(1<<ISC00)|(1<<ISC10)|(1<<ISC11
))
-out MCUCR,
r16
+ldi
tmp,((1<<ISC01)|(0<<ISC00)|(1<<ISC11)|(0<<ISC10
))
+out MCUCR,
tmp
; enable t/c overflow interrupt and icp
; enable t/c overflow interrupt and icp
-ldi
r16
,((1<<TOIE1)|(1<<TICIE1))
-out TIMSK,
r16
+ldi
tmp
,((1<<TOIE1)|(1<<TICIE1))
+out TIMSK,
tmp
; setup t/c and icp
; setup t/c and icp
-ldi
r16,((1<<CS12)|(1<<CS11)|(1<<CS10)|(1<<ICNC
1))
-out TCCR1B,
r16
+ldi
tmp,((1<<CS12)|(1<<CS11)|(1<<CS10)|(1<<ICNC1)|(1<<ICES
1))
+out TCCR1B,
tmp
; configure uart - interrupt enabled when i/o
; configure uart - interrupt enabled when i/o
-ldi
r16,3
-out UBRR,
r16
+ldi
tmp,baudrate
+out UBRR,
tmp
sbi UCR,TXEN
sbi UCR,TXEN
-; init bitcounter and overflow counter
-ldi r20,0 ; bitcounter
-ldi r21,0 ; register for constructing the byte
-ldi r22,0 ; overflow counter
-ldi r23,0 ; temp reg
-
-; constant 1 in r1
-ldi r16,1
-mov r1,r16
+; init registers
+ldi bitcounter,0
+ldi byte,0
+ldi overflow_counter,0
+ldi tmp1,0
+ldi tmp2,0
+ldi tmp,1
+mov one,tmp
+ldi tmp,0
+mov zero,tmp
; enable interrupts (global)
sei
; enable interrupts (global)
sei