📄 motor_control.lss
字号:
1fc: 5f ef ldi r21, 0xFF ; 255
1fe: 6c e9 ldi r22, 0x9C ; 156
200: 7f ef ldi r23, 0xFF ; 255
202: 8a e1 ldi r24, 0x1A ; 26
204: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
208: 80 e1 ldi r24, 0x10 ; 16
20a: 97 e2 ldi r25, 0x27 ; 39
20c: 20 e9 ldi r18, 0x90 ; 144
20e: 31 e0 ldi r19, 0x01 ; 1
210: f9 01 movw r30, r18
212: 31 97 sbiw r30, 0x01 ; 1
214: f1 f7 brne .-4 ; 0x212 <get_cheese+0x11c>
{
// wait 1/10 ms
_delay_loop_2(((F_CPU) / 4e3) / 10);
__ticks --;
216: 01 97 sbiw r24, 0x01 ; 1
__ticks = 1;
else if (__tmp > 65535)
{
// __ticks = requested delay in 1/10 ms
__ticks = (uint16_t) (__ms * 10.0);
while(__ticks)
218: d9 f7 brne .-10 ; 0x210 <get_cheese+0x11a>
_delay_ms(1000);
motor(0x1a, 0, 0);
21a: 40 e0 ldi r20, 0x00 ; 0
21c: 50 e0 ldi r21, 0x00 ; 0
21e: 60 e0 ldi r22, 0x00 ; 0
220: 70 e0 ldi r23, 0x00 ; 0
222: 8a e1 ldi r24, 0x1A ; 26
224: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
}
228: 0f 90 pop r0
22a: cf 91 pop r28
22c: df 91 pop r29
22e: 1f 91 pop r17
230: 0f 91 pop r16
232: 08 95 ret
00000234 <main>:
void n_second(unsigned char n);
void get_cheese(void);
int main(void)
{
234: 1f 93 push r17
236: cf 93 push r28
238: df 93 push r29
DDRB |= 0xE0;
23a: 87 b3 in r24, 0x17 ; 23
23c: 80 6e ori r24, 0xE0 ; 224
23e: 87 bb out 0x17, r24 ; 23
uartInit();
240: 0e 94 da 04 call 0x9b4 ; 0x9b4 <uartInit>
sensorInit();
244: 0e 94 03 04 call 0x806 ; 0x806 <sensorInit>
timeInit();
248: 0e 94 25 04 call 0x84a ; 0x84a <timeInit>
sei();
24c: 78 94 sei
unsigned char dash_start_time;
get_position();
24e: 0e 94 88 05 call 0xb10 ; 0xb10 <get_position>
get_cheese();
252: 0e 94 7b 00 call 0xf6 ; 0xf6 <get_cheese>
rotate(90, 0);
256: 60 e0 ldi r22, 0x00 ; 0
258: 70 e0 ldi r23, 0x00 ; 0
25a: 8a e5 ldi r24, 0x5A ; 90
25c: 90 e0 ldi r25, 0x00 ; 0
25e: 0e 94 d4 05 call 0xba8 ; 0xba8 <rotate>
dash_start_time = getTime();
262: 0e 94 2e 04 call 0x85c ; 0x85c <getTime>
266: 18 2f mov r17, r24
motor(0x1a, 150, 150);
268: 46 e9 ldi r20, 0x96 ; 150
26a: 50 e0 ldi r21, 0x00 ; 0
26c: 66 e9 ldi r22, 0x96 ; 150
26e: 70 e0 ldi r23, 0x00 ; 0
270: 8a e1 ldi r24, 0x1A ; 26
272: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
get_position();
276: 0e 94 88 05 call 0xb10 ; 0xb10 <get_position>
while((getTime() - dash_start_time) < 6 && (y_loca < Y_DASH_MAX))
27a: c1 2f mov r28, r17
27c: d0 e0 ldi r29, 0x00 ; 0
27e: 02 c0 rjmp .+4 ; 0x284 <main+0x50>
get_position();
280: 0e 94 88 05 call 0xb10 ; 0xb10 <get_position>
dash_start_time = getTime();
motor(0x1a, 150, 150);
get_position();
while((getTime() - dash_start_time) < 6 && (y_loca < Y_DASH_MAX))
284: 0e 94 2e 04 call 0x85c ; 0x85c <getTime>
288: 90 e0 ldi r25, 0x00 ; 0
28a: 8c 1b sub r24, r28
28c: 9d 0b sbc r25, r29
28e: 06 97 sbiw r24, 0x06 ; 6
290: 3c f4 brge .+14 ; 0x2a0 <main+0x6c>
292: 80 91 9e 00 lds r24, 0x009E
296: 90 91 9f 00 lds r25, 0x009F
29a: 88 55 subi r24, 0x58 ; 88
29c: 9b 41 sbci r25, 0x1B ; 27
29e: 84 f3 brlt .-32 ; 0x280 <main+0x4c>
get_position();
motor(0x1a, 0, 0);
2a0: 40 e0 ldi r20, 0x00 ; 0
2a2: 50 e0 ldi r21, 0x00 ; 0
2a4: 60 e0 ldi r22, 0x00 ; 0
2a6: 70 e0 ldi r23, 0x00 ; 0
2a8: 8a e1 ldi r24, 0x1A ; 26
2aa: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
rotate(180, 0);
2ae: 60 e0 ldi r22, 0x00 ; 0
2b0: 70 e0 ldi r23, 0x00 ; 0
2b2: 84 eb ldi r24, 0xB4 ; 180
2b4: 90 e0 ldi r25, 0x00 ; 0
2b6: 0e 94 d4 05 call 0xba8 ; 0xba8 <rotate>
motor(0x1a, -100, -100);
2ba: 4c e9 ldi r20, 0x9C ; 156
2bc: 5f ef ldi r21, 0xFF ; 255
2be: 6c e9 ldi r22, 0x9C ; 156
2c0: 7f ef ldi r23, 0xFF ; 255
2c2: 8a e1 ldi r24, 0x1A ; 26
2c4: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
2c8: 02 c0 rjmp .+4 ; 0x2ce <main+0x9a>
while(!(Left_backward_straight == 0 || Right_backward_straight == 0))get_sensor();
2ca: 0e 94 e3 03 call 0x7c6 ; 0x7c6 <get_sensor>
2ce: 80 91 68 00 lds r24, 0x0068
2d2: 83 ff sbrs r24, 3
2d4: 04 c0 rjmp .+8 ; 0x2de <main+0xaa>
2d6: 80 91 67 00 lds r24, 0x0067
2da: 83 fd sbrc r24, 3
2dc: f6 cf rjmp .-20 ; 0x2ca <main+0x96>
// Get to the bar
if(Left_backward_straight == 0 && Right_forward_straight != 0)
2de: 80 91 68 00 lds r24, 0x0068
2e2: 83 fd sbrc r24, 3
2e4: 13 c0 rjmp .+38 ; 0x30c <main+0xd8>
2e6: 80 91 68 00 lds r24, 0x0068
2ea: 87 ff sbrs r24, 7
2ec: 0f c0 rjmp .+30 ; 0x30c <main+0xd8>
{
motor(0x1a, 0, -40);
2ee: 48 ed ldi r20, 0xD8 ; 216
2f0: 5f ef ldi r21, 0xFF ; 255
2f2: 60 e0 ldi r22, 0x00 ; 0
2f4: 70 e0 ldi r23, 0x00 ; 0
2f6: 8a e1 ldi r24, 0x1A ; 26
2f8: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
2fc: 02 c0 rjmp .+4 ; 0x302 <main+0xce>
while(Right_backward_straight != 0)
get_sensor();
2fe: 0e 94 e3 03 call 0x7c6 ; 0x7c6 <get_sensor>
// Get to the bar
if(Left_backward_straight == 0 && Right_forward_straight != 0)
{
motor(0x1a, 0, -40);
while(Right_backward_straight != 0)
302: 80 91 67 00 lds r24, 0x0067
306: 83 fd sbrc r24, 3
308: fa cf rjmp .-12 ; 0x2fe <main+0xca>
30a: 16 c0 rjmp .+44 ; 0x338 <main+0x104>
get_sensor();
motor(0x1a, 0, 0);
}
else if(Right_backward_straight == 0 && Left_backward_straight != 0)
30c: 80 91 67 00 lds r24, 0x0067
310: 83 fd sbrc r24, 3
312: 12 c0 rjmp .+36 ; 0x338 <main+0x104>
314: 80 91 68 00 lds r24, 0x0068
318: 83 ff sbrs r24, 3
31a: 0e c0 rjmp .+28 ; 0x338 <main+0x104>
{
motor(0x1a, -40, 0);
31c: 40 e0 ldi r20, 0x00 ; 0
31e: 50 e0 ldi r21, 0x00 ; 0
320: 68 ed ldi r22, 0xD8 ; 216
322: 7f ef ldi r23, 0xFF ; 255
324: 8a e1 ldi r24, 0x1A ; 26
326: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
32a: 02 c0 rjmp .+4 ; 0x330 <main+0xfc>
while(Left_backward_straight != 0)
get_sensor();
32c: 0e 94 e3 03 call 0x7c6 ; 0x7c6 <get_sensor>
motor(0x1a, 0, 0);
}
else if(Right_backward_straight == 0 && Left_backward_straight != 0)
{
motor(0x1a, -40, 0);
while(Left_backward_straight != 0)
330: 80 91 68 00 lds r24, 0x0068
334: 83 fd sbrc r24, 3
336: fa cf rjmp .-12 ; 0x32c <main+0xf8>
get_sensor();
motor(0x1a, 0, 0);
}
else
motor(0x1a, 0, 0);
338: 40 e0 ldi r20, 0x00 ; 0
33a: 50 e0 ldi r21, 0x00 ; 0
33c: 60 e0 ldi r22, 0x00 ; 0
33e: 70 e0 ldi r23, 0x00 ; 0
340: 8a e1 ldi r24, 0x1A ; 26
342: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
346: 88 e8 ldi r24, 0x88 ; 136
348: 93 e1 ldi r25, 0x13 ; 19
34a: 20 e9 ldi r18, 0x90 ; 144
34c: 31 e0 ldi r19, 0x01 ; 1
34e: f9 01 movw r30, r18
350: 31 97 sbiw r30, 0x01 ; 1
352: f1 f7 brne .-4 ; 0x350 <main+0x11c>
{
// wait 1/10 ms
_delay_loop_2(((F_CPU) / 4e3) / 10);
__ticks --;
354: 01 97 sbiw r24, 0x01 ; 1
__ticks = 1;
else if (__tmp > 65535)
{
// __ticks = requested delay in 1/10 ms
__ticks = (uint16_t) (__ms * 10.0);
while(__ticks)
356: d9 f7 brne .-10 ; 0x34e <main+0x11a>
// The mission ends.
_delay_ms(500);
motor(0x1a, 100, 100);
358: 44 e6 ldi r20, 0x64 ; 100
35a: 50 e0 ldi r21, 0x00 ; 0
35c: 64 e6 ldi r22, 0x64 ; 100
35e: 70 e0 ldi r23, 0x00 ; 0
360: 8a e1 ldi r24, 0x1A ; 26
362: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
get_position();
while(x_loca > 2700)
get_position();
366: 0e 94 88 05 call 0xb10 ; 0xb10 <get_position>
motor(0x1a, 100, 100);
get_position();
while(x_loca > 2700)
36a: 80 91 a1 00 lds r24, 0x00A1
36e: 90 91 a2 00 lds r25, 0x00A2
372: 8d 58 subi r24, 0x8D ; 141
374: 9a 40 sbci r25, 0x0A ; 10
376: bc f7 brge .-18 ; 0x366 <main+0x132>
get_position();
motor(0x1a, 0, 0);
378: 40 e0 ldi r20, 0x00 ; 0
37a: 50 e0 ldi r21, 0x00 ; 0
37c: 60 e0 ldi r22, 0x00 ; 0
37e: 70 e0 ldi r23, 0x00 ; 0
380: 8a e1 ldi r24, 0x1A ; 26
382: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
rotate(270, 0);
386: 60 e0 ldi r22, 0x00 ; 0
388: 70 e0 ldi r23, 0x00 ; 0
38a: 8e e0 ldi r24, 0x0E ; 14
38c: 91 e0 ldi r25, 0x01 ; 1
38e: 0e 94 d4 05 call 0xba8 ; 0xba8 <rotate>
motor(0x1a, -100, -100);
392: 4c e9 ldi r20, 0x9C ; 156
394: 5f ef ldi r21, 0xFF ; 255
396: 6c e9 ldi r22, 0x9C ; 156
398: 7f ef ldi r23, 0xFF ; 255
39a: 8a e1 ldi r24, 0x1A ; 26
39c: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
get_sensor();
while(!(Left_backward_straight == 0 && Right_backward_straight == 0))
get_sensor();
3a0: 0e 94 e3 03 call 0x7c6 ; 0x7c6 <get_sensor>
motor(0x1a, -100, -100);
get_sensor();
while(!(Left_backward_straight == 0 && Right_backward_straight == 0))
3a4: 80 91 68 00 lds r24, 0x0068
3a8: 83 fd sbrc r24, 3
3aa: fa cf rjmp .-12 ; 0x3a0 <main+0x16c>
3ac: 80 91 67 00 lds r24, 0x0067
3b0: 83 fd sbrc r24, 3
3b2: f6 cf rjmp .-20 ; 0x3a0 <main+0x16c>
get_sensor();
// Get to the bar
if(Left_backward_straight == 0 && Right_forward_straight != 0)
3b4: 80 91 68 00 lds r24, 0x0068
3b8: 83 fd sbrc r24, 3
3ba: 13 c0 rjmp .+38 ; 0x3e2 <main+0x1ae>
3bc: 80 91 68 00 lds r24, 0x0068
3c0: 87 ff sbrs r24, 7
3c2: 0f c0 rjmp .+30 ; 0x3e2 <main+0x1ae>
{
motor(0x1a, 0, -40);
3c4: 48 ed ldi r20, 0xD8 ; 216
3c6: 5f ef ldi r21, 0xFF ; 255
3c8: 60 e0 ldi r22, 0x00 ; 0
3ca: 70 e0 ldi r23, 0x00 ; 0
3cc: 8a e1 ldi r24, 0x1A ; 26
3ce: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
3d2: 02 c0 rjmp .+4 ; 0x3d8 <main+0x1a4>
while(Right_backward_straight != 0)
get_sensor();
3d4: 0e 94 e3 03 call 0x7c6 ; 0x7c6 <get_sensor>
// Get to the bar
if(Left_backward_straight == 0 && Right_forward_straight != 0)
{
motor(0x1a, 0, -40);
while(Right_backward_straight != 0)
3d8: 80 91 67 00 lds r24, 0x0067
3dc: 83 fd sbrc r24, 3
3de: fa cf rjmp .-12 ; 0x3d4 <main+0x1a0>
3e0: 16 c0 rjmp .+44 ; 0x40e <main+0x1da>
get_sensor();
motor(0x1a, 0, 0);
}
else if(Right_backward_straight == 0 && Left_backward_straight != 0)
3e2: 80 91 67 00 lds r24, 0x0067
3e6: 83 fd sbrc r24, 3
3e8: 12 c0 rjmp .+36 ; 0x40e <main+0x1da>
3ea: 80 91 68 00 lds r24, 0x0068
3ee: 83 ff sbrs r24, 3
3f0: 0e c0 rjmp .+28 ; 0x40e <main+0x1da>
{
motor(0x1a, -40, 0);
3f2: 40 e0 ldi r20, 0x00 ; 0
3f4: 50 e0 ldi r21, 0x00 ; 0
3f6: 68 ed ldi r22, 0xD8 ; 216
3f8: 7f ef ldi r23, 0xFF ; 255
3fa: 8a e1 ldi r24, 0x1A ; 26
3fc: 0e 94 a5 03 call 0x74a ; 0x74a <motor>
400: 02 c0 rjmp .+4 ; 0x406 <main+0x1d2>
while(Left_backward_straight != 0)
get_sensor();
402: 0e 94 e3 03 call 0x7c6 ; 0x7c6 <get_sensor>
motor(0x1a, 0, 0);
}
else if(Right_backward_straight == 0 && Left_backward_straight != 0)
{
motor(0x1a, -40, 0);
while(Left_backward_straight != 0)
406: 80 91 68 00 lds r24, 0x0068
40a: 83 fd sbrc r24, 3
40c: fa cf rjmp .-12 ; 0x402 <main+0x1ce>
get_sensor();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -