📄 main.s
字号:
.module main.c
.area data(ram, con, rel)
_flag_bell::
.blkb 2
.area idata
.word 0
.area data(ram, con, rel)
.dbfile D:\AVR\我的程序\定时器1的快速PWM实验/cfg.h
.dbsym e flag_bell _flag_bell I
.area text(rom, con, rel)
.dbfile D:\AVR\我的程序\定时器1的快速PWM实验/cfg.h
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 11
; /***********************************
; *实验目的:熟悉定时器CTC模式编程
; *设 计:萧联珠
; *日 期:2007-11-19
; ************************************/
; #include <iom16v.h>
; #include "cfg.h"
;
; void main()
; {
; port_init();
.dbline 12
; pwm_init();
sbi 0x11,5
.dbline 13
;
sbi 0x12,5
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e pwm_init _pwm_init fV
.even
_pwm_init::
.dbline -1
.dbline 18
; while(1);
; }
;
;
;
.dbline 19
;
ldi R24,128
out 0x3f,R24
.dbline 20
;
ldi R24,16
out 0x39,R24
.dbline 21
;
ldi R24,3
out 0x2f,R24
.dbline 22
;
ldi R24,25
out 0x2e,R24
.dbline 23
;
ldi R24,200
ldi R25,0
out 0x2b,R25
out 0x2a,R24
.dbline -2
L2:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 24
jmp _pwm_int
.area text(rom, con, rel)
.dbfile D:\AVR\我的程序\定时器1的快速PWM实验/cfg.h
.dbfunc e pwm_int _pwm_int fV
.even
_pwm_int::
st -y,R2
st -y,R3
st -y,R24
st -y,R25
st -y,R30
in R2,0x3f
st -y,R2
.dbline -1
.dbline 29
.dbline 30
lds R24,_flag_bell
lds R25,_flag_bell+1
adiw R24,1
sts _flag_bell+1,R25
sts _flag_bell,R24
.dbline 31
cpi R24,10
ldi R30,0
cpc R25,R30
brne L4
.dbline 32
.dbline 33
clr R2
clr R3
sts _flag_bell+1,R3
sts _flag_bell,R2
.dbline 34
in R2,0x12
com R2
out 0x12,R2
.dbline 35
L4:
.dbline -2
L3:
ld R2,y+
out 0x3f,R2
ld R30,y+
ld R25,y+
ld R24,y+
ld R3,y+
ld R2,y+
.dbline 0 ; func end
reti
.dbend
.dbfile D:\AVR\我的程序\定时器1的快速PWM实验\main.c
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 10
.dbline 11
xcall _port_init
.dbline 12
xcall _pwm_init
L7:
.dbline 14
L8:
.dbline 14
xjmp L7
X0:
.dbline -2
L6:
.dbline 0 ; func end
ret
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -