📄 main.s
字号:
.module main.c
.area text(rom, con, rel)
.dbfile E:\avr\2.5.4\main.c
.dbfunc e uart0_init _uart0_init fV
.even
_uart0_init::
.dbline -1
.dbline 21
; // ICC-AVR application builder : 2007-5-25 21:35:24
; // Target : M16
; // Crystal: 7.3728Mhz
; // 用途:演示getchar(),getchar(),printf()等函数的使用。
; // 作者:古欣
; // AVR与虚拟仪器 http://www.avrvi.com
; // 使用7.3728M外部晶振,注意:请短接跳线JP2的1和2,电源跳线连接3.3V或者5V
; // 串口使用JP4的连接方法:1和2短接,使用RS232,请注意查看跳线旁边的示意图
; // 开发板连接:无连线
;
; #include <iom16v.h>
; #include <macros.h>
; #include <stdio.h>
;
; //UART0 initialize
; // desired baud rate: 9600
; // actual: baud rate:9600 (0.0%)
; // char size: 8 bit
; // parity: Disabled
; void uart0_init(void)
; {
.dbline 22
; UCSRB = 0x00; //disable while setting baud rate
clr R2
out 0xa,R2
.dbline 23
; UCSRA = 0x00;
out 0xb,R2
.dbline 24
; UCSRC = BIT(URSEL) | 0x06;
ldi R24,134
out 0x20,R24
.dbline 25
; UBRRL = 0x2F; //set baud rate lo
ldi R24,47
out 0x9,R24
.dbline 26
; UBRRH = 0x00; //set baud rate hi
out 0x20,R2
.dbline 27
; UCSRB = 0x18;
ldi R24,24
out 0xa,R24
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e delay _delay fV
; i -> R16
; j -> R18
.even
_delay::
.dbline -1
.dbline 31
; }
;
; void delay(void)
; {
.dbline 32
; unsigned char i=0,j=0;
clr R16
.dbline 32
clr R18
.dbline 33
; for(i=1;i!=0;i++)
ldi R16,1
xjmp L6
L3:
.dbline 34
; {
.dbline 35
; for(j=1;j!=0;j++)
ldi R18,1
xjmp L10
L7:
.dbline 36
L8:
.dbline 35
inc R18
L10:
.dbline 35
tst R18
brne L7
.dbline 37
L4:
.dbline 33
inc R16
L6:
.dbline 33
tst R16
brne L3
.dbline -2
L2:
.dbline 0 ; func end
ret
.dbsym r i 16 c
.dbsym r j 18 c
.dbend
.area lit(rom, con, rel)
L12:
.byte 32,32,32,32,32,32,32,32,32,32,32,0
.area text(rom, con, rel)
.dbfile E:\avr\2.5.4\main.c
.dbfunc e main _main fV
; i -> <dead>
; c -> R20
; b -> R20
; temp -> y+1
; a -> y+0
.even
_main::
sbiw R28,13
.dbline -1
.dbline 41
; ;
; }
; }
;
; void main(void)
; {
.dbline 43
; unsigned char i;
; unsigned char temp[]=" ";
ldi R24,<L12
ldi R25,>L12
movw R30,R28
adiw R30,1
ldi R16,12
ldi R17,0
st -y,R31
st -y,R30
st -y,R25
st -y,R24
xcall asgncblk
.dbline 44
; unsigned char a=0,b=0,c=0;
clr R2
std y+0,R2
.dbline 44
clr R20
.dbline 44
.dbline 45
; uart0_init(); //初始化串口
xcall _uart0_init
.dbline 46
; printf("www.avrvi.com\r\n"); //输出字符串
ldi R16,<L13
ldi R17,>L13
xcall _printf
xjmp L15
L14:
.dbline 57
.dbline 58
xcall _delay
.dbline 59
movw R18,R28
ldi R16,<L17
ldi R17,>L17
xcall _scanf
.dbline 60
ldd R18,y+0
clr R19
ldi R16,<L18
ldi R17,>L18
xcall _printf
.dbline 61
L15:
.dbline 56
xjmp L14
X0:
.dbline -2
L11:
adiw R28,13
.dbline 0 ; func end
ret
.dbsym l i 1 c
.dbsym r c 20 c
.dbsym r b 20 c
.dbsym l temp 1 A[12:12]c
.dbsym l a 0 c
.dbend
.area data(ram, con, rel)
.dbfile E:\avr\2.5.4\main.c
L18:
.blkb 5
.area idata
.byte 37,'d,13,10,0
.area data(ram, con, rel)
.dbfile E:\avr\2.5.4\main.c
L17:
.blkb 3
.area idata
.byte 37,'d,0
.area data(ram, con, rel)
.dbfile E:\avr\2.5.4\main.c
L13:
.blkb 16
.area idata
.byte 'w,'w,'w,46,'a,'v,'r,'v,'i,46,'c,'o,'m,13,10,0
.area data(ram, con, rel)
.dbfile E:\avr\2.5.4\main.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -