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

📄 uarst.s

📁 介绍AVR单片机与SD卡及MP3芯片的通信接口代码。
💻 S
字号:
	.module uarst.c
	.area text(rom, con, rel)
	.dbfile C:\DOCUME~1\pas\桌面\SD卡MP3程序\uarst.c
	.dbfunc e uart0_init _uart0_init fV
	.even
_uart0_init::
	.dbline -1
	.dbline 17
; /************************************************************/
; /*		         UARST Code for   M32L					    */
; /*				   By   pasyong								*/
; /*				   2006-4									*/
; /*				   Base ICC6.31A					        */
; /************************************************************/
; #include <iom32v.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 18
;  UCSRB = 0x00; //disable while setting baud rate
	clr R2
	out 0xa,R2
	.dbline 19
;  UCSRA = 0x00;
	out 0xb,R2
	.dbline 20
;  UCSRC = BIT(URSEL) | 0x06;
	ldi R24,134
	out 0x20,R24
	.dbline 21
;  UBRRL = 0x2F; //set baud rate lo
	ldi R24,47
	out 0x9,R24
	.dbline 22
;  UBRRH = 0x00; //set baud rate hi
	out 0x20,R2
	.dbline 23
;  UCSRB = 0x18;
	ldi R24,24
	out 0xa,R24
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Puts _Puts fV
;              s -> R20,R21
	.even
_Puts::
	xcall push_gset1
	movw R20,R16
	.dbline -1
	.dbline 27
; }
; //串口输出字符串
; void Puts( unsigned char *s)
; { 
	xjmp L4
L3:
	.dbline 29
	.dbline 30
	movw R30,R20
	ldd R16,z+0
	xcall _putchar
	.dbline 31
	subi R20,255  ; offset = 1
	sbci R21,255
	.dbline 32
L4:
	.dbline 28
; 	 while (*s) 
	movw R30,R20
	ldd R2,z+0
	tst R2
	brne L3
	.dbline -2
L2:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r s 20 pc
	.dbend

⌨️ 快捷键说明

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