📄 int.s
字号:
.module int.c
.area text(rom, con, rel)
.dbfile F:\单片机源程序\AVR单片机程序\MAGE16\INT0\int.c
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 9
; //ICC-AVR application builder : 2007-4-16 20:55:44
; // Target : M16
; // Crystal: 8.0000Mhz
;
; #include <iom16v.h>
; #include <macros.h>
;
; void port_init(void) //引脚初始化
; {
.dbline 12
;
;
; PORTD = 0x0C; //INT0,INT1输入上拉电阻允许
ldi R24,12
out 0x12,R24
.dbline 13
; DDRD = 0x40;
ldi R24,64
out 0x11,R24
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 4
jmp _int0_isr
.area text(rom, con, rel)
.dbfile F:\单片机源程序\AVR单片机程序\MAGE16\INT0\int.c
.dbfunc e int0_isr _int0_isr fV
.even
_int0_isr::
st -y,R24
in R24,0x3f
st -y,R24
.dbline -1
.dbline 18
; }
;
; #pragma interrupt_handler int0_isr: 2 //INT0中断服务程序,中断号为2
; void int0_isr(void)
; {
.dbline 19
; DDRD=0x40;
ldi R24,64
out 0x11,R24
.dbline 20
; PORTD=0X40;
out 0x12,R24
.dbline -2
L2:
ld R24,y+
out 0x3f,R24
ld R24,y+
.dbline 0 ; func end
reti
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 24
; }
;
; void init_devices(void) //中断初始化
; {
.dbline 25
; CLI();
cli
.dbline 26
; port_init();
xcall _port_init
.dbline 27
; MCUCR = 0X00; //INT0为低电平触发
clr R2
out 0x35,R2
.dbline 28
; SREG|= 0X80; //SREG的位I置“1”,允许中断
bset 7
.dbline 29
; GICR|= 0XC0; //INT0,INT1中断使能
in R24,0x3b
ori R24,192
out 0x3b,R24
.dbline 30
; TIMSK|= 0x00; //关闭时钟中断
in R2,0x39
out 0x39,R2
.dbline 31
; SEI();
sei
.dbline -2
L3:
.dbline 0 ; func end
ret
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 35
; }
;
; void main(void)
; {
xjmp L6
L5:
.dbline 37
.dbline 38
clr R2
out 0x12,R2
.dbline 39
xcall _init_devices
.dbline 40
L6:
.dbline 36
xjmp L5
X0:
.dbline -2
L4:
.dbline 0 ; func end
ret
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -