📄 ajzdsm.s
字号:
.module ajzdsm.c
.area text(rom, con, rel)
.dbfile G:\学习\avr\天祥电子AVR视频教程\chengxu\按键中断扫描\ajzdsm.c
.area data(ram, con, rel)
.dbfile G:\学习\avr\天祥电子AVR视频教程\chengxu\按键中断扫描\ajzdsm.c
_num::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile G:\学习\avr\天祥电子AVR视频教程\chengxu\按键中断扫描\ajzdsm.c
.dbsym e num _num c
.area vector(rom, abs)
.org 8
jmp _miao
.area data(ram, con, rel)
.dbfile G:\学习\avr\天祥电子AVR视频教程\chengxu\按键中断扫描\ajzdsm.c
.area text(rom, con, rel)
.dbfile G:\学习\avr\天祥电子AVR视频教程\chengxu\按键中断扫描\ajzdsm.c
.dbfunc e miao _miao fV
.even
_miao::
st -y,R2
st -y,R16
st -y,R17
st -y,R24
st -y,R25
in R2,0x3f
st -y,R2
.dbline -1
.dbline 9
; #include <iom16v.h>
; #include <macros.h>
; #define uchar unsigned char
; #define uint unsigned int
; uchar num=0;
; #pragma interrupt_handler miao:3
;
; void miao()
; {
.dbline 10
; if(num==60)
lds R24,_num
cpi R24,60
brne L2
X0:
.dbline 11
; num=0;
clr R2
sts _num,R2
L2:
.dbline 12
; num++;
lds R24,_num
subi R24,255 ; addi 1
sts _num,R24
.dbline 13
; if(num%2==0)PORTA|=BIT(0);
ldi R17,2
mov R16,R24
xcall mod8u
tst R16
brne L4
X1:
.dbline 13
sbi 0x1b,0
xjmp L5
L4:
.dbline 14
; else PORTA&=~BIT(0);
cbi 0x1b,0
L5:
.dbline -2
L1:
.dbline 0 ; func end
ld R2,y+
out 0x3f,R2
ld R25,y+
ld R24,y+
ld R17,y+
ld R16,y+
ld R2,y+
reti
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 18
;
; }
; void main()
; {
.dbline 19
; DDRA|=BIT(0);
sbi 0x1a,0
.dbline 20
; DDRD|=BIT(3);//外部中断1的触发管脚
sbi 0x11,3
.dbline 21
; PORTD&=~BIT(3);
cbi 0x12,3
.dbline 22
; GICR|=BIT(7);//T/C1控制寄存器B
in R24,0x3b
ori R24,128
out 0x3b,R24
.dbline 23
; MCUCR=0X0C;
ldi R24,12
out 0x35,R24
.dbline 24
; SREG|=BIT(7);//总中断
bset 7
L7:
.dbline 25
; while(1){;}
.dbline 25
.dbline 25
L8:
.dbline 25
xjmp L7
X2:
.dbline -2
L6:
.dbline 0 ; func end
ret
.dbend
;
;
; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -