|
.include"m16def.inc"
.org $000
rjmp rest
.org $002
jmp ext_int0
.org $004
reti
.org $030
rest:
ldi r16,high(ramend)
out sph,r16
ldi r16,low(ramend)
out spl,r16
ldi r16,$ff
out ddra,r16 ;out a
out ddrb,r16 ;out b
out ddrc,r16 ;out c
ldi r16,$00
out ddrd,r16 ;in d
out portd,r16 ;d up
ldi r16,$40
out gicr,r16 ;gicr int0 set 1
ldi r16,$00
out mcucr,r16 ;int0 mode low
ldi r18,$01
sei ;goble
a:
out porta,r18
ldi r20,40
rcall delay
ror r18
rjmp a
ext_int0:
push r18
in r1,sreg
ldi r16,$ff
out ddrd,r16;......d out
com r16
out portd,r16;.....d out 0
ldi r25,8
ldi r26,$01
b:out portc,r26
inc r26
ldi r20,50
rcall delay
cpi r25,0
brne b
sbi portd,pd6
ldi r20,50
rcall delay
cbi portd,pd6
out sreg,r1
pop r18
reti
DELAY:
PUSH R20
DELAY0:
PUSH R20
DELAY1:
PUSH R20
DELAY2:
PUSH R20
DELAY3:
DEC R20
BRNE DELAY3
POP R20
DEC R20
BRNE DELAY2
POP R20
DEC R20
BRNE DELAY1
POP R20
DEC R20
BRNE DELAY0
POP R20
RET |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|