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

📄 main.s

📁 ATmega128的GPS例子
💻 S
📖 第 1 页 / 共 4 页
字号:
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	movw R2,R24
	clr R4
	sbrc R3,7
	com R4
	clr R5
	sbrc R4,7
	com R5
	ldi R20,10
	ldi R21,0
	ldi R22,0
	ldi R23,0
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R16,R20
	movw R18,R22
	xcall empy32u
	add R6,R16
	adc R7,R17
	adc R8,R18
	adc R9,R19
	ldi R24,<_sink0_buf+10
	ldi R25,>_sink0_buf+10
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	movw R2,R24
	clr R4
	sbrc R3,7
	com R4
	clr R5
	sbrc R4,7
	com R5
	add R6,R2
	adc R7,R3
	adc R8,R4
	adc R9,R5
	ldi R20,10
	ldi R21,0
	ldi R22,0
	ldi R23,0
	st -y,R9
	st -y,R8
	st -y,R7
	st -y,R6
	movw R16,R20
	movw R18,R22
	xcall empy32u
	ldi R20,60
	ldi R21,0
	ldi R22,0
	ldi R23,0
	st -y,R23
	st -y,R22
	st -y,R21
	st -y,R20
	xcall div32u
	movw R2,R16
	movw R4,R18
	ldi R24,<_sink0_buf+2
	ldi R25,>_sink0_buf+2
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	movw R6,R24
	clr R8
	sbrc R7,7
	com R8
	clr R9
	sbrc R8,7
	com R9
	ldi R20,64
	ldi R21,66
	ldi R22,15
	ldi R23,0
	st -y,R9
	st -y,R8
	st -y,R7
	st -y,R6
	movw R16,R20
	movw R18,R22
	xcall empy32u
	movw R6,R16
	movw R8,R18
	ldi R24,<_sink0_buf+1
	ldi R25,>_sink0_buf+1
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	clr R26
	sbrc R25,7
	com R26
	clr R27
	sbrc R26,7
	com R27
	ldi R20,128
	ldi R21,150
	ldi R22,152
	ldi R23,0
	st -y,R27
	st -y,R26
	st -y,R25
	st -y,R24
	movw R16,R20
	movw R18,R22
	xcall empy32u
	movw R20,R16
	movw R22,R18
	add R20,R6
	adc R21,R7
	adc R22,R8
	adc R23,R9
	add R20,R2
	adc R21,R3
	adc R22,R4
	adc R23,R5
	sts _latitude+1,R21
	sts _latitude,R20
	sts _latitude+2+1,R23
	sts _latitude+2,R22
	.dbline 188
; 						          +(unsigned long)(sink0_buf[n+2]-0x30)*1000000
; 						          +						          
; 						          ((unsigned long)(sink0_buf[n+3]-0x30)*1000000//minuter
; 						          +(unsigned long)(sink0_buf[n+4]-0x30)*100000
; 						          +(unsigned long)(sink0_buf[n+6]-0x30)*10000
; 						          +(unsigned long)(sink0_buf[n+7]-0x30)*1000
; 						          +(unsigned long)(sink0_buf[n+8]-0x30)*100
; 						          +(unsigned long)(sink0_buf[n+9]-0x30)*10
; 						          +(unsigned long)(sink0_buf[n+10]-0x30))*10/60;//换算成度						          
; 						//Hzk_Dis_Data(2,1,latitude,10);
; 					}
L157:
	.dbline 189
; 				}
L155:
	.dbline 190
; 				if(m == 4)
	mov R24,R12
	cpi R24,4
	brne L168
X58:
	.dbline 191
; 				{
	.dbline 193
; 					//"N"
; 				}
L168:
	.dbline 194
; 				if(m == 5)//第五个","后面为精度数据
	mov R24,R12
	cpi R24,5
	breq X72
	xjmp L170
X72:
X59:
	.dbline 195
; 				{
	.dbline 196
; 					if(gps_status == 'A')
	lds R24,_gps_status
	cpi R24,65
	breq X73
	xjmp L172
X73:
X60:
	.dbline 197
; 					{
	.dbline 199
; 						
; 						longitude = //(unsigned long)(sink0_buf[n+1]-0x30)*100000000
	ldi R24,<_sink0_buf+5
	ldi R25,>_sink0_buf+5
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	movw R2,R24
	clr R4
	sbrc R3,7
	com R4
	clr R5
	sbrc R4,7
	com R5
	ldi R20,160
	ldi R21,134
	ldi R22,1
	ldi R23,0
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R16,R20
	movw R18,R22
	xcall empy32u
	movw R2,R16
	movw R4,R18
	ldi R24,<_sink0_buf+4
	ldi R25,>_sink0_buf+4
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	movw R6,R24
	clr R8
	sbrc R7,7
	com R8
	clr R9
	sbrc R8,7
	com R9
	ldi R20,64
	ldi R21,66
	ldi R22,15
	ldi R23,0
	st -y,R9
	st -y,R8
	st -y,R7
	st -y,R6
	movw R16,R20
	movw R18,R22
	xcall empy32u
	movw R6,R16
	movw R8,R18
	add R6,R2
	adc R7,R3
	adc R8,R4
	adc R9,R5
	ldi R24,<_sink0_buf+7
	ldi R25,>_sink0_buf+7
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	movw R2,R24
	clr R4
	sbrc R3,7
	com R4
	clr R5
	sbrc R4,7
	com R5
	ldi R20,16
	ldi R21,39
	ldi R22,0
	ldi R23,0
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R16,R20
	movw R18,R22
	xcall empy32u
	add R6,R16
	adc R7,R17
	adc R8,R18
	adc R9,R19
	ldi R24,<_sink0_buf+8
	ldi R25,>_sink0_buf+8
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	movw R2,R24
	clr R4
	sbrc R3,7
	com R4
	clr R5
	sbrc R4,7
	com R5
	ldi R20,232
	ldi R21,3
	ldi R22,0
	ldi R23,0
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R16,R20
	movw R18,R22
	xcall empy32u
	add R6,R16
	adc R7,R17
	adc R8,R18
	adc R9,R19
	ldi R24,<_sink0_buf+9
	ldi R25,>_sink0_buf+9
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	movw R2,R24
	clr R4
	sbrc R3,7
	com R4
	clr R5
	sbrc R4,7
	com R5
	ldi R20,100
	ldi R21,0
	ldi R22,0
	ldi R23,0
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R16,R20
	movw R18,R22
	xcall empy32u
	add R6,R16
	adc R7,R17
	adc R8,R18
	adc R9,R19
	ldi R24,<_sink0_buf+10
	ldi R25,>_sink0_buf+10
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	movw R2,R24
	clr R4
	sbrc R3,7
	com R4
	clr R5
	sbrc R4,7
	com R5
	ldi R20,10
	ldi R21,0
	ldi R22,0
	ldi R23,0
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R16,R20
	movw R18,R22
	xcall empy32u
	add R6,R16
	adc R7,R17
	adc R8,R18
	adc R9,R19
	ldi R24,<_sink0_buf+11
	ldi R25,>_sink0_buf+11
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	movw R2,R24
	clr R4
	sbrc R3,7
	com R4
	clr R5
	sbrc R4,7
	com R5
	add R6,R2
	adc R7,R3
	adc R8,R4
	adc R9,R5
	ldi R20,10
	ldi R21,0
	ldi R22,0
	ldi R23,0
	st -y,R9
	st -y,R8
	st -y,R7
	st -y,R6
	movw R16,R20
	movw R18,R22
	xcall empy32u
	ldi R20,60
	ldi R21,0
	ldi R22,0
	ldi R23,0
	st -y,R23
	st -y,R22
	st -y,R21
	st -y,R20
	xcall div32u
	movw R2,R16
	movw R4,R18
	ldi R24,<_sink0_buf+3
	ldi R25,>_sink0_buf+3
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	movw R6,R24
	clr R8
	sbrc R7,7
	com R8
	clr R9
	sbrc R8,7
	com R9
	ldi R20,64
	ldi R21,66
	ldi R22,15
	ldi R23,0
	st -y,R9
	st -y,R8
	st -y,R7
	st -y,R6
	movw R16,R20
	movw R18,R22
	xcall empy32u
	movw R6,R16
	movw R8,R18
	ldi R24,<_sink0_buf+2
	ldi R25,>_sink0_buf+2
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R24,z+0
	clr R25
	sbiw R24,48
	clr R26
	sbrc R25,7
	com R26
	clr R27
	sbrc R26,7
	com R27
	ldi R20,128
	ldi R21,150
	ldi R22,152
	ldi R23,0
	st -y,R27
	st -y,R26
	st -y,R25
	st -y,R24
	movw R16,R20
	movw R18,R22
	xcall empy32u
	movw R20,R16
	movw R22,R18
	add R20,R6
	adc R21,R7
	adc R22,R8
	adc R23,R9
	add R20,R2
	adc R21,R3
	adc R22,R4
	adc R23,R5
	sts _longitude+1,R21
	sts _longitude,R20
	sts _longitude+2+1,R23
	sts _longitude+2,R22
	.dbline 212
; 						          +(unsigned long)(sink0_buf[n+2]-0x30)*10000000
; 						          +(unsigned long)(sink0_buf[n+3]-0x30)*1000000
; 						          +
; 						          ((unsigned long)(sink0_buf[n+4]-0x30)*1000000//minuter
; 						          +(unsigned long)(sink0_buf[n+5]-0x30)*100000
; 						          +(unsigned long)(sink0_buf[n+7]-0x30)*10000
; 						          +(unsigned long)(sink0_buf[n+8]-0x30)*1000
; 						          +(unsigned long)(sink0_buf[n+9]-0x30)*100
; 						          +(unsigned long)(sink0_buf[n+10]-0x30)*10
; 						          +(unsigned long)(sink0_buf[n+11]-0x30))*10/60;//换算成度*0.000001						          
; 						//Hzk_Dis_Data(1,1,longitude,10);
; 						
; 					}
L172:
	.dbline 213
; 				}
L170:
	.dbline 214
; 				if(m == 6)
	mov R24,R12
	cpi R24,6
	brne L183
X61:
	.dbline 215
; 				{
	.dbline 217
; 					//"E"
; 				}
L183:
	.dbline 218
; 				if(m == 9)//第九个","后面为精度数据
	mov R24,R12
	cpi R24,9
	breq X74
	xjmp L185
X74:
X62:
	.dbline 219
; 				{
	.dbline 220
; 					gps_date = (sink0_buf[n+1]-0x30)*10 
	ldi R24,<_sink0_buf+1
	ldi R25,>_sink0_buf+1
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	ldi R24,10
	mul R24,R2
	mov R24,R0
	subi R24,224
	ldi R30,<_sink0_buf+2
	ldi R31,>_sink0_buf+2
	mov R26,R10
	clr R27
	add R26,R30
	adc R27,R31
	ld R25,x
	subi R25,48
	add R24,R25
	sts _gps_date,R24
	.dbline 222
; 						       +(sink0_buf[n+2]-0x30);
; 					gps_month = (sink0_buf[n+3]-0x30)*10 
	ldi R24,<_sink0_buf+3
	ldi R25,>_sink0_buf+3
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	ldi R24,10
	mul R24,R2
	mov R24,R0
	subi R24,224
	ldi R30,<_sink0_buf+4
	ldi R31,>_sink0_buf+4
	mov R26,R10
	clr R27
	add R26,R30
	adc R27,R31
	ld R25,x
	subi R25,48
	add R24,R25
	sts _gps_month,R24
	.dbline 224
; 						       +(sink0_buf[n+4]-0x30);
; 				    gps_year = (sink0_buf[n+5]-0x30)*10 
	ldi R24,<_sink0_buf+5
	ldi R25,>_sink0_buf+5
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	ldi R24,10
	mul R24,R2
	mov R24,R0
	subi R24,224
	ldi R30,<_sink0_buf+6
	ldi R31,>_sink0_buf+6
	mov R26,R10
	clr R27
	add R26,R30
	adc R27,R31
	ld R25,x
	subi R25,48
	add R24,R25
	sts _gps_year,R24
	.dbline 226
; 						       +(sink0_buf[n+6]-0x30);
; 				}
L185:
	.dbline 227
; 			}
L148:
	.dbline 228
; 		}
L145:
	.dbline 158
	inc R10
L147:
	.dbline 158
	mov R24,R10
	cpi R24,100
	brsh X75
	xjmp L144
X75:
X63:
	.dbline 230
; 		
; 	}
L137:
	.dbline -2
L136:
	.dbline 0 ; func end
	xjmp pop_xgsetF0FC
	.dbsym r f 14 c
	.dbsym r m 12 c
	.dbsym r n 10 c
	.dbend
	.dbfunc e Get_Area _Get_Area fL
;      area_temp -> y+0
;             y2 -> y+20
;             x2 -> y+16
;             y1 -> y+12
;             x1 -> y+8
	.even
_Get_Area::
	xcall push_arg4
	xcall push_xgsetF000
	sbiw R28,4
	.dbline -1
	.dbline 234
; }
; 
; long Get_Area(long x1,long y1,long x2,long y2)
; {
	.dbline 236
; 	long area_temp;
; 	area_temp = (x2-x1)*(y2+y1)/2;
	ldd R2,y+12
	ldd R3,y+13
	ldd R4,y+14
	ldd R5,y+15
	ldd R6,y+20
	ldd R7,y+21
	ldd R8,y+22
	ldd R9,y+23
	add R6,R2
	adc R7,R3
	adc R8,R4
	adc R9,R5
	ldd R2,y+8
	ldd R3,y+9
	ldd R4,y+10
	ldd R5,y+11
	ldd R16,y+16
	ldd R17,y+17
	ldd R18,y+18
	ldd R19,y+19
	sub R16,R2
	sbc R17,R3
	sbc R18,R4
	sbc R19,R5
	st -y,R9
	st -y,R8
	st -y,R7
	st -y,R6
	xcall empy32s
	ldi R20,2
	ldi R21,0
	ldi R22,0
	ldi R23,0
	st -y,R23
	st -y,R22
	st -y,R21
	st -y,R20
	xcall div32s
	std y+0,R16
	std y+1,R17
	std y+2,R18
	std y+3,R19
	.dbline 237
; 	return area_temp;
	ldd R16,y+0
	ldd R17,y+1
	ldd R18,y+2
	ldd R19,y+3
	.dbline -2
L193:
	.dbline 0 ; func end
	adiw R28,4
	xcall pop_xgsetF000
	adiw R28,4
	ret
	.dbsym l area_temp 0 L
	.dbsym l y2 20 L
	.dbsym l x2 16 L
	.dbsym l y1 12 L
	.dbsym l x1 8 L
	.dbend
	.area bss(ram, con, rel)
	.dbfile D:\SOURCE~1\gps20080503\main.c
_lcd_data2::
	.blkb 4
	.dbfile D:\SOURCE~1\gps20080503\smg12232zk.h
	.dbsym e lcd_data2 _lcd_data2 l
_lcd_data1::
	.blkb 4
	.dbsym e lcd_data1 _lcd_data1 l
_key_dis::
	.blkb 1
	.dbfile D:\SOURCE~1\gps20080503\define.h
	.dbsym e key_dis _key_dis c
_key::
	.blkb 1
	.dbsym e key _key c
_usart_flag::
	.blkb 1
	.dbsym e usart_flag _usart_flag c
_sink0_count::
	.blkb 1
	.dbsym e sink0_count _sink0_count c
_sink0_buf::
	.blkb 100
	.dbsym e sink0_buf _sink0_buf A[100:100]c
_send0_buf::
	.blkb 100
	.dbsym e send0_buf _send0_buf A[100:100]c
_flag_area::
	.blkb 1
	.dbsym e flag_area _flag_area c
_xishu::
	.blkb 4
	.dbsym e xishu _xishu L
_area::
	.blkb 4
	.dbsym e area _area L
_y_dis::
	.blkb 4
	.dbsym e y_dis _y_dis L
_x_dis::
	.blkb 4
	.dbsym e x_dis _x_dis L
_y3_post::
	.blkb 4
	.dbsym e y3_post _y3_post L
_x3_post::
	.blkb 4
	.dbsym e x3_post _x3_post L
_y2_post::
	.blkb 4
	.dbsym e y2_post _y2_post L
_x2_post::
	.blkb 4
	.dbsym e x2_post _x2_post L
_y1_post::
	.blkb 4
	.dbsym e y1_post _y1_post L
_x1_post::
	.blkb 4
	.dbsym e x1_post _x1_post L
_y0_post::
	.blkb 4
	.dbsym e y0_post _y0_post L
_x0_post::
	.blkb 4
	.dbsym e x0_post _x0_post L
_y0_latitude::
	.blkb 4
	.dbsym e y0_latitude _y0_latitude L
_x0_longitude::
	.blkb 4
	.dbsym e x0_longitude _x0_longitude L
_gps_num::
	.blkb 4
	.dbsym e gps_num _gps_num l
_gps_status::
	.blkb 1
	.dbsym e gps_status _gps_status c
_longitude::
	.blkb 4
	.dbsym e longitude _longitude l
_latitude::
	.blkb 4
	.dbsym e latitude _latitude l
_gps_second::
	.blkb 1
	.dbsym e gps_second _gps_second c
_gps_minute::
	.blkb 1
	.dbsym e gps_minute _gps_minute c
_gps_hour::
	.blkb 1
	.dbsym e gps_hour _gps_hour c
_gps_date::
	.blkb 1
	.dbsym e gps_date _gps_date c
_gps_week::
	.blkb 1
	.dbsym e gps_week _gps_week c
_gps_month::
	.blkb 1
	.dbsym e gps_month _gps_month c
_gps_year::
	.blkb 1
	.dbsym e gps_year _gps_year c
_second::
	.blkb 1
	.dbsym e second _second c
_minute::
	.blkb 1
	.dbsym e minute _minute c
_hour::
	.blkb 1
	.dbsym e hour _hour c
_date::
	.blkb 1
	.dbsym e date _date c
_week::
	.blkb 1
	.dbsym e week _week c
_month::
	.blkb 1
	.dbsym e month _month c
_year::
	.blkb 1
	.dbsym e year _year c
_b_temp::
	.blkb 1
	.dbsym e b_temp _b_temp c
_w_temp::
	.blkb 2
	.dbsym e w_temp _w_temp i
_l_temp::
	.blkb 4
	.dbsym e l_temp _l_temp l
	.area data(ram, con, rel)
	.dbfile D:\SOURCE~1\gps20080503\define.h
L91:
	.blkb 19
	.area idata
	.byte 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
	.byte 32,32,0
	.area data(ram, con, rel)
	.dbfile D:\SOURCE~1\gps20080503\define.h
; }
; 
; 

⌨️ 快捷键说明

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