单片机开发资料光盘-双龙-686M.zip

源代码在线查看: auto_car1.s

软件大小: 574027 K
上传用户: rllfllef
关键词: 686 zip 单片机 光盘
下载地址: 免注册下载 普通下载 VIP

相关代码

					.module auto_car1.c
					.area text(rom, con, rel)
					.dbfile e:/ICC/include/sl3010.c
					.dbfunc e port_init _port_init fV
					.even
				_port_init::
					.dbline -1
					.dbline 80
				; //自走车   机器人走四方形路线,遥控器调节行走路线
				; #include 
				; #include 
				; #include 
				; 
				; unsigned int delay_time1,delay_time2;
				; 
				; void auto_car1()
				; {
				;  port_init();//PA,PB,PC,PD 初始化
				;  
				;  work_status = 0x51;//置对应的工作状态标志
				;  
				;  delay_time1=510;    //转弯时间
				;  delay_time2=1200;   //前行时间
				;  
				;  mic_startup();//等待声控启动
				; 
				; 	   forward();             //前行
				; 	   delay_ms(200);         
				;  
				;  while(1)
				;       {
				; 	   sw_touch();            //检测轻触开关
				; 	   
				; 	   remote_auto_time();    //遥控器控制直行和转弯时间
				; 	   
				; 	   turn_right();          //右转
				; 	   delay_ms(delay_time1);
				; 	
				; 	   forward();             //前行
				; 	   delay_ms(delay_time2);
				;    
				; 	   turn_right();           //右转
				;        delay_ms(delay_time1);
				; 
				; 	   forward();             //前行
				; 	   delay_ms(delay_time2);
				; 	  }
				; }
				; 
				; void main()
				; {
				;  auto_car1();
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
					.dbline 81
				; }
					ldi R24,255
					out 0x1a,R24
					.dbline 81
					out 0x1b,R24
					.dbline 82
				; }
					ldi R24,128
					out 0x17,R24
					.dbline 82
					ldi R24,255
					out 0x18,R24
					.dbline 83
				; }
					ldi R24,1
					out 0x14,R24
					.dbline 83
					ldi R24,255
					out 0x15,R24
					.dbline 84
				; }
					ldi R24,240
					out 0x11,R24
					.dbline 84
					ldi R24,255
					out 0x12,R24
					.dbline -2
					.dbline 85
				; }
				L1:
					.dbline 0 ; func end
					ret
					.dbend
					.dbfunc e delay_us _delay_us fV
				;           time -> R16,R17
					.even
				_delay_us::
					.dbline -1
					.dbline 88
				; }
				; }
				; }
				L3:
					.dbline 90
				; }
				; }
					.dbline 91
				; }
					subi R16,1
					sbci R17,0
					.dbline 92
				; }
				L4:
					.dbline 93
				; }
					ldi R24,1
					ldi R25,0
					cp R24,R16
					cpc R25,R17
					brlt L3
					.dbline -2
					.dbline 94
				; }
				L2:
					.dbline 0 ; func end
					ret
					.dbsym r time 16 I
					.dbend
					.dbfunc e delay_ms _delay_ms fV
				;           time -> R20,R21
					.even
				_delay_ms::
					rcall push_gset1
					mov R20,R16
					mov R21,R17
					.dbline -1
					.dbline 97
				; }
				; }
				; }
					rjmp L8
				L7:
					.dbline 99
					.dbline 100
					ldi R16,1000
					ldi R17,3
					rcall _delay_us
					.dbline 101
					subi R20,1
					sbci R21,0
					.dbline 102
				L8:
					.dbline 98
				; }
					cpi R20,0
					cpc R20,R21
					brne L7
				X0:
					.dbline -2
					.dbline 103
				; }
				; }
				; }
				; }
				; }
				L6:
					rcall pop_gset1
					.dbline 0 ; func end
					ret
					.dbsym r time 20 i
					.dbend
					.dbfunc e turn_right _turn_right fV
					.even
				_turn_right::
					.dbline -1
					.dbline 106
				; }
				; }
				; }
					.dbline 107
				; }
					ldi R24,96
					out 0x12,R24
					.dbline 108
				; }
					ldi R24,204
					out 0x1b,R24
					.dbline -2
					.dbline 109
				; }
				L10:
					.dbline 0 ; func end
					ret
					.dbend
					.dbfunc e turn_left _turn_left fV
					.even
				_turn_left::
					.dbline -1
					.dbline 112
				; }
				; }
				; }
					.dbline 113
				; }
					ldi R24,144
					out 0x12,R24
					.dbline 114
				; }
					ldi R24,51
					out 0x1b,R24
					.dbline -2
					.dbline 115
				; }
				L11:
					.dbline 0 ; func end
					ret
					.dbend
					.dbfunc e turn_right_s _turn_right_s fV
					.even
				_turn_right_s::
					.dbline -1
					.dbline 117
				; }
				; }
					.dbline 118
				; }
					ldi R24,32
					out 0x12,R24
					.dbline 119
				; }
					ldi R24,207
					out 0x1b,R24
					.dbline -2
					.dbline 120
				; }
				L12:
					.dbline 0 ; func end
					ret
					.dbend
					.dbfunc e turn_left_s _turn_left_s fV
					.even
				_turn_left_s::
					.dbline -1
					.dbline 123
				; }
				; }
				; }
					.dbline 124
				; }
					ldi R24,128
					out 0x12,R24
					.dbline 125
				; }
					ldi R24,243
					out 0x1b,R24
					.dbline -2
					.dbline 126
				; }
				L13:
					.dbline 0 ; func end
					ret
					.dbend
					.dbfunc e backward _backward fV
					.even
				_backward::
					.dbline -1
					.dbline 129
				; }
				; }
				; }
					.dbline 130
				; }
					ldi R24,80
					out 0x12,R24
					.dbline 131
				; }
					ldi R24,60
					out 0x1b,R24
					.dbline -2
					.dbline 132
				; }
				L14:
					.dbline 0 ; func end
					ret
					.dbend
					.dbfunc e forward _forward fV
					.even
				_forward::
					.dbline -1
					.dbline 135
				; }
				; }
				; }
					.dbline 136
				; }
					ldi R24,160
					out 0x12,R24
					.dbline 137
				; }
					ldi R24,195
					out 0x1b,R24
					.dbline -2
					.dbline 138
				; }
				L15:
					.dbline 0 ; func end
					ret
					.dbend
					.dbfunc e stop _stop fV
					.even
				_stop::
					.dbline -1
					.dbline 141
				; }
				; }
				; }
					.dbline 142
				; }
					ldi R24,255
					out 0x12,R24
					.dbline 143
				; }
					out 0x1b,R24
					.dbline -2
					.dbline 144
				; }
				L16:
					.dbline 0 ; func end
					ret
					.dbend
					.dbfunc e sw_touch _sw_touch fV
				;      remote_in -> R22
				;          sw_in -> R20
					.even
				_sw_touch::
					rcall push_gset2
					.dbline -1
					.dbline 160
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
					.dbline 163
				; }
				; }
				; }
					in R20,0x13
					andi R20,16
					.dbline 164
				; }
					brne L18
					.dbline 165
				; }
					.dbline 166
				; }
					rcall _backward
					.dbline 167
				; }
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 169
				; }
				; }
					lds R24,_work_status
					cpi R24,112
					brne L20
					.dbline 170
				; }
					.dbline 171
				; }
					rcall _stop
					rjmp L23
				L22:
					.dbline 173
					.dbline 174
					ldi R24,85
					out 0x1b,R24
					.dbline 175
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 176
					ldi R24,170
					out 0x1b,R24
					.dbline 177
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 178
				L23:
					.dbline 172
				; }
					rjmp L22
				X1:
					.dbline 179
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				L20:
					.dbline 181
				; }
				; }
					rcall _turn_left
					.dbline 182
				; }
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 183
				; }
				L18:
					.dbline 185
				; }
				; }
					in R20,0x16
					andi R20,112
					.dbline 186
				; }
					cpi R20,80
					brne L25
					.dbline 187
				; }
					.dbline 188
				; }
					rcall _forward
					.dbline 189
				; }
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 191
				; }
				; }
					rcall _turn_left
					.dbline 192
				; }
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 193
				; }
				L25:
					.dbline 194
				; }
					cpi R20,48
					brne L27
					.dbline 195
				; }
					.dbline 196
				; }
					rcall _backward
					.dbline 197
				; }
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 199
				; }
				; }
					rcall _turn_left
					.dbline 200
				; }
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 201
				; }
				L27:
					.dbline 202
				; }
					cpi R20,96
					brne L29
					.dbline 203
				; }
					.dbline 204
				; }
					rcall _backward
					.dbline 205
				; }
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 207
				; }
				; }
					rcall _turn_left
					.dbline 208
				; }
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 209
				; }
				L29:
					.dbline 210
				; }
					cpi R20,32
					brne L31
					.dbline 211
				; }
					.dbline 212
				; }
					rcall _stop
					.dbline 213
				; }
					ldi R16,1000
					ldi R17,3
					rcall _delay_ms
					rjmp L34
				L33:
					.dbline 215
				; }
				; }
					.dbline 216
				; }
					in R20,0x13
					andi R20,16
					.dbline 217
				; }
					brne L36
					.dbline 218
				; }
					.dbline 218
					rjmp L35
				L36:
					.dbline 219
				; }
					ldi R24,85
					out 0x1b,R24
					.dbline 220
				; }
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 221
				; }
					ldi R24,170
					out 0x1b,R24
					.dbline 222
				; }
					ldi R16,250
					ldi R17,0
					rcall _delay_ms
					.dbline 223
				; }
					in R22,0x16
					andi R22,15
					.dbline 224
				; }
					breq L38
					.dbline 225
				; }
					.dbline 225
					rjmp L35
				L38:
					.dbline 226
				L34:
					.dbline 214
					rjmp L33
				L35:
					.dbline 227
				L31:
					.dbline -2
					.dbline 228
				; }
				; }
				; }
				L17:
					rcall pop_gset2
					.dbline 0 ; func end
					ret
					.dbsym r remote_in 22 c
					.dbsym r sw_in 20 c
					.dbend
					.dbfunc e mic_startup _mic_startup fV
				;         mic_in -> R16
					.even
				_mic_startup::
					.dbline -1
					.dbline 231
				; }
				; }
				; }
					rjmp L42
				L41:
					.dbline 235
				; }
				; }
				; }
				; }
					.dbline 236
				; }
					in R16,0x13
					andi R16,8
					.dbline 237
				; }
					brne L44
					.dbline 237
					.dbline 237
					rjmp L43
				L44:
					.dbline 238
				L42:
					.dbline 234
					rjmp L41
				L43:
					.dbline -2
					.dbline 239
				; }
				; }
				L40:
					.dbline 0 ; func end
					ret
					.dbsym r mic_in 16 c
					.dbend
					.dbfunc e remote_auto_time _remote_auto_time fV
				;      remote_in -> R16
					.even
				_remote_auto_time::
					.dbline -1
					.dbline 256
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
				; }
					.dbline 258
				; }
				; }
					in R16,0x16
					andi R16,15
					.dbline 259
				; }
					clr R17
					cpi R16,0
					cpc R16,R17
					brne X4
					rjmp L48
				X4:
				X2:
					cpi R16,1
					ldi R30,0
					cpc R17,R30
					brne X5
					rjmp L59
				X5:
					cpi R16,2
					ldi R30,0
					cpc R17,R30
					breq L53
					cpi R16,4
					ldi R30,0
					cpc R17,R30
					breq L50
					cpi R16,8
					ldi R30,0
					cpc R17,R30
					breq L56
					rjmp L47
				X3:
					.dbline 260
				; }
				L50:
					.dbline 262
				; }
				; }
					lds R24,_delay_time2
					lds R25,_delay_time2+1
					sbiw R24,50
					sts _delay_time2+1,R25
					sts _delay_time2,R24
					.dbline 263
				; }
					cpi R24,50
					ldi R30,0
					cpc R25,R30
					breq X6
					rjmp L48
				X6:
					.dbline 264
				; }
					.dbline 264
					ldi R24,100
					ldi R25,0
					sts _delay_time2+1,R25
					sts _delay_time2,R24
					.dbline 264
					.dbline 265
				; }
					rjmp L48
				L53:
					.dbline 267
				; }
				; }
					lds R24,_delay_time1
					lds R25,_delay_time1+1
					adiw R24,50
					sts _delay_time1+1,R25
					sts _delay_time1,R24
					.dbline 268
				; }
					cpi R24,2
					ldi R30,8
					cpc R25,R30
					brne L48
					.dbline 269
				; }
					.dbline 269
					ldi R24,2000
					ldi R25,7
					sts _delay_time1+1,R25
					sts _delay_time1,R24
					.dbline 269
					.dbline 270
				; }
					rjmp L48
				L56:
					.dbline 272
				; }
				; }
					lds R24,_delay_time1
					lds R25,_delay_time1+1
					sbiw R24,50
					sts _delay_time1+1,R25
					sts _delay_time1,R24
					.dbline 273
				; }
					cpi R24,50
					ldi R30,0
					cpc R25,R30
					brne L48
					.dbline 274
				; }
					.dbline 274
					ldi R24,100
					ldi R25,0
					sts _delay_time1+1,R25
					sts _delay_time1,R24
					.dbline 274
					.dbline 275
				; }
					rjmp L48
				L59:
					.dbline 277
				; }
				; }
					lds R24,_delay_time2
					lds R25,_delay_time2+1
					adiw R24,50
					sts _delay_time2+1,R25
					sts _delay_time2,R24
					.dbline 278
				; }
					cpi R24,2
					ldi R30,8
					cpc R25,R30
					brne L48
					.dbline 279
				; }
					.dbline 279
					ldi R24,2000
					ldi R25,7
					sts _delay_time2+1,R25
					sts _delay_time2,R24
					.dbline 279
					.dbline 280
				; }
					.dbline 282
				; }
				; }
				L47:
				L48:
					.dbline -2
					.dbline 284
				; }
				; }
				L46:
					.dbline 0 ; func end
					ret
					.dbsym r remote_in 16 c
					.dbend
					.dbfile E:\icc\iccavr\sl3010\auto_car1\auto_car1.c
					.dbfunc e auto_car1 _auto_car1 fV
					.even
				_auto_car1::
					.dbline -1
					.dbline 9
					.dbline 10
					rcall _port_init
					.dbline 12
					ldi R24,81
					sts _work_status,R24
					.dbline 14
					ldi R24,510
					ldi R25,1
					sts _delay_time1+1,R25
					sts _delay_time1,R24
					.dbline 15
					ldi R24,1200
					ldi R25,4
					sts _delay_time2+1,R25
					sts _delay_time2,R24
					.dbline 17
					rcall _mic_startup
					.dbline 19
					rcall _forward
					.dbline 20
					ldi R16,200
					ldi R17,0
					rcall _delay_ms
					rjmp L65
				L64:
					.dbline 23
					.dbline 24
					rcall _sw_touch
					.dbline 26
					rcall _remote_auto_time
					.dbline 28
					rcall _turn_right
					.dbline 29
					lds R16,_delay_time1
					lds R17,_delay_time1+1
					rcall _delay_ms
					.dbline 31
					rcall _forward
					.dbline 32
					lds R16,_delay_time2
					lds R17,_delay_time2+1
					rcall _delay_ms
					.dbline 34
					rcall _turn_right
					.dbline 35
					lds R16,_delay_time1
					lds R17,_delay_time1+1
					rcall _delay_ms
					.dbline 37
					rcall _forward
					.dbline 38
					lds R16,_delay_time2
					lds R17,_delay_time2+1
					rcall _delay_ms
					.dbline 39
				L65:
					.dbline 22
					rjmp L64
				X7:
					.dbline -2
					.dbline 40
				L63:
					.dbline 0 ; func end
					ret
					.dbend
					.dbfunc e main _main fV
					.even
				_main::
					.dbline -1
					.dbline 43
					.dbline 44
					.dbline -2
					.dbline 45
				L67:
					.dbline 0 ; func end
					rjmp _auto_car1
					.dbend
					.area bss(ram, con, rel)
					.dbfile E:\icc\iccavr\sl3010\auto_car1\auto_car1.c
				_delay_time2::
					.blkb 2
					.dbsym e delay_time2 _delay_time2 i
				_delay_time1::
					.blkb 2
					.dbsym e delay_time1 _delay_time1 i
				_work_status::
					.blkb 1
					.dbfile e:/ICC/include/sl3010.c
					.dbsym e work_status _work_status c
							

相关资源