📄 init.s
字号:
.module init.c
.area text(rom, con, rel)
.dbfile C:\ATMega8515\点阵\init.c
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 9
; //ICC-AVR application builder : 2006-4-27 14:09:59
; // Target : M8515
; // Crystal: 11.059Mhz
;
; #include <iom8515v.h>
; #include <macros.h>
;
; void port_init(void)
; {
.dbline 10
; PORTA = 0x00;
clr R2
out 0x1b,R2
.dbline 11
; DDRA = 0x00;
out 0x1a,R2
.dbline 12
; PORTB = 0x00;
out 0x18,R2
.dbline 13
; DDRB = 0xBF;
ldi R24,191
out 0x17,R24
.dbline 14
; PORTC = 0x00;
out 0x15,R2
.dbline 15
; DDRC = 0x00;
out 0x14,R2
.dbline 16
; PORTD = 0x00;
out 0x12,R2
.dbline 17
; DDRD = 0x00;
out 0x11,R2
.dbline 18
; PORTE = 0x00;
out 0x7,R2
.dbline 19
; DDRE = 0x00;
out 0x6,R2
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e spi_init _spi_init fV
.even
_spi_init::
.dbline -1
.dbline 25
; }
;
; //SPI initialize
; // clock rate: 5529498hz
; void spi_init(void)
; {
.dbline 26
; SPCR = 0xFC; //setup SPI
ldi R24,252
out 0xd,R24
.dbline -2
L2:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 16
rjmp _spi_stc_isr
.area text(rom, con, rel)
.dbfile C:\ATMega8515\点阵\init.c
.dbfunc e spi_stc_isr _spi_stc_isr fV
.even
_spi_stc_isr::
st -y,R2
st -y,R24
in R2,0x3f
st -y,R2
.dbline -1
.dbline 31
; }
;
; #pragma interrupt_handler spi_stc_isr:9
; void spi_stc_isr(void)
; {
.dbline 33
; //byte in SPDR has been sent/received
; PORTB^=0x10;
ldi R24,16
in R2,0x18
eor R2,R24
out 0x18,R2
.dbline 34
; PORTB^=0x10;
in R2,0x18
eor R2,R24
out 0x18,R2
.dbline -2
L3:
ld R2,y+
out 0x3f,R2
ld R24,y+
ld R2,y+
.dbline 0 ; func end
reti
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 39
; }
;
; //call this routine to initialize all peripherals
; void init_devices(void)
; {
.dbline 41
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 42
; port_init();
rcall _port_init
.dbline 43
; spi_init();
rcall _spi_init
.dbline 45
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 46
; EMCUCR = 0x00;
out 0x36,R2
.dbline 47
; GICR = 0x00;
out 0x3b,R2
.dbline 48
; TIMSK = 0x00;
out 0x39,R2
.dbline 49
; SEI(); //re-enable interrupts
sei
.dbline -2
L4:
.dbline 0 ; func end
ret
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -