📄 usart1_m128.s
字号:
.module Usart1_M128.c
.area text(rom, con, rel)
.dbfile E:\__test\_RTL8019_M128_struct_Test\Usart1_M128.c
.area data(ram, con, rel)
.dbfile E:\__test\_RTL8019_M128_struct_Test\Usart1_M128.c
_RX_data::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile E:\__test\_RTL8019_M128_struct_Test\Usart1_M128.c
.blkb 5
.area idata
.byte 0,0,0,0,0
.area data(ram, con, rel)
.dbfile E:\__test\_RTL8019_M128_struct_Test\Usart1_M128.c
.dbsym e RX_data _RX_data A[6:6]c
_RX_data2::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile E:\__test\_RTL8019_M128_struct_Test\Usart1_M128.c
.blkb 5
.area idata
.byte 0,0,0,0,0
.area data(ram, con, rel)
.dbfile E:\__test\_RTL8019_M128_struct_Test\Usart1_M128.c
.dbsym e RX_data2 _RX_data2 A[6:6]c
_flg_Received::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile E:\__test\_RTL8019_M128_struct_Test\Usart1_M128.c
.dbsym e flg_Received _flg_Received c
.area text(rom, con, rel)
.dbfile E:\__test\_RTL8019_M128_struct_Test\Usart1_M128.c
.dbfunc e UART1_Init _UART1_Init fV
.even
_UART1_Init::
.dbline -1
.dbline 11
; #include <string.h>
;
; #include "Usart1_M128.h"
;
; unsigned char RX_data[RX_SIZE]={0}; //串口接收缓冲区
; unsigned char RX_data2[RX_SIZE]={0}; //串口接收缓冲区
; volatile unsigned int iNum; //串口接收字符计数
; unsigned char flg_Received=0; //已接收一个卡号
;
; void UART1_Init(void)
; {
.dbline 12
; UCSR1B = (1<<RXCIE1)| (1<<RXEN1) |(1<<TXEN1); //允许串口发送和接收,并响应接收完成中断
ldi R24,152
sts 154,R24
.dbline 13
; UBRR1L = BAUD; //波特率为9600(7.3728MHz晶振)
ldi R24,47
sts 153,R24
.dbline 14
; UBRR1H = 0;
clr R2
sts 152,R2
.dbline 15
; UCSR1C = (1<<UCSZ11)|(1<<UCSZ10); //8位数据+1位stop位, 异步模式
ldi R24,6
sts 157,R24
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 120
jmp _UART1_Receive
.area text(rom, con, rel)
.dbfile E:\__test\_RTL8019_M128_struct_Test\Usart1_M128.c
.dbfunc e UART1_Receive _UART1_Receive fV
; cRec -> R10
.even
_UART1_Receive::
st -y,R0
st -y,R1
st -y,R2
st -y,R3
st -y,R4
st -y,R5
st -y,R6
st -y,R7
st -y,R8
st -y,R9
st -y,R10
st -y,R16
st -y,R17
st -y,R18
st -y,R19
st -y,R24
st -y,R25
st -y,R26
st -y,R27
st -y,R30
st -y,R31
in R0,0x3f
st -y,R0
st -y,R10
sbiw R28,2
.dbline -1
.dbline 20
; }
;
; #pragma interrupt_handler UART1_Receive: iv_USART1_RX
; void UART1_Receive(void)
; {
.dbline 23
; unsigned char cRec;
;
; cRec= UDR1;
lds R10,156
.dbline 25
;
; RX_data[iNum++]=cRec;
lds R2,_iNum
lds R3,_iNum+1
movw R24,R2
adiw R24,1
sts _iNum+1,R25
sts _iNum,R24
ldi R24,<_RX_data
ldi R25,>_RX_data
movw R30,R2
add R30,R24
adc R31,R25
std z+0,R10
.dbline 28
;
; //每接收RX_SIZE=6个字符显示一次
; if (iNum==RX_SIZE)
lds R24,_iNum
lds R25,_iNum+1
cpi R24,6
ldi R30,0
cpc R25,R30
brne L3
X0:
.dbline 29
; {
.dbline 30
; memcpy(RX_data2,RX_data,RX_SIZE);
ldi R24,6
ldi R25,0
std y+1,R25
std y+0,R24
ldi R18,<_RX_data
ldi R19,>_RX_data
ldi R16,<_RX_data2
ldi R17,>_RX_data2
xcall _memcpy
.dbline 31
; flg_Received=1;
ldi R24,1
sts _flg_Received,R24
.dbline 32
; iNum=0;
clr R2
clr R3
sts _iNum+1,R3
sts _iNum,R2
.dbline 33
; }
L3:
.dbline 35
;
; RX_data[0]=cRec;
sts _RX_data,R10
.dbline 36
; flg_Received=1;
ldi R24,1
sts _flg_Received,R24
.dbline -2
L2:
.dbline 0 ; func end
adiw R28,2
ld R10,y+
ld R0,y+
out 0x3f,R0
ld R31,y+
ld R30,y+
ld R27,y+
ld R26,y+
ld R25,y+
ld R24,y+
ld R19,y+
ld R18,y+
ld R17,y+
ld R16,y+
ld R10,y+
ld R9,y+
ld R8,y+
ld R7,y+
ld R6,y+
ld R5,y+
ld R4,y+
ld R3,y+
ld R2,y+
ld R1,y+
ld R0,y+
reti
.dbsym r cRec 10 c
.dbend
.dbfunc e UART1_PutChar _UART1_PutChar fV
; c -> R16
.even
_UART1_PutChar::
.dbline -1
.dbline 40
; }
;
; void UART1_PutChar(unsigned char c) //字符输出函数
; {
L6:
.dbline 41
; while (!(UCSR1A&(1 << UDRE1))); //判断上次发送有没有完成
L7:
.dbline 41
lds R2,155
sbrs R2,5
rjmp L6
X1:
.dbline 42
; UDR1 = c;
sts 156,R16
.dbline -2
L5:
.dbline 0 ; func end
ret
.dbsym r c 16 c
.dbend
.dbfunc e UART1_Puts _UART1_Puts fV
; s -> R10,R11
.even
_UART1_Puts::
st -y,R10
st -y,R11
movw R10,R16
.dbline -1
.dbline 46
; }
;
; void UART1_Puts(unsigned char *s)
; {
xjmp L11
L10:
.dbline 48
; while (*s)
; {
.dbline 49
; UART1_PutChar(*s++);
movw R30,R10
ld R16,Z+
movw R10,R30
xcall _UART1_PutChar
.dbline 50
; }
L11:
.dbline 47
movw R30,R10
ldd R2,z+0
tst R2
brne L10
X2:
.dbline -2
L9:
.dbline 0 ; func end
ld R11,y+
ld R10,y+
ret
.dbsym r s 10 pc
.dbend
.dbfunc e UART1_PutBytes _UART1_PutBytes fV
; i -> R10
; ilen -> R14
; s -> R12,R13
.even
_UART1_PutBytes::
xcall push_xgset00FC
mov R14,R18
movw R12,R16
.dbline -1
.dbline 55
; }
;
; //串口输出字节
; void UART1_PutBytes(unsigned char *s, unsigned char ilen)
; {
.dbline 58
; unsigned char i;
;
; for(i=0;i<ilen;i++)
clr R10
xjmp L17
L14:
.dbline 59
; {
.dbline 60
; UART1_PutChar(*s++);
movw R30,R12
ld R16,Z+
movw R12,R30
xcall _UART1_PutChar
.dbline 61
; }
L15:
.dbline 58
inc R10
L17:
.dbline 58
cp R10,R14
brlo L14
X3:
.dbline -2
L13:
.dbline 0 ; func end
xjmp pop_xgset00FC
.dbsym r i 10 c
.dbsym r ilen 14 c
.dbsym r s 12 pc
.dbend
.area bss(ram, con, rel)
.dbfile E:\__test\_RTL8019_M128_struct_Test\Usart1_M128.c
_iNum::
.blkb 2
.dbsym e iNum _iNum i
; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -