📄 int2.s
字号:
.module int2.c
.area text(rom, con, rel)
.dbfile F:\USING0~1\INT\int2.c
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 9
; //ICC-AVR application builder : 2007-5-6 12:36:39
; // Target : M16
; // Crystal: 8.0000Mhz
;
; #include <iom16v.h>
; #include <macros.h>
;
; void port_init(void)
; {
.dbline 10
; PORTA = 0x00;
clr R2
out 0x1b,R2
.dbline 11
; DDRA = 0xff;
ldi R24,255
out 0x1a,R24
.dbline 12
; PORTB = 0x00;
out 0x18,R2
.dbline 13
; DDRB = 0x00;
out 0x17,R2
.dbline 14
; PORTC = 0x00; //m103 output only
out 0x15,R2
.dbline 15
; DDRC = 0x00;
out 0x14,R2
.dbline 16
; PORTD = 0x0c;
ldi R24,12
out 0x12,R24
.dbline 17
; DDRD = 0x00;
out 0x11,R2
.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:\USING0~1\INT\int2.c
.dbfunc e int0_isr _int0_isr fV
.even
_int0_isr::
st -y,R24
in R24,0x3f
st -y,R24
.dbline -1
.dbline 22
; }
;
; #pragma interrupt_handler int0_isr:2
; void int0_isr(void)
; {
.dbline 23
; PORTA = 0XF0;
ldi R24,240
out 0x1b,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 28
; }
;
; //call this routine to initialize all peripherals
; void init_devices(void)
; {
.dbline 30
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 31
; port_init();
xcall _port_init
.dbline 33
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 34
; GICR = 0x40;
ldi R24,64
out 0x3b,R24
.dbline 35
; TIMSK = 0x00; //timer interrupt sources
out 0x39,R2
.dbline 36
; SEI(); //re-enable interrupts
sei
.dbline -2
L3:
.dbline 0 ; func end
ret
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 42
; //all peripherals are now initialized
; }
;
; //
; void main(void)
; {
.dbline 43
; init_devices();
xcall _init_devices
.dbline -2
L4:
.dbline 0 ; func end
ret
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -