⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uart.s

📁 avr应用有关使用注意事项如下 1 在使用例子程序之前将库文件libslavr.a 拷贝到ICCAVR 安装目录下的库文件目录中 即...LIB目录将头文件slavr.h 拷贝到头文件目录即...
💻 S
字号:
	.module uart.c
	.area text(rom, con, rel)
	.dbfile E:\MYDOCU~1\ICCAVR_Directory\uart\uart.c
	.dbfunc e main _main fV
;           temp -> R20
	.even
_main::
	.dbline -1
	.dbline 9
; #include <iom16v.h>
; #include <macros.h>
; #include <stdio.h>
; 
; //函数声明
; void uart0_init(void);
; 
; void main(void)
; {
	.dbline 11
; 	unsigned char temp;
; 	uart0_init();
	xcall _uart0_init
	.dbline 12
; 	puts("UART TEST");//发送字符串
	ldi R16,<L2
	ldi R17,>L2
	xcall _puts
	.dbline 13
; 	puts("www.ouravr.com");
	ldi R16,<L3
	ldi R17,>L3
	xcall _puts
	.dbline 14
; 	putchar('\r');
	ldi R16,13
	xcall _putchar
	.dbline 15
; 	putchar('\n');
	ldi R16,10
	xcall _putchar
	xjmp L5
L4:
	.dbline 17
	.dbline 18
	xcall _getchar
	mov R20,R16
	.dbline 19
	xcall _putchar
	.dbline 20
	ldi R16,<L7
	ldi R17,>L7
	xcall _puts
	.dbline 21
	ldi R16,13
	xcall _putchar
	.dbline 22
	ldi R16,10
	xcall _putchar
	.dbline 23
L5:
	.dbline 16
	xjmp L4
X0:
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbsym r temp 20 c
	.dbend
	.dbfunc e uart0_init _uart0_init fV
	.even
_uart0_init::
	.dbline -1
	.dbline 27
; 	while(1)
; 	{
; 		temp=getchar();
; 		putchar(temp);
; 		puts(" had been sent to the MCU!");
; 		putchar('\r');
; 		putchar('\n');
; 	}
; }
; //UART初始化,软件生成,使能接收和发送,8数据位,1停止位,偶校验,19.2K波特率
; void uart0_init(void)
; {
	.dbline 28
;  UCSRB = 0x00; //disable while setting baud rate
	clr R2
	out 0xa,R2
	.dbline 29
;  UCSRA = 0x00;
	out 0xb,R2
	.dbline 30
;  UCSRC = BIT(URSEL) | 0x26;
	ldi R24,166
	out 0x20,R24
	.dbline 31
;  UBRRL = 0x0C; //set baud rate lo
	ldi R24,12
	out 0x9,R24
	.dbline 32
;  UBRRH = 0x00; //set baud rate hi
	out 0x20,R2
	.dbline 33
;  UCSRB = 0x18;
	ldi R24,24
	out 0xa,R24
	.dbline -2
L8:
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\MYDOCU~1\ICCAVR_Directory\uart\uart.c
L7:
	.blkb 27
	.area idata
	.byte 32,'h,'a,'d,32,'b,'e,'e,'n,32,'s,'e,'n,'t,32,'t
	.byte 'o,32,'t,'h,'e,32,'M,'C,'U,33,0
	.area data(ram, con, rel)
	.dbfile E:\MYDOCU~1\ICCAVR_Directory\uart\uart.c
L3:
	.blkb 15
	.area idata
	.byte 'w,'w,'w,46,'o,'u,'r,'a,'v,'r,46,'c,'o,'m,0
	.area data(ram, con, rel)
	.dbfile E:\MYDOCU~1\ICCAVR_Directory\uart\uart.c
L2:
	.blkb 10
	.area idata
	.byte 'U,'A,'R,'T,32,'T,'E,'S,'T,0
	.area data(ram, con, rel)
	.dbfile E:\MYDOCU~1\ICCAVR_Directory\uart\uart.c

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -