⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gsb.s

📁 单片机控制GSM22来工作
💻 S
📖 第 1 页 / 共 3 页
字号:
	clr R2
	out 0x18,R2
	.dbline 40
	out 0x17,R2
	.dbline 41
	out 0x15,R2
	.dbline 42
	out 0x14,R2
	.dbline 43
	out 0x12,R2
	.dbline 44
	out 0x11,R2
	.dbline -2
L100:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e usart_init _usart_init fV
	.even
_usart_init::
	.dbline -1
	.dbline 60
	.dbline 61
	clr R2
	out 0xa,R2
	.dbline 62
	out 0xb,R2
	.dbline 63
	ldi R24,134
	out 0x20,R24
	.dbline 64
	ldi R24,3
	out 0x9,R24
	.dbline 65
	out 0x20,R2
	.dbline 66
	ldi R24,152
	out 0xa,R24
	.dbline -2
L101:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e init_devices _init_devices fV
	.even
_init_devices::
	.dbline -1
	.dbline 69
	.dbline 70
	cli
	.dbline 74
	xcall _port_init
	.dbline 75
	xcall _lcd12864_init
	.dbline 76
	xcall _usart_init
	.dbline 77
	sei
	.dbline -2
L102:
	.dbline 0 ; func end
	ret
	.dbend
	.area vector(rom, abs)
	.org 44
	jmp _usart_rx_isr
	.area text(rom, con, rel)
	.dbfile E:\单片机\AVR程序\GSM_M22\gsb.c
	.dbfunc e usart_rx_isr _usart_rx_isr fV
;           temp -> R16
	.even
_usart_rx_isr::
	st -y,R2
	st -y,R16
	st -y,R24
	st -y,R25
	st -y,R30
	st -y,R31
	in R2,0x3f
	st -y,R2
	.dbline -1
	.dbline 83
	.dbline 85
	in R16,0xc
	.dbline 86
	ldi R24,99
	lds R2,_i_Rcv
	cp R24,R2
	brsh L104
	.dbline 87
	.dbline 88
	clr R2
	sts _i_Rcv,R2
	.dbline 89
L104:
	.dbline 90
	cpi R16,13
	breq L106
	cpi R16,10
	breq L106
	.dbline 91
	.dbline 92
	lds R2,_i_Rcv
	sts _flagend,R2
	.dbline 93
	ldi R24,<_Rcv
	ldi R25,>_Rcv
	mov R30,R2
	clr R31
	add R30,R24
	adc R31,R25
	std z+0,R16
	.dbline 94
	lds R24,_i_Rcv
	subi R24,255    ; addi 1
	sts _i_Rcv,R24
	.dbline 95
L106:
	.dbline -2
L103:
	ld R2,y+
	out 0x3f,R2
	ld R31,y+
	ld R30,y+
	ld R25,y+
	ld R24,y+
	ld R16,y+
	ld R2,y+
	.dbline 0 ; func end
	reti
	.dbsym r temp 16 c
	.dbend
	.dbfunc e ISok _ISok fc
;          msure -> R16,R17
	.even
_ISok::
	.dbline -1
	.dbline 101
	.dbline 103
	lds R2,_flagend
	mov R24,R2
	subi R24,1
	cp R2,R24
	brsh L109
	.dbline 104
	.dbline 105
	ldi R24,<_Rcv
	ldi R25,>_Rcv
	mov R30,R2
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	movw R30,R16
	ldd R3,z+1
	cp R2,R3
	brne L111
	movw R30,R16
	ldd R2,z+0
	lds R3,_Rcv+99
	cp R3,R2
	brne L111
	.dbline 106
	ldi R16,1
	xjmp L108
L111:
	.dbline 108
	clr R16
	xjmp L108
L109:
	.dbline 110
	ldi R24,<_Rcv
	ldi R25,>_Rcv
	lds R30,_flagend
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	movw R30,R16
	ldd R3,z+1
	cp R2,R3
	brne L114
	ldi R24,<_Rcv-1
	ldi R25,>_Rcv-1
	lds R30,_flagend
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	movw R30,R16
	ldd R3,z+0
	cp R2,R3
	brne L114
	.dbline 111
	ldi R16,1
	xjmp L108
L114:
	.dbline 113
	clr R16
	.dbline -2
L108:
	.dbline 0 ; func end
	ret
	.dbsym r msure 16 pc
	.dbend
	.dbfunc e USART_Transmit _USART_Transmit fV
;              i -> R20
;              T -> R16,R17
	.even
_USART_Transmit::
	xcall push_gset1
	.dbline -1
	.dbline 117
	.dbline 119
	clr R20
	xjmp L119
X9:
	.dbline 121
L121:
	.dbline 123
L122:
	.dbline 122
	sbis 0xb,5
	rjmp L121
	.dbline 124
	mov R30,R20
	clr R31
	add R30,R16
	adc R31,R17
	ldd R2,z+0
	out 0xc,R2
	.dbline 125
	inc R20
	.dbline 126
L119:
	.dbline 120
	mov R30,R20
	clr R31
	add R30,R16
	adc R31,R17
	ldd R2,z+0
	tst R2
	brne L122
	.dbline -2
L117:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r i 20 c
	.dbsym r T 16 pc
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\单片机\AVR程序\GSM_M22\gsb.c
L125:
	.blkb 2
	.area idata
	.word 0
	.area data(ram, con, rel)
	.dbfile E:\单片机\AVR程序\GSM_M22\gsb.c
	.area text(rom, con, rel)
	.dbfile E:\单片机\AVR程序\GSM_M22\gsb.c
	.dbfunc e sendcmd _sendcmd fV
	.dbsym s i L125 I
;              t -> R20,R21
;          msure -> R22,R23
;        command -> R10,R11
	.even
_sendcmd::
	xcall push_gset3
	movw R22,R18
	movw R10,R16
	sbiw R28,3
	ldd R20,y+9
	ldd R21,y+10
	.dbline -1
	.dbline 131
	xjmp L127
L126:
	.dbline 133
	.dbline 134
	lds R24,L125
	lds R25,L125+1
	adiw R24,1
	sts L125+1,R25
	sts L125,R24
	.dbline 135
	ldi R24,3
	std y+2,R24
	lds R2,L125
	lds R3,L125+1
	std y+1,R3
	std y+0,R2
	clr R18
	ldi R16,1
	xcall _display_Num
	.dbline 136
	movw R16,R10
	xcall _USART_Transmit
	.dbline 137
	movw R16,R20
	xcall _delay_nms
	.dbline 138
L127:
	.dbline 132
	movw R16,R22
	xcall _ISok
	tst R16
	breq L126
	.dbline 139
	clr R2
	clr R3
	sts L125+1,R3
	sts L125,R2
	.dbline -2
L124:
	adiw R28,3
	xcall pop_gset3
	.dbline 0 ; func end
	ret
	.dbsym r t 20 i
	.dbsym r msure 22 pc
	.dbsym r command 10 pc
	.dbend
	.dbfunc e clearf _clearf fV
;              i -> R16
	.even
_clearf::
	.dbline -1
	.dbline 145
	.dbline 147
	lds R16,_flagend
	subi R16,1
	.dbline 148
	lds R2,_flagend
	cp R16,R2
	brsh L130
	.dbline 149
	.dbline 150
	sts _flagend,R16
	.dbline 151
	xjmp L131
L130:
	.dbline 153
	ldi R24,99
	sts _flagend,R24
L131:
	.dbline -2
L129:
	.dbline 0 ; func end
	ret
	.dbsym r i 16 c
	.dbend
	.area lit(rom, con, rel)
L133:
	.byte 'A,'T,43,'C,32,32,32,61,32,32,32,32,32,32,32,13
	.byte 0
	.area text(rom, con, rel)
	.dbfile E:\单片机\AVR程序\GSM_M22\gsb.c
	.dbfunc e read _read fV
;              C -> y+2
;              i -> R20
;            num -> R22,R23
;           porm -> R20,R21
	.even
_read::
	xcall push_gset2
	movw R22,R18
	movw R20,R16
	sbiw R28,19
	.dbline -1
	.dbline 157
	.dbline 158
	ldi R24,<L133
	ldi R25,>L133
	movw R30,R28
	adiw R30,2
	ldi R16,17
	ldi R17,0
	st -y,R31
	st -y,R30
	st -y,R25
	st -y,R24
	xcall asgncblk
	.dbline 160
	clr R2
	sts _i_Rcv,R2
	.dbline 161
	movw R30,R20
	ldd R2,z+0
	std y+6,R2
	.dbline 162
	ldd R2,z+1
	std y+7,R2
	.dbline 163
	movw R30,R20
	ldd R2,z+2
	std y+8,R2
	.dbline 164
	clr R20
	xjmp L140
L137:
	.dbline 165
	.dbline 166
	mov R30,R20
	clr R31
	add R30,R22
	adc R31,R23
	ldd R2,z+0
	movw R24,R28
	adiw R24,10
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	std z+0,R2
	.dbline 167
L138:
	.dbline 164
	inc R20
L140:
	.dbline 164
	cpi R20,7
	brlo L137
	.dbline 169
	ldi R24,3000
	ldi R25,11
	std y+1,R25
	std y+0,R24
	ldi R18,<L142
	ldi R19,>L142
	movw R16,R28
	subi R16,254  ; offset = 2
	sbci R17,255
	xcall _sendcmd
	.dbline 170
	xcall _clearf
	.dbline -2
L132:
	adiw R28,19
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym l C 2 A[17:17]c
	.dbsym r i 20 c
	.dbsym r num 22 pc
	.dbsym r porm 20 pc
	.dbend
	.area lit(rom, con, rel)
L144:
	.byte 'A,'T,43,'C,'M,'G,'S,61,34,32,32,32,32,32,32,32
	.byte 32,32,32,32,34,13,0
	.area text(rom, con, rel)
	.dbfile E:\单片机\AVR程序\GSM_M22\gsb.c
	.dbfunc e sendsms _sendsms fV
;              C -> y+2
;              i -> R20
	.even
_sendsms::
	xcall push_gset1
	sbiw R28,25
	.dbline -1
	.dbline 174
	.dbline 175
	ldi R24,<L144
	ldi R25,>L144
	movw R30,R28
	adiw R30,2
	ldi R16,23
	ldi R17,0
	st -y,R31
	st -y,R30
	st -y,R25
	st -y,R24
	xcall asgncblk
	.dbline 177
	clr R2
	sts _i_Rcv,R2
	.dbline 178
	clr R20
	xjmp L148
L145:
	.dbline 179
	.dbline 180
	ldi R24,<_Phone
	ldi R25,>_Phone
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	movw R24,R28
	adiw R24,11
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	std z+0,R2
	.dbline 181
L146:
	.dbline 178
	inc R20
L148:
	.dbline 178
	cpi R20,11
	brlo L145
	.dbline 182
	ldi R24,500
	ldi R25,1
	std y+1,R25
	std y+0,R24
	ldi R18,<L150
	ldi R19,>L150
	movw R16,R28
	subi R16,254  ; offset = 2
	sbci R17,255
	xcall _sendcmd
	.dbline 183
	xcall _clearf
	.dbline 184
	ldi R24,5000
	ldi R25,19
	std y+1,R25
	std y+0,R24
	ldi R18,<L142
	ldi R19,>L142
	ldi R16,<_Content
	ldi R17,>_Content
	xcall _sendcmd
	.dbline 185
	xcall _clearf
	.dbline -2
L143:
	adiw R28,25
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym l C 2 A[23:23]c
	.dbsym r i 20 c
	.dbend
	.dbfunc e clearline _clearline fV
;              i -> R0
	.even
_clearline::
	.dbline -1
	.dbline 264
;    display(1,0,Phone,0);
;    
;   }
;   key = key_scan();
;   if(key==10)
;   {
;    clearline(0);
;    clearline(1);
;    display_String(0,0,Stc3);
;    display_String(1,0,Stc4);
;    while(key!=15)
;    {
;     key = key_scan();
; 	if(key==1)
; 	{
; 	 sendsms();
; 	}
; 	else if(key==2)
; 	{
; 	 call();
; 	}
;    }
;   }
;  }
;  clearline(0);
;  clearline(1);
; }
; */
; void clearline(uchar i)
; {
	.dbline 265
;  ;
	.dbline -2
L151:
	.dbline 0 ; func end
	ret
	.dbsym l i 0 c
	.dbend
	.dbfunc e main _main fV
	.even
_main::
	sbiw R28,2
	.dbline -1
	.dbline 270
; }
; 
; //主函数
; void main(void)
; {init_devices();
	.dbline 270
	xcall _init_devices
	.dbline 274
;  /*uint i=5,j=65530;
;  
; display_Num(0,0,1-2,5);*/
;  sendcmd("ATE0\r","OK",500);
	ldi R24,500
	ldi R25,1
	std y+1,R25
	std y+0,R24
	ldi R18,<L142
	ldi R19,>L142
	ldi R16,<L153
	ldi R17,>L153
	xcall _sendcmd
	.dbline 275
;  clearf();
	xcall _clearf
	.dbline 276
;  sendcmd("AT+CMGF=1\r","OK",500);
	ldi R24,500
	ldi R25,1
	std y+1,R25
	std y+0,R24
	ldi R18,<L142
	ldi R19,>L142
	ldi R16,<L154
	ldi R17,>L154
	xcall _sendcmd
	.dbline 277
;  clearf();
	xcall _clearf
	.dbline 278
;   display_String(0,0,Stc1);
	ldi R24,<_Stc1
	ldi R25,>_Stc1
	std y+1,R25
	std y+0,R24
	clr R18
	clr R16
	xcall _display_String
	xjmp L156
L155:
	.dbline 280
	.dbline 280
	xcall _sendsms
	.dbline 281
	ldi R16,10000
	ldi R17,39
	xcall _delay_nms
	.dbline 289
L156:
	.dbline 279
	xjmp L155
X10:
	.dbline -2
L152:
	adiw R28,2
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\单片机\AVR程序\GSM_M22\gsb.c
L154:
	.blkb 11
	.area idata
	.byte 'A,'T,43,'C,'M,'G,'F,61,49,13,0
	.area data(ram, con, rel)
	.dbfile E:\单片机\AVR程序\GSM_M22\gsb.c
L153:
	.blkb 6
	.area idata
	.byte 'A,'T,'E,48,13,0
	.area data(ram, con, rel)
	.dbfile E:\单片机\AVR程序\GSM_M22\gsb.c
L150:
	.blkb 3
	.area idata
	.byte 62,32,0
	.area data(ram, con, rel)
	.dbfile E:\单片机\AVR程序\GSM_M22\gsb.c
L142:
	.blkb 3
	.area idata
	.byte 'O,'K,0
	.area data(ram, con, rel)
	.dbfile E:\单片机\AVR程序\GSM_M22\gsb.c
	.area lit(rom, con, rel)
L94:
	.word 0x0,0x4700
L93:
	.word 0x0,0x42c8

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -