📄 main.s
字号:
.module main.c
.area data(ram, con, rel)
_table::
.blkb 16
.area idata
.byte 48,49,50,51,52,53,54,55,56,57,'a,'b,'c,'d,'e,'f
.area data(ram, con, rel)
.dbfile E:\ICC\SPI\main.c
.dbsym e table _table A[16:16]c
.area text(rom, con, rel)
.dbfile E:\ICC\SPI\main.c
.dbfunc e main _main fV
; j -> <dead>
; i -> <dead>
.even
_main::
sbiw R28,4
.dbline -1
.dbline 13
; #include <iom8v.h>
; #include "mytype.h"
; #include "flash.h"
; #include "uart.h"
; #include "spi.h"
;
;
; uint8 table[16]="0123456789abcdef";
; extern uint8 read_string[];
;
;
; void main(void)
; {
.dbline 15
; uint8 i,j;
; WP_1;
sbi 0x18,1
.dbline 16
; Spi_init();//SPI初始化。
rcall _Spi_init
.dbline 17
; Uart_init();//串口初始化。
rcall _Uart_init
.dbline 18
; Prints("System starting...",1);
ldi R18,1
ldi R19,0
ldi R16,<L2
ldi R17,>L2
rcall _Prints
.dbline 20
;
; Sector_Erase(0x000005);//擦除第一段。
ldi R16,5
ldi R17,0
ldi R18,0
ldi R19,0
rcall _Sector_Erase
.dbline 21
; Write_string("Hello,I'm a flash!",0x000001,19);//写入一段字符串。
ldi R24,19
std y+2,R24
ldi R20,1
ldi R21,0
ldi R22,0
ldi R23,0
std y+0,R22
std y+1,R23
movw R18,R20
ldi R16,<L3
ldi R17,>L3
rcall _Write_string
.dbline 22
; Read_string(0x000001,18);//读取地址0x000001开始的18个字节。
ldi R20,18
ldi R21,0
ldi R22,0
ldi R23,0
std y+0,R20
std y+1,R21
std y+2,R22
std y+3,R23
ldi R16,1
ldi R17,0
ldi R18,0
ldi R19,0
rcall _Read_string
.dbline 23
; Prints(read_string,1);//读取数据发送到串口。
ldi R18,1
ldi R19,0
ldi R16,<_read_string
ldi R17,>_read_string
rcall _Prints
L4:
.dbline 24
L5:
.dbline 24
rjmp L4
X0:
.dbline -2
L1:
adiw R28,4
.dbline 0 ; func end
ret
.dbsym l j 5 c
.dbsym l i 5 c
.dbend
.area data(ram, con, rel)
.dbfile E:\ICC\SPI\main.c
L3:
.blkb 19
.area idata
.byte 'H,'e,'l,'l,'o,44,'I,39,'m,32,'a,32,'f,'l,'a,'s
.byte 'h,33,0
.area data(ram, con, rel)
.dbfile E:\ICC\SPI\main.c
L2:
.blkb 19
.area idata
.byte 'S,'y,'s,'t,'e,'m,32,'s,'t,'a,'r,'t,'i,'n,'g,46
.byte 46,46,0
.area data(ram, con, rel)
.dbfile E:\ICC\SPI\main.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -