?? uarst.s
字號:
.module uarst.c
.area text(rom, con, rel)
.dbfile E:\5按鍵_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
.dbline 24
; }
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
.dbline 33
; {
; putchar(*s);
; s++;
; }
; }
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 + -