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

📄 uart.s

📁 串行口测试程序。例如:程序复位后先向串口发送"Hellow Word!",之后每从串口收到一个字符就把它从串口发送出去
💻 S
字号:
	.module uart.c
	.area text(rom, con, rel)
	.dbfile D:\AVR源程序\IccAVR\UartTest\uart.c
	.dbfunc e cpu_init _cpu_init fV
	.even
_cpu_init::
	.dbline -1
	.dbline 18
; /*****************************************
; 串行口测试程序
; 输入数据:无
; 输出:程序复位后先向串口发送"Hellow Word!",之后每从串口收到一个字符就把它从串口发送出去
; 作者:
; CPU: M16L  晶振:片外8M
; 修改时间:2004-08-02
; *****************************************/
; 
; #include "iom16.h"
; #include "stdio.h"
; #include "macros.h"		//	常用的宏定义
; #define uchar unsigned char
; #define uint unsigned int
; 
; 
; void cpu_init(void)
; {
	.dbline 19
;  	CLI();
	cli
	.dbline 20
;  	UBRR  = 0x33;			//	波特率9600
	ldi R24,51
	out 0x9,R24
	.dbline 21
; 	UCR = 0x18;
	ldi R24,24
	out 0xa,R24
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e main _main fV
	.even
_main::
	.dbline -1
	.dbline 25
; }
; 
; void main(void)
; {
	.dbline 26
; 	cpu_init();
	xcall _cpu_init
	.dbline 27
; 	puts("Hellow Word!");
	ldi R16,<L3
	ldi R17,>L3
	xcall _puts
	xjmp L5
X0:
	.dbline 29
; 	while(1) 
; 	{
L7:
	.dbline 30
L8:
	.dbline 30
; 		while(!(USR&0x80));
	sbis 0xb,7
	rjmp L7
	.dbline 31
; 		UDR=UDR;
	in R2,0xc
	out 0xc,R2
L10:
	.dbline 32
L11:
	.dbline 32
	sbis 0xb,6
	rjmp L10
	.dbline 33
	.dbline 34
L5:
	.dbline 28
	xjmp L8
X1:
	.dbline -2
L2:
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile D:\AVR源程序\IccAVR\UartTest\uart.c
L3:
	.blkb 13
	.area idata
	.byte 'H,'e,'l,'l,'o,'w,32,'W,'o,'r,'d,33,0
	.area data(ram, con, rel)
	.dbfile D:\AVR源程序\IccAVR\UartTest\uart.c

⌨️ 快捷键说明

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