📄 uart.lis
字号:
.module uart.c
.area text(rom, con, rel)
0000 .dbfile E:\ICCAVR\project\AVRMEG~2\icc\019-TEST\uart.c
0000 .dbfunc e Uart_Init _Uart_Init fV
.even
0000 _Uart_Init::
0000 .dbline -1
0000 .dbline 4
0000 ; #include "iom16v.h"
0000 ;
0000 ; /*串口初始化函数*/
0000 ; void Uart_Init(void) {
0000 .dbline 5
0000 ; UCSRA = 0x02; /*倍速*/
0000 82E0 ldi R24,2
0002 8BB9 out 0xb,R24
0004 .dbline 6
0004 ; UCSRB = 0x18; /*允许接收和发送*/
0004 88E1 ldi R24,24
0006 8AB9 out 0xa,R24
0008 .dbline 7
0008 ; UCSRC = 0x06; /*8位数据*/
0008 86E0 ldi R24,6
000A 80BD out 0x20,R24
000C .dbline 8
000C ; UBRRH = 0x00;
000C 2224 clr R2
000E 20BC out 0x20,R2
0010 .dbline 9
0010 ; UBRRL = 12; /*9600*/
0010 8CE0 ldi R24,12
0012 89B9 out 0x9,R24
0014 .dbline -2
0014 L1:
0014 .dbline 0 ; func end
0014 0895 ret
0016 .dbend
0016 .dbfunc e Uart_Transmit _Uart_Transmit fV
0016 ; i -> R16
.even
0016 _Uart_Transmit::
0016 .dbline -1
0016 .dbline 13
0016 ; }
0016 ;
0016 ; /*数据发送,查询方式*/
0016 ; void Uart_Transmit(unsigned char i) {
0016 L3:
0016 .dbline 15
0016 L4:
0016 .dbline 15
0016 ;
0016 ; while (!(UCSRA & (1<<UDRE))); /* 等待发送缓冲器为空*/
0016 5D9B sbis 0xb,5
0018 FECF rjmp L3
001A .dbline 16
001A ; UDR = i; /* 发送数据*/
001A 0CB9 out 0xc,R16
001C .dbline -2
001C L2:
001C .dbline 0 ; func end
001C 0895 ret
001E .dbsym r i 16 c
001E .dbend
001E .dbfunc e Uart_Receive _Uart_Receive fc
.even
001E _Uart_Receive::
001E .dbline -1
001E .dbline 20
001E ; }
001E ;
001E ; /*数据接收,查询方式*/
001E ; unsigned char Uart_Receive( void ) {
001E L7:
001E .dbline 22
001E L8:
001E .dbline 22
001E ;
001E ; while (!(UCSRA & (1<<RXC))); /* 等待接收数据*/
001E 5F9B sbis 0xb,7
0020 FECF rjmp L7
0022 .dbline 23
0022 ; return UDR; /* 获取并返回数据*/
0022 0CB1 in R16,0xc
0024 .dbline -2
0024 L6:
0024 .dbline 0 ; func end
0024 0895 ret
0026 .dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -