📄 serial.lis
字号:
.module serial.c
.area text(rom, con, rel)
0000 .dbfile E:\Shuaihu\AVR\8880\serial.c
0000 .dbfunc e uart0_init _uart0_init fV
.even
0000 _uart0_init::
0000 .dbline -1
0000 .dbline 17
0000 ; //ICC-AVR application builder : 2007-10-18 21:13:05
0000 ; // Target : M8
0000 ; // Crystal: 8.0000Mhz
0000 ;
0000 ; #include <iom8v.h>
0000 ; #include <macros.h>
0000 ; #include <string.h>
0000 ; #include "serial.h"
0000 ; #include "main.h"
0000 ; //UART0 initialize
0000 ; // desired baud rate: 110
0000 ; // actual: invalid baud rate
0000 ; SERIAL_PORT_STATUS com_status;
0000 ; char recv_buf[RECV_BUFLEN];
0000 ; char send_buf[SEND_BUFLEN];
0000 ; void uart0_init(void)
0000 ; {
0000 .dbline 18
0000 ; UCSRB = 0x00; //disable while setting baud rate
0000 2224 clr R2
0002 2AB8 out 0xa,R2
0004 .dbline 19
0004 ; UCSRA = 0x00;
0004 2BB8 out 0xb,R2
0006 .dbline 20
0006 ; UCSRC = BIT(URSEL) | 0x06;
0006 86E8 ldi R24,134
0008 80BD out 0x20,R24
000A .dbline 21
000A ; UBRRL = 0x03; //set baud rate lo
000A 83E0 ldi R24,3
000C 89B9 out 0x9,R24
000E .dbline 22
000E ; UBRRH = 0x00; //set baud rate hi
000E 20BC out 0x20,R2
0010 .dbline 23
0010 ; UCSRB = 0x98;
0010 88E9 ldi R24,152
0012 8AB9 out 0xa,R24
0014 .dbline 24
0014 ; com_status.read_start_ptr=recv_buf;
0014 80E0 ldi R24,<_recv_buf
0016 90E0 ldi R25,>_recv_buf
0018 90936500 sts _com_status+1,R25
001C 80936400 sts _com_status,R24
0020 .dbline 25
0020 ; com_status.read_end_ptr=recv_buf;
0020 90936700 sts _com_status+2+1,R25
0024 80936600 sts _com_status+2,R24
0028 .dbline 26
0028 ; com_status.recv_cur_ptr=recv_buf;
0028 90936900 sts _com_status+4+1,R25
002C 80936800 sts _com_status+4,R24
0030 .dbline 27
0030 ; com_status.send_cur_ptr=send_buf;
0030 80E0 ldi R24,<_send_buf
0032 90E0 ldi R25,>_send_buf
0034 90936B00 sts _com_status+6+1,R25
0038 80936A00 sts _com_status+6,R24
003C .dbline 28
003C ; com_status.sending=0;
003C 20926C00 sts _com_status+8,R2
0040 .dbline -2
0040 L1:
0040 .dbline 0 ; func end
0040 0895 ret
0042 .dbend
.area vector(rom, abs)
.org 22
0016 21C0 rjmp _uart0_rx_isr
.area text(rom, con, rel)
0042 .dbfile E:\Shuaihu\AVR\8880\serial.c
0042 .dbfunc e uart0_rx_isr _uart0_rx_isr fV
0042 ; c -> R16
.even
0042 _uart0_rx_isr::
0042 2A92 st -y,R2
0044 3A92 st -y,R3
0046 0A93 st -y,R16
0048 8A93 st -y,R24
004A 9A93 st -y,R25
004C EA93 st -y,R30
004E FA93 st -y,R31
0050 2FB6 in R2,0x3f
0052 2A92 st -y,R2
0054 .dbline -1
0054 .dbline 33
0054 ; }
0054 ;
0054 ; #pragma interrupt_handler uart0_rx_isr:iv_USART0_RXC
0054 ; void uart0_rx_isr(void)
0054 ; {
0054 .dbline 35
0054 ; char c;
0054 ; c=UDR;
0054 0CB1 in R16,0xc
0056 .dbline 36
0056 ; if (sysoption.echo){
0056 20900000 lds R2,_sysoption
005A 2220 tst R2
005C 31F0 breq L7
005E X0:
005E .dbline 36
005E .dbline 37
005E ; if (c=='\r')
005E 0D30 cpi R16,13
0060 19F4 brne L9
0062 X1:
0062 .dbline 38
0062 ; UDR='\n';
0062 8AE0 ldi R24,10
0064 8CB9 out 0xc,R24
0066 01C0 rjmp L10
0068 L9:
0068 .dbline 40
0068 ; else
0068 ; UDR=c;
0068 0CB9 out 0xc,R16
006A L10:
006A .dbline 41
006A ; }
006A L7:
006A .dbline 42
006A ; if (c==0) return;
006A 0023 tst R16
006C 09F4 brne L11
006E X2:
006E .dbline 42
006E 1EC0 rjmp L6
0070 L11:
0070 .dbline 43
0070 ; *com_status.recv_cur_ptr++=c;
0070 E0916800 lds R30,_com_status+4
0074 F0916900 lds R31,_com_status+4+1
0078 0193 st Z+,R16
007A F0936900 sts _com_status+4+1,R31
007E E0936800 sts _com_status+4,R30
0082 .dbline 44
0082 ; if (com_status.recv_cur_ptr==recv_buf+RECV_BUFLEN)
0082 80E0 ldi R24,<_recv_buf+50
0084 90E0 ldi R25,>_recv_buf+50
0086 E817 cp R30,R24
0088 F907 cpc R31,R25
008A 31F4 brne L14
008C X3:
008C .dbline 45
008C ; com_status.recv_cur_ptr=recv_buf;
008C 80E0 ldi R24,<_recv_buf
008E 90E0 ldi R25,>_recv_buf
0090 90936900 sts _com_status+4+1,R25
0094 80936800 sts _com_status+4,R24
0098 L14:
0098 .dbline 46
0098 ; if (c==LINE_END_CHAR) {
0098 0D30 cpi R16,13
009A 41F4 brne L19
009C X4:
009C .dbline 46
009C .dbline 47
009C ; com_status.read_end_ptr=com_status.recv_cur_ptr;
009C 20906800 lds R2,_com_status+4
00A0 30906900 lds R3,_com_status+4+1
00A4 30926700 sts _com_status+2+1,R3
00A8 20926600 sts _com_status+2,R2
00AC .dbline 48
00AC ; }
00AC L19:
00AC .dbline -2
00AC L6:
00AC .dbline 0 ; func end
00AC 2990 ld R2,y+
00AE 2FBE out 0x3f,R2
00B0 F991 ld R31,y+
00B2 E991 ld R30,y+
00B4 9991 ld R25,y+
00B6 8991 ld R24,y+
00B8 0991 ld R16,y+
00BA 3990 ld R3,y+
00BC 2990 ld R2,y+
00BE 1895 reti
00C0 .dbsym r c 16 c
00C0 .dbend
.area vector(rom, abs)
.org 24
0018 60C0 rjmp _uart0_udre_isr
.area text(rom, con, rel)
00C0 .dbfile E:\Shuaihu\AVR\8880\serial.c
00C0 .dbfunc e uart0_udre_isr _uart0_udre_isr fV
.even
00C0 _uart0_udre_isr::
00C0 2A92 st -y,R2
00C2 8A93 st -y,R24
00C4 9A93 st -y,R25
00C6 EA93 st -y,R30
00C8 FA93 st -y,R31
00CA 2FB6 in R2,0x3f
00CC 2A92 st -y,R2
00CE .dbline -1
00CE .dbline 52
00CE ; }
00CE ; #pragma interrupt_handler uart0_udre_isr:iv_USART0_UDRE
00CE ; void uart0_udre_isr(void)
00CE ; {
00CE .dbline 53
00CE ; UDR=*com_status.send_cur_ptr++;
00CE E0916A00 lds R30,_com_status+6
00D2 F0916B00 lds R31,_com_status+6+1
00D6 2190 ld R2,Z+
00D8 F0936B00 sts _com_status+6+1,R31
00DC E0936A00 sts _com_status+6,R30
00E0 2CB8 out 0xc,R2
00E2 .dbline 54
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -