📄 motor_control.lss
字号:
67c: 58 f4 brcc .+22 ; 0x694 <__vector_17+0x1dc>
TWDR = TWI_slave_send->string[string_index++];
67e: 01 80 ldd r0, Z+1 ; 0x01
680: f2 81 ldd r31, Z+2 ; 0x02
682: e0 2d mov r30, r0
684: e9 0f add r30, r25
686: f1 1d adc r31, r1
688: 80 81 ld r24, Z
68a: 83 b9 out 0x03, r24 ; 3
68c: 9f 5f subi r25, 0xFF ; 255
68e: 90 93 75 00 sts 0x0075, r25
692: 4e c0 rjmp .+156 ; 0x730 <__vector_17+0x278>
else
TWDR = 0;
694: 13 b8 out 0x03, r1 ; 3
696: 4c c0 rjmp .+152 ; 0x730 <__vector_17+0x278>
(1 << TWIE) | (1 << TWINT) |
(1 << TWEA) | (0 << TWSTA) | (0 << TWSTO) |
(0 << TWWC);
break;
case TWI_STX_DATA_NACK:
*TWI_slave_send->flag = 0;
698: e0 91 71 00 lds r30, 0x0071
69c: f0 91 72 00 lds r31, 0x0072
6a0: 28 c0 rjmp .+80 ; 0x6f2 <__vector_17+0x23a>
(1 << TWEA) | (0 << TWSTA) | (0 << TWSTO) |
(0 << TWWC);
break;
case TWI_SRX_GEN_ACK:
case TWI_SRX_ADR_ACK:
string_index = 0;
6a2: 10 92 75 00 sts 0x0075, r1
*TWI_slave_receive->flag = 0xFF;
6a6: e0 91 73 00 lds r30, 0x0073
6aa: f0 91 74 00 lds r31, 0x0074
6ae: 03 80 ldd r0, Z+3 ; 0x03
6b0: f4 81 ldd r31, Z+4 ; 0x04
6b2: e0 2d mov r30, r0
6b4: 8f ef ldi r24, 0xFF ; 255
6b6: 80 83 st Z, r24
6b8: 3b c0 rjmp .+118 ; 0x730 <__vector_17+0x278>
(1 << TWEA) | (0 << TWSTA) | (0 << TWSTO) |
(0 << TWWC);
break;
case TWI_SRX_ADR_DATA_ACK:
case TWI_SRX_GEN_DATA_ACK:
if (string_index < TWI_slave_receive->length)
6ba: 90 91 75 00 lds r25, 0x0075
6be: e0 91 73 00 lds r30, 0x0073
6c2: f0 91 74 00 lds r31, 0x0074
6c6: 80 81 ld r24, Z
6c8: 98 17 cp r25, r24
6ca: 50 f4 brcc .+20 ; 0x6e0 <__vector_17+0x228>
TWI_slave_receive->string[string_index++] = TWDR;
6cc: 01 80 ldd r0, Z+1 ; 0x01
6ce: f2 81 ldd r31, Z+2 ; 0x02
6d0: e0 2d mov r30, r0
6d2: e9 0f add r30, r25
6d4: f1 1d adc r31, r1
6d6: 83 b1 in r24, 0x03 ; 3
6d8: 80 83 st Z, r24
6da: 9f 5f subi r25, 0xFF ; 255
6dc: 90 93 75 00 sts 0x0075, r25
if (string_index == TWI_slave_receive->length)
6e0: e0 91 73 00 lds r30, 0x0073
6e4: f0 91 74 00 lds r31, 0x0074
6e8: 90 81 ld r25, Z
6ea: 80 91 75 00 lds r24, 0x0075
6ee: 89 17 cp r24, r25
6f0: f9 f4 brne .+62 ; 0x730 <__vector_17+0x278>
*TWI_slave_receive->flag = 0;
6f2: 03 80 ldd r0, Z+3 ; 0x03
6f4: f4 81 ldd r31, Z+4 ; 0x04
6f6: e0 2d mov r30, r0
6f8: 10 82 st Z, r1
6fa: 1a c0 rjmp .+52 ; 0x730 <__vector_17+0x278>
(1 << TWIE) | (1 << TWINT) |
(1 << TWEA) | (0 << TWSTA) | (0 << TWSTO) |
(0 << TWWC);
break;
case TWI_SRX_STOP_RESTART:
*TWI_slave_receive->flag = 0;
6fc: e0 91 73 00 lds r30, 0x0073
700: f0 91 74 00 lds r31, 0x0074
704: 03 80 ldd r0, Z+3 ; 0x03
706: f4 81 ldd r31, Z+4 ; 0x04
708: e0 2d mov r30, r0
70a: 10 82 st Z, r1
TWI_slave_receive = TWI_slave_receive->next;
70c: e0 91 73 00 lds r30, 0x0073
710: f0 91 74 00 lds r31, 0x0074
714: 85 81 ldd r24, Z+5 ; 0x05
716: 96 81 ldd r25, Z+6 ; 0x06
718: 90 93 74 00 sts 0x0074, r25
71c: 80 93 73 00 sts 0x0073, r24
if (TWI_task_current == 0)
720: 80 91 6f 00 lds r24, 0x006F
724: 90 91 70 00 lds r25, 0x0070
728: 89 2b or r24, r25
72a: 11 f0 breq .+4 ; 0x730 <__vector_17+0x278>
(1 << TWIE) | (1 << TWINT) |
(1 << TWEA) | (0 << TWSTA) | (0 << TWSTO) |
(0 << TWWC);
else
TWCR = (1 << TWEN) |
72c: 85 ee ldi r24, 0xE5 ; 229
72e: 01 c0 rjmp .+2 ; 0x732 <__vector_17+0x27a>
case TWI_SRX_ADR_DATA_NACK:
case TWI_SRX_GEN_DATA_NACK:
case TWI_STX_DATA_ACK_LAST_BYTE:
case TWI_BUS_ERROR:
default:
TWCR = (1 << TWEN) |
730: 85 ec ldi r24, 0xC5 ; 197
732: 86 bf out 0x36, r24 ; 54
(1 << TWIE) | (1 << TWINT) |
(1 << TWEA) | (0 << TWSTA) | (0 << TWSTO) |
(0 << TWWC);
break;
}
}
734: ff 91 pop r31
736: ef 91 pop r30
738: 9f 91 pop r25
73a: 8f 91 pop r24
73c: 3f 91 pop r19
73e: 2f 91 pop r18
740: 0f 90 pop r0
742: 0f be out 0x3f, r0 ; 63
744: 0f 90 pop r0
746: 1f 90 pop r1
748: 18 95 reti
0000074a <motor>:
#include "motor.h"
void motor(unsigned char address, short left_speed, short right_speed )
{
74a: ff 92 push r15
74c: 0f 93 push r16
74e: 1f 93 push r17
750: cf 93 push r28
752: df 93 push r29
754: f8 2e mov r15, r24
756: eb 01 movw r28, r22
758: 8a 01 movw r16, r20
static unsigned char TWI_string[5];
volatile static char TWI_flag = 0;
static struct TWI_master_data TWI_data = { 5, TWI_string, &TWI_flag, 0 };
static char time = 0;
char i;
if ( !time ) {
75a: 80 91 76 00 lds r24, 0x0076
75e: 88 23 and r24, r24
760: 49 f4 brne .+18 ; 0x774 <motor+0x2a>
TWI_initialize();
762: 0e 94 18 02 call 0x430 ; 0x430 <TWI_initialize>
TWI_master_initialize( 400 );
766: 80 e9 ldi r24, 0x90 ; 144
768: 91 e0 ldi r25, 0x01 ; 1
76a: 0e 94 1f 02 call 0x43e ; 0x43e <TWI_master_initialize>
time = 1;
76e: 81 e0 ldi r24, 0x01 ; 1
770: 80 93 76 00 sts 0x0076, r24
}
while ( TWI_flag )
774: 80 91 77 00 lds r24, 0x0077
778: 88 23 and r24, r24
77a: e1 f7 brne .-8 ; 0x774 <motor+0x2a>
;
TWI_string[0] = address;
77c: f0 92 78 00 sts 0x0078, r15
TWI_speed.left_right[0] = -left_speed;
780: 88 27 eor r24, r24
782: 99 27 eor r25, r25
784: 8c 1b sub r24, r28
786: 9d 0b sbc r25, r29
788: 90 93 7e 00 sts 0x007E, r25
78c: 80 93 7d 00 sts 0x007D, r24
TWI_speed.left_right[1] = right_speed;
790: 10 93 80 00 sts 0x0080, r17
794: 00 93 7f 00 sts 0x007F, r16
798: ed e7 ldi r30, 0x7D ; 125
79a: f0 e0 ldi r31, 0x00 ; 0
79c: a9 e7 ldi r26, 0x79 ; 121
79e: b0 e0 ldi r27, 0x00 ; 0
for( i = 0; i < 4; i++ )
TWI_string[ i + 1 ] = TWI_speed.string[i];
7a0: 81 91 ld r24, Z+
7a2: 8d 93 st X+, r24
TWI_string[0] = address;
TWI_speed.left_right[0] = -left_speed;
TWI_speed.left_right[1] = right_speed;
for( i = 0; i < 4; i++ )
7a4: 80 e0 ldi r24, 0x00 ; 0
7a6: e1 38 cpi r30, 0x81 ; 129
7a8: f8 07 cpc r31, r24
7aa: d1 f7 brne .-12 ; 0x7a0 <motor+0x56>
TWI_string[ i + 1 ] = TWI_speed.string[i];
TWI_flag = 1;
7ac: 81 e0 ldi r24, 0x01 ; 1
7ae: 80 93 77 00 sts 0x0077, r24
TWI_master( &TWI_data );
7b2: 80 e6 ldi r24, 0x60 ; 96
7b4: 90 e0 ldi r25, 0x00 ; 0
7b6: 0e 94 3a 02 call 0x474 ; 0x474 <TWI_master>
7ba: df 91 pop r29
7bc: cf 91 pop r28
7be: 1f 91 pop r17
7c0: 0f 91 pop r16
7c2: ff 90 pop r15
7c4: 08 95 ret
000007c6 <get_sensor>:
TWI_slave_initialize(SELF_ADDRESS, 0, &data);
return;
}
void get_sensor(void)
{
7c6: df 93 push r29
7c8: cf 93 push r28
7ca: 0f 92 push r0
7cc: cd b7 in r28, 0x3d ; 61
7ce: de b7 in r29, 0x3e ; 62
volatile unsigned char i = 0;
7d0: 19 82 std Y+1, r1 ; 0x01
while(flag && (i++) < 255);
7d2: 80 91 69 00 lds r24, 0x0069
7d6: 88 23 and r24, r24
7d8: 29 f0 breq .+10 ; 0x7e4 <get_sensor+0x1e>
7da: 89 81 ldd r24, Y+1 ; 0x01
7dc: 8f 5f subi r24, 0xFF ; 255
7de: 89 83 std Y+1, r24 ; 0x01
7e0: 81 50 subi r24, 0x01 ; 1
7e2: b8 f7 brcc .-18 ; 0x7d2 <get_sensor+0xc>
status[0] = data.string[0];
7e4: e0 91 82 00 lds r30, 0x0082
7e8: f0 91 83 00 lds r31, 0x0083
7ec: 80 81 ld r24, Z
7ee: 80 93 67 00 sts 0x0067, r24
status[1] = data.string[1];
7f2: 81 81 ldd r24, Z+1 ; 0x01
7f4: 80 93 68 00 sts 0x0068, r24
flag = 1;
7f8: 81 e0 ldi r24, 0x01 ; 1
7fa: 80 93 69 00 sts 0x0069, r24
return;
}
7fe: 0f 90 pop r0
800: cf 91 pop r28
802: df 91 pop r29
804: 08 95 ret
00000806 <sensorInit>:
volatile unsigned char flag = 1;
static struct TWI_slave_data data;
void sensorInit(void)
{
806: 0f 93 push r16
808: 1f 93 push r17
data.length = 2;
80a: 01 e8 ldi r16, 0x81 ; 129
80c: 10 e0 ldi r17, 0x00 ; 0
80e: 82 e0 ldi r24, 0x02 ; 2
810: 80 93 81 00 sts 0x0081, r24
data.string = status;
814: 87 e6 ldi r24, 0x67 ; 103
816: 90 e0 ldi r25, 0x00 ; 0
818: 90 93 83 00 sts 0x0083, r25
81c: 80 93 82 00 sts 0x0082, r24
data.flag = &flag;
820: 89 e6 ldi r24, 0x69 ; 105
822: 90 e0 ldi r25, 0x00 ; 0
824: 90 93 85 00 sts 0x0085, r25
828: 80 93 84 00 sts 0x0084, r24
data.next = &data;
82c: 10 93 87 00 sts 0x0087, r17
830: 00 93 86 00 sts 0x0086, r16
TWI_initialize();
834: 0e 94 18 02 call 0x430 ; 0x430 <TWI_initialize>
TWI_slave_initialize(SELF_ADDRESS, 0, &data);
838: a8 01 movw r20, r16
83a: 60 e0 ldi r22, 0x00 ; 0
83c: 70 e0 ldi r23, 0x00 ; 0
83e: 80 e1 ldi r24, 0x10 ; 16
840: 0e 94 2d 02 call 0x45a ; 0x45a <TWI_slave_initialize>
return;
}
844: 1f 91 pop r17
846: 0f 91 pop r16
848: 08 95 ret
0000084a <timeInit>:
volatile static unsigned char second = 0;
void timeInit(void)
{
TCCR0 = 0x05;
84a: 85 e0 ldi r24, 0x05 ; 5
84c: 83 bf out 0x33, r24 ; 51
TCNT0 = 0x82;
84e: 82 e8 ldi r24, 0x82 ; 130
850: 82 bf out 0x32, r24 ; 50
TIMSK |= 0x01;
852: 89 b7 in r24, 0x39 ; 57
854: 81 60 ori r24, 0x01 ; 1
856: 89 bf out 0x39, r24 ; 57
sei();
858: 78 94 sei
}
85a: 08 95 ret
0000085c <getTime>:
unsigned char getTime(void)
{
return second;
85c: 80 91 89 00 lds r24, 0x0089
}
860: 08 95 ret
00000862 <__vector_9>:
ISR(TIMER0_OVF_vect)
{
862: 1f 92 push r1
864: 0f 92 push r0
866: 0f b6 in r0, 0x3f ; 63
868: 0f 92 push r0
86a: 11 24 eor r1, r1
86c: 2f 93 push r18
86e: 3f 93 push r19
870: 4f 93 push r20
872: 5f 93 push r21
874: 6f 93 push r22
876: 7f 93 push r23
878: 8f 93 push r24
87a: 9f 93 push r25
87c: af 93 push r26
87e: bf 93 push r27
880: ef 93 push r30
882: ff 93 push r31
TCNT0 = 0x82;
884: 82 e8 ldi r24, 0x82 ; 130
886: 82 bf out 0x32, r24 ; 50
count_m++;
888: 80 91 88 00 lds r24, 0x0088
88c: 8f 5f subi r24, 0xFF ; 255
88e: 80 93 88 00 sts 0x0088, r24
get_sensor();
892: 0e 94 e3 03 call 0x7c6 ; 0x7c6 <get_sensor>
if(Left_backward_straight == 0 && Right_backward_straight == 0)
896: 80 91 68 00 lds r24, 0x0068
89a: 83 fd sbrc r24, 3
89c: 0e c0 rjmp .+28 ; 0x8ba <__vector_9+0x58>
89e: 80 91 67 00 lds r24, 0x0067
8a2: 83 fd sbrc r24, 3
8a4: 0a c0 rjmp .+20 ; 0x8ba <__vector_9+0x58>
{
PORTB |= 0xE0;
8a6: 88 b3 in r24, 0x18 ; 24
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -