📄 main.s
字号:
cli
.dbline 56
; port_init();
xcall _port_init
.dbline 57
; uart0_init();
xcall _uart0_init
.dbline 59
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 60
; GICR = 0x00;
out 0x3b,R2
.dbline 61
; TIMSK = 0x00; //timer interrupt sources
out 0x39,R2
.dbline 62
; SEI(); //re-enable interrupts
sei
.dbline -2
L10:
.dbline 0 ; func end
ret
.dbend
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\main.c
_temp_char0::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\main.c
.dbsym e temp_char0 _temp_char0 c
.area vector(rom, abs)
.org 44
jmp _uart0_rx_isr
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\main.c
.area text(rom, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\main.c
.dbfunc e uart0_rx_isr _uart0_rx_isr fV
; temp -> R16
.even
_uart0_rx_isr::
st -y,R16
st -y,R24
in R16,0x3f
st -y,R16
.dbline -1
.dbline 69
; //all peripherals are now initialized
; }
;
; extern uchar temp_char0=0;
; #pragma interrupt_handler uart0_rx_isr:iv_USART0_RXC
; void uart0_rx_isr(void)
; {
.dbline 73
; //uart has received a character in UDR
; //uchar temp_char0;
; unsigned char temp;
; temp=UDR;
in R16,0xc
.dbline 74
; temp_char0 = temp;
sts _temp_char0,R16
.dbline 75
; if(temp_char0 == 'C')
cpi R16,67
brne L12
X0:
.dbline 76
; { //检测是否收到 C
.dbline 77
; receive_C = 1;
ldi R24,1
sts _receive_C,R24
.dbline 79
;
; }
L12:
.dbline 80
; if(temp_char0 == '>')
lds R24,_temp_char0
cpi R24,62
brne L14
X1:
.dbline 81
; { //检测是否收到 >
.dbline 82
; receive_DAYUHAO = 1;
ldi R24,1
sts _receive_DAYUHAO,R24
.dbline 83
; }
L14:
.dbline 84
; if(temp_char0 == 'K')
lds R24,_temp_char0
cpi R24,75
brne L16
X2:
.dbline 85
; { //检测是否收到 >
.dbline 86
; receive_OK = 1;
ldi R24,1
sts _receive_OK,R24
.dbline 87
; }
L16:
.dbline 88
; if(temp_char0 == '1')
lds R24,_temp_char0
cpi R24,49
brne L18
X3:
.dbline 89
; { //检测是否收到 >
.dbline 90
; receive_MMSTRACE = 1;
ldi R24,1
sts _receive_MMSTRACE,R24
.dbline 91
; }
L18:
.dbline 92
; if(temp_char0 == 'U')
lds R24,_temp_char0
cpi R24,85
brne L20
X4:
.dbline 93
; { //检测是否收到 >
.dbline 94
; receive_DOWNFINE = 1;
ldi R24,1
sts _receive_DOWNFINE,R24
.dbline 95
; }
L20:
.dbline -2
L11:
.dbline 0 ; func end
ld R16,y+
out 0x3f,R16
ld R24,y+
ld R16,y+
reti
.dbsym r temp 16 c
.dbend
.dbfunc e main _main fV
; i -> R20,R21
.even
_main::
.dbline -1
.dbline 120
;
; /*if (/*(temp_char0 == CHARGE_LINE)|| (temp_char0 == ENTER))
; {
; do_serial_data(receive_sp); //收到回车,接收指针归零 ,并处理接收数据
; receive_sp = 0;
; }
; else
; {
; receive_data[receive_sp++] =temp;
; }
; if (receive_sp > 40) //接收超长,接收指针规零
; receive_sp = 0;*/
;
; }
;
;
;
;
;
; /*********************************************************************
;
; *********************************************************************/
;
; void main(void)
; {
.dbline 123
; int i;
;
; init_devices();
xcall _init_devices
.dbline 125
;
; for(i = 0; i< STRING_LENGTH ; i++) //清接收缓存//40
clr R20
clr R21
L23:
.dbline 126
; {
.dbline 127
; receive_data[i] = 0;
ldi R24,<_receive_data
ldi R25,>_receive_data
movw R30,R20
add R30,R24
adc R31,R25
clr R2
std z+0,R2
.dbline 128
; }
L24:
.dbline 125
subi R20,255 ; offset = 1
sbci R21,255
.dbline 125
cpi R20,40
ldi R30,0
cpc R21,R30
brlt L23
X5:
.dbline 129
; receive_sp = 0;
clr R2
clr R3
sts _receive_sp+1,R3
sts _receive_sp,R2
.dbline 131
;
; receive_OK = 0;
sts _receive_OK,R2
.dbline 132
; send_a_byte(ENTER); //发送回车,测试模块
ldi R16,13
xcall _send_a_byte
.dbline 133
; Delay(500);
ldi R16,500
ldi R17,1
xcall _Delay
.dbline 135
;
; receive_OK = 0;
clr R2
sts _receive_OK,R2
.dbline 136
; send_m_byte("at\r\n",4); //发送AT,测试模块
ldi R18,4
ldi R19,0
ldi R16,<L27
ldi R17,>L27
xcall _send_m_byte
.dbline 137
; send_a_byte(ENTER);
ldi R16,13
xcall _send_a_byte
L28:
.dbline 139
;
; while(receive_OK== 0);
L29:
.dbline 139
lds R2,_receive_OK
tst R2
breq L28
X6:
.dbline 141
;
; Xmodem();
xcall _Xmodem
.dbline 142
; Delay(10);
ldi R16,10
ldi R17,0
xcall _Delay
.dbline 143
; mms_atsent();
xcall _mms_atsent
.dbline -2
L22:
.dbline 0 ; func end
ret
.dbsym r i 20 I
.dbend
.dbfunc e send_a_byte _send_a_byte fV
; data -> R16
.even
_send_a_byte::
.dbline -1
.dbline 149
;
; }
;
;
; void send_a_byte( unsigned char data )
; {
L32:
.dbline 152
; /* 等待发送缓冲器为空 */
; while ( !( UCSRA & (1<<UDRE)) )
; ;
L33:
.dbline 151
sbis 0xb,5
rjmp L32
X7:
.dbline 154
; /* 将数据放入缓冲器,发送数据 */
; UDR = data;
out 0xc,R16
.dbline -2
L31:
.dbline 0 ; func end
ret
.dbsym r data 16 c
.dbend
.dbfunc e send_m_byte _send_m_byte fV
; i -> R20,R21
; length -> R10,R11
; string -> R12,R13
.even
_send_m_byte::
xcall push_xgset303C
movw R10,R18
movw R12,R16
.dbline -1
.dbline 159
; }
;
;
; void send_m_byte(uchar *string, uint length)
; {
.dbline 161
; uint i; //发送多字节
; for(i = 0; i< length; i++)
clr R20
clr R21
xjmp L39
L36:
.dbline 162
; {
.dbline 163
; send_a_byte(string[i]);
movw R30,R20
add R30,R12
adc R31,R13
ldd R16,z+0
xcall _send_a_byte
.dbline 164
; }
L37:
.dbline 161
subi R20,255 ; offset = 1
sbci R21,255
L39:
.dbline 161
cp R20,R10
cpc R21,R11
brlo L36
X8:
.dbline -2
L35:
.dbline 0 ; func end
xjmp pop_xgset303C
.dbsym r i 20 i
.dbsym r length 10 i
.dbsym r string 12 pc
.dbend
.dbfunc e intDelay _intDelay fV
; i -> R16,R17
.even
_intDelay::
.dbline -1
.dbline 173
; }
;
; /*
; *************************************
; *延时子程序,延时约10×i机器周期 *
; *************************************/
;
; void intDelay(uint i)
; {
L41:
.dbline 174
; while(i--);
L42:
.dbline 174
movw R2,R16
subi R16,1
sbci R17,0
tst R2
brne L41
tst R3
brne L41
X9:
.dbline -2
L40:
.dbline 0 ; func end
ret
.dbsym r i 16 i
.dbend
.dbfunc e Delay _Delay fV
; i -> R20
; Delay_MS -> R16,R17
.even
_Delay::
st -y,R20
.dbline -1
.dbline 180
; }
;
;
; //1MS的延时
; void Delay(unsigned int Delay_MS)
; {
xjmp L46
L45:
.dbline 183
; unsigned char i;
; while(Delay_MS--)
; {
.dbline 184
; for(i=0;i<111;i++);
clr R20
xjmp L51
L48:
.dbline 184
L49:
.dbline 184
inc R20
L51:
.dbline 184
cpi R20,111
brlo L48
X10:
.dbline 185
; }
L46:
.dbline 182
movw R2,R16
subi R16,1
sbci R17,0
tst R2
brne L45
tst R3
brne L45
X11:
.dbline -2
L44:
.dbline 0 ; func end
ld R20,y+
ret
.dbsym r i 20 c
.dbsym r Delay_MS 16 i
.dbend
.dbfunc e sendcmd _sendcmd fV
; by_Array -> R16,R17
.even
_sendcmd::
.dbline -1
.dbline 189
; }
;
; void sendcmd(unsigned char *by_Array)
; {
xjmp L54
L56:
.dbline 192
; while(*by_Array)
; {
; while (!( UCSRA & (1<<UDRE)));
L57:
.dbline 192
sbis 0xb,5
rjmp L56
X12:
.dbline 193
; UDR=*by_Array;
movw R30,R16
ldd R2,z+0
out 0xc,R2
.dbline 194
; by_Array++;
subi R16,255 ; offset = 1
sbci R17,255
.dbline 195
; }
L54:
.dbline 190
movw R30,R16
ldd R2,z+0
tst R2
brne L57
X13:
.dbline -2
L52:
.dbline 0 ; func end
ret
.dbsym r by_Array 16 pc
.dbend
.dbfunc e mms_atsent _mms_atsent fV
.even
_mms_atsent::
.dbline -1
.dbline 198
; }
; void mms_atsent(void)
; {
.dbline 199
; receive_OK=0;
clr R2
sts _receive_OK,R2
.dbline 200
; sendcmd("AT$MMSW=0\r\n") ;
ldi R16,<L60
ldi R17,>L60
xcall _sendcmd
L61:
.dbline 201
; while(receive_OK==0) ;
L62:
.dbline 201
lds R2,_receive_OK
tst R2
breq L61
X14:
.dbline 202
; Delay(10);
ldi R16,10
ldi R17,0
xcall _Delay
.dbline 204
;
; receive_DAYUHAO=0;
clr R2
sts _receive_DAYUHAO,R2
.dbline 205
; sendcmd("AT$MMSW=1,1\r\n") ;
ldi R16,<L64
ldi R17,>L64
xcall _sendcmd
L65:
.dbline 206
; while(receive_DAYUHAO==0) ;
L66:
.dbline 206
lds R2,_receive_DAYUHAO
tst R2
breq L65
X15:
.dbline 207
; receive_OK=0;
clr R2
sts _receive_OK,R2
.dbline 208
; sendcmd(dial_number);
ldi R16,<_dial_number
ldi R17,>_dial_number
xcall _sendcmd
.dbline 209
; send_a_byte(ctrl_z);
ldi R16,26
xcall _send_a_byte
L68:
.dbline 210
; while(receive_OK==0) ;
L69:
.dbline 210
lds R2,_receive_OK
tst R2
breq L68
X16:
.dbline 211
; Delay(10);
ldi R16,10
ldi R17,0
xcall _Delay
.dbline 213
;
; receive_DAYUHAO=0;
clr R2
sts _receive_DAYUHAO,R2
.dbline 214
; sendcmd("AT$MMSW=4,1\r\n");
ldi R16,<L71
ldi R17,>L71
xcall _sendcmd
L72:
.dbline 215
; while(receive_DAYUHAO==0) ;
L73:
.dbline 215
lds R2,_receive_DAYUHAO
tst R2
breq L72
X17:
.dbline 216
; receive_OK=0;
clr R2
sts _receive_OK,R2
.dbline 217
; sendcmd(subject);
ldi R16,<_subject
ldi R17,>_subject
xcall _sendcmd
.dbline 218
; send_a_byte(ctrl_z);
ldi R16,26
xcall _send_a_byte
L75:
.dbline 219
; while(receive_OK==0) ;
L76:
.dbline 219
lds R2,_receive_OK
tst R2
breq L75
X18:
.dbline 220
; Delay(10);
ldi R16,10
ldi R17,0
xcall _Delay
.dbline 222
;
; receive_DAYUHAO=0;
clr R2
sts _receive_DAYUHAO,R2
.dbline 223
; sendcmd("AT$MMSW=5,1,1\r\n");
ldi R16,<L78
ldi R17,>L78
xcall _sendcmd
L79:
.dbline 224
; while(receive_DAYUHAO==0) ;
L80:
.dbline 224
lds R2,_receive_DAYUHAO
tst R2
breq L79
X19:
.dbline 225
; receive_OK=0;
clr R2
sts _receive_OK,R2
.dbline 226
; sendcmd("mypicture");
ldi R16,<L82
ldi R17,>L82
xcall _sendcmd
.dbline 227
; send_a_byte(ctrl_z);
ldi R16,26
xcall _send_a_byte
L83:
.dbline 228
; while(receive_OK==0) ;
L84:
.dbline 228
lds R2,_receive_OK
tst R2
breq L83
X20:
.dbline 229
; Delay(10);
ldi R16,10
ldi R17,0
xcall _Delay
.dbline 231
;
; receive_OK=0;
clr R2
sts _receive_OK,R2
.dbline 232
; sendcmd("AT$MMSW=6,1,\"test.jpg\"\r\n");
ldi R16,<L86
ldi R17,>L86
xcall _sendcmd
L87:
.dbline 233
; while(receive_OK==0) ;
L88:
.dbline 233
lds R2,_receive_OK
tst R2
breq L87
X21:
.dbline 234
; Delay(10);
ldi R16,10
ldi R17,0
xcall _Delay
.dbline 236
;
; receive_OK=0;
clr R2
sts _receive_OK,R2
.dbline 237
; sendcmd("AT$MMSSEND\r\n");
ldi R16,<L90
ldi R17,>L90
xcall _sendcmd
L91:
.dbline 238
; while(receive_OK==0) ;
L92:
.dbline 238
lds R2,_receive_OK
tst R2
breq L91
X22:
.dbline 239
; Delay(10);
ldi R16,10
ldi R17,0
xcall _Delay
.dbline 241
;
; receive_MMSTRACE=0;
clr R2
sts _receive_MMSTRACE,R2
L94:
.dbline 242
; while(receive_MMSTRACE==0) ;
L95:
.dbline 242
lds R2,_receive_MMSTRACE
tst R2
breq L94
X23:
.dbline 244
;
; receive_OK=0;
clr R2
sts _receive_OK,R2
.dbline 245
; sendcmd(deletmms);
ldi R16,<_deletmms
ldi R17,>_deletmms
xcall _sendcmd
L97:
.dbline 246
; while(receive_OK==0) ;
L98:
.dbline 246
lds R2,_receive_OK
tst R2
breq L97
X24:
.dbline -2
L59:
.dbline 0 ; func end
ret
.dbend
.area bss(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\main.c
_receive_data::
.blkb 40
.dbsym e receive_data _receive_data A[40:40]c
_receive_RING::
.blkb 1
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
.dbsym e receive_RING _receive_RING c
_receive_MMSTRACE::
.blkb 1
.dbsym e receive_MMSTRACE _receive_MMSTRACE c
_receive_ERROR::
.blkb 1
.dbsym e receive_ERROR _receive_ERROR c
_receive_DOWNFINEOK::
.blkb 1
.dbsym e receive_DOWNFINEOK _receive_DOWNFINEOK c
_receive_DOWNFINE::
.blkb 1
.dbsym e receive_DOWNFINE _receive_DOWNFINE c
_receive_DAYUHAO::
.blkb 1
.dbsym e receive_DAYUHAO _receive_DAYUHAO c
_receive_C::
.blkb 1
.dbsym e receive_C _receive_C c
_receive_other::
.blkb 1
.dbsym e receive_other _receive_other c
_receive_OK::
.blkb 1
.dbsym e receive_OK _receive_OK c
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L90:
.blkb 13
.area idata
.byte 'A,'T,36,'M,'M,'S,'S,'E,'N,'D,13,10,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L86:
.blkb 25
.area idata
.byte 'A,'T,36,'M,'M,'S,'W,61,54,44,49,44,34,'t,'e,'s
.byte 't,46,'j,'p,'g,34,13,10,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L82:
.blkb 10
.area idata
.byte 'm,'y,'p,'i,'c,'t,'u,'r,'e,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L78:
.blkb 16
.area idata
.byte 'A,'T,36,'M,'M,'S,'W,61,53,44,49,44,49,13,10,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L71:
.blkb 14
.area idata
.byte 'A,'T,36,'M,'M,'S,'W,61,52,44,49,13,10,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L64:
.blkb 14
.area idata
.byte 'A,'T,36,'M,'M,'S,'W,61,49,44,49,13,10,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L60:
.blkb 12
.area idata
.byte 'A,'T,36,'M,'M,'S,'W,61,48,13,10,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L27:
.blkb 5
.area idata
.byte 'a,'t,13,10,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L7:
.blkb 5
.area idata
.byte 'R,'I,'N,'G,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L6:
.blkb 13
.area idata
.byte 36,'M,'M,'S,'T,'R,'A,'C,'E,58,32,49,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L5:
.blkb 18
.area idata
.byte 'O,'k,95,'I,'n,'f,'o,95,'F,'i,'l,'e,'C,'l,'o,'s
.byte 'e,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L4:
.blkb 6
.area idata
.byte 'E,'R,'R,'O,'R,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L3:
.blkb 26
.area idata
.byte 'O,'k,95,'I,'n,'f,'o,95,'F,'i,'l,'e,'U,'p,'l,'o
.byte 'a,'d,'S,'t,'a,'r,'t,'e,'d,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L2:
.blkb 3
.area idata
.byte 'O,'K,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
L1:
.blkb 4
.area idata
.byte 'a,'t,36,0
.area data(ram, con, rel)
.dbfile E:\GPRS资料\M16_Xmodem\xmodem.h
;
; }
;
;
;
;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -