📄 test.lss
字号:
#endif
/*
***************************************************************************************************
* 创建任务
***************************************************************************************************
*/
//主要任务
void Task1 (void *data)
{
204: cf 93 push r28
206: df 93 push r29
208: cd b7 in r28, 0x3d ; 61
20a: de b7 in r29, 0x3e ; 62
20c: 2b 97 sbiw r28, 0x0b ; 11
20e: 0f b6 in r0, 0x3f ; 63
210: f8 94 cli
212: de bf out 0x3e, r29 ; 62
214: 0f be out 0x3f, r0 ; 63
216: cd bf out 0x3d, r28 ; 61
INT8U err=0;
218: 1b 86 std Y+11, r1 ; 0x0b
INT8U tempstr[10] = {0};
21a: 8a e0 ldi r24, 0x0A ; 10
21c: fe 01 movw r30, r28
21e: 31 96 adiw r30, 0x01 ; 1
220: 11 92 st Z+, r1
222: 8a 95 dec r24
224: e9 f7 brne .-6 ; 0x220
// 把开定时中断0AvrInit()从移到这里
TCCR1B = (1 << CS02); // 时钟预分频为 CLK/1024
226: 84 e0 ldi r24, 0x04 ; 4
228: 8e bd out 0x2e, r24 ; 46
data = data;
for (;;)
{
//发送查询当前状态命令
Printf("testState");
22a: 80 e0 ldi r24, 0x00 ; 0
22c: 91 e0 ldi r25, 0x01 ; 1
22e: 0e 94 be 00 call 0x17c
OSSemPend(UartRxSem,0,&err);
232: ae 01 movw r20, r28
234: 45 5f subi r20, 0xF5 ; 245
236: 5f 4f sbci r21, 0xFF ; 255
238: 60 e0 ldi r22, 0x00 ; 0
23a: 70 e0 ldi r23, 0x00 ; 0
23c: 80 91 e2 03 lds r24, 0x03E2
240: 90 91 e3 03 lds r25, 0x03E3
244: 0e 94 bd 07 call 0xf7a
if(stringCopy(tempstr))//传输校验正确
248: ce 01 movw r24, r28
24a: 01 96 adiw r24, 0x01 ; 1
24c: 0e 94 63 00 call 0xc6
250: 88 23 and r24, r24
252: 21 f0 breq .+8 ; 0x25c
{
Printf("do something");//发送动作的命令
254: 8a e0 ldi r24, 0x0A ; 10
256: 91 e0 ldi r25, 0x01 ; 1
258: 0e 94 be 00 call 0x17c
}
OSTimeDlyHMSM(0,0,1,0);
25c: 20 e0 ldi r18, 0x00 ; 0
25e: 30 e0 ldi r19, 0x00 ; 0
260: 41 e0 ldi r20, 0x01 ; 1
262: 60 e0 ldi r22, 0x00 ; 0
264: 86 2f mov r24, r22
266: 0e 94 33 0a call 0x1466
26a: df cf rjmp .-66 ; 0x22a
0000026c <Task2>:
}
}
void Task2 (void *data)
{
//INT8U err;
data = data;
for (;;)
{
GLED_ON;
26c: c1 98 cbi 0x18, 1 ; 24
OSTimeDly(50); // 延时0.5秒
26e: 82 e3 ldi r24, 0x32 ; 50
270: 90 e0 ldi r25, 0x00 ; 0
272: 0e 94 2f 06 call 0xc5e
GLED_OFF;
276: c1 9a sbi 0x18, 1 ; 24
OSTimeDly(50); // 延时0.5秒
278: 82 e3 ldi r24, 0x32 ; 50
27a: 90 e0 ldi r25, 0x00 ; 0
27c: 0e 94 2f 06 call 0xc5e
280: f5 cf rjmp .-22 ; 0x26c
00000282 <Task3>:
}
}
void Task3 (void *data)
{
282: cf 93 push r28
284: df 93 push r29
286: cd b7 in r28, 0x3d ; 61
288: de b7 in r29, 0x3e ; 62
28a: 28 97 sbiw r28, 0x08 ; 8
28c: 0f b6 in r0, 0x3f ; 63
28e: f8 94 cli
290: de bf out 0x3e, r29 ; 62
292: 0f be out 0x3f, r0 ; 63
294: cd bf out 0x3d, r28 ; 61
INT8U rdata[8];//从1302中读出的数据
data = data;
chipClockStart(1);//打开时钟
296: 81 e0 ldi r24, 0x01 ; 1
298: 0e 94 e8 02 call 0x5d0
for (;;)
{
burstModeTimeRead(rdata);
29c: ce 01 movw r24, r28
29e: 01 96 adiw r24, 0x01 ; 1
2a0: 0e 94 50 03 call 0x6a0
Print("\n date: ");
2a4: 87 e1 ldi r24, 0x17 ; 23
2a6: 91 e0 ldi r25, 0x01 ; 1
2a8: 0e 94 f3 00 call 0x1e6
Put_Byte(rdata[6]);
2ac: 8f 81 ldd r24, Y+7 ; 0x07
2ae: 0e 94 e3 00 call 0x1c6
Print("/");
2b2: 80 e2 ldi r24, 0x20 ; 32
2b4: 91 e0 ldi r25, 0x01 ; 1
2b6: 0e 94 f3 00 call 0x1e6
Put_Byte(rdata[4]);
2ba: 8d 81 ldd r24, Y+5 ; 0x05
2bc: 0e 94 e3 00 call 0x1c6
Print("/");
2c0: 80 e2 ldi r24, 0x20 ; 32
2c2: 91 e0 ldi r25, 0x01 ; 1
2c4: 0e 94 f3 00 call 0x1e6
Put_Byte(rdata[3]);
2c8: 8c 81 ldd r24, Y+4 ; 0x04
2ca: 0e 94 e3 00 call 0x1c6
Print(" time: ");
2ce: 82 e2 ldi r24, 0x22 ; 34
2d0: 91 e0 ldi r25, 0x01 ; 1
2d2: 0e 94 f3 00 call 0x1e6
Put_Byte(rdata[2]);
2d6: 8b 81 ldd r24, Y+3 ; 0x03
2d8: 0e 94 e3 00 call 0x1c6
Print(":");
2dc: 8c e2 ldi r24, 0x2C ; 44
2de: 91 e0 ldi r25, 0x01 ; 1
2e0: 0e 94 f3 00 call 0x1e6
Put_Byte(rdata[1]);
2e4: 8a 81 ldd r24, Y+2 ; 0x02
2e6: 0e 94 e3 00 call 0x1c6
Print(":");
2ea: 8c e2 ldi r24, 0x2C ; 44
2ec: 91 e0 ldi r25, 0x01 ; 1
2ee: 0e 94 f3 00 call 0x1e6
Put_Byte(rdata[0]);
2f2: 89 81 ldd r24, Y+1 ; 0x01
2f4: 0e 94 e3 00 call 0x1c6
OSTimeDlyHMSM(0,0,5,0);
2f8: 20 e0 ldi r18, 0x00 ; 0
2fa: 30 e0 ldi r19, 0x00 ; 0
2fc: 45 e0 ldi r20, 0x05 ; 5
2fe: 60 e0 ldi r22, 0x00 ; 0
300: 86 2f mov r24, r22
302: 0e 94 33 0a call 0x1466
306: ca cf rjmp .-108 ; 0x29c
00000308 <AvrInit>:
}
}
/*
*************************************************************************************************
* 硬件的初始化
*************************************************************************************************
*/
void AvrInit (void)
{
//串口1初始化
UBRR1L = 95;//波特率设为9600 晶振14.7456MHz
308: 8f e5 ldi r24, 0x5F ; 95
30a: 80 93 99 00 sts 0x0099, r24
UCSR1B = (1 << TXEN1) | (1 << RXEN1) | (1 << RXCIE1); //允许发送和接收并允许接收中断
30e: 88 e9 ldi r24, 0x98 ; 152
310: 80 93 9a 00 sts 0x009A, r24
UBRR0L = 47;//波特率设为19200 晶振14.7456MHz
314: 8f e2 ldi r24, 0x2F ; 47
316: 89 b9 out 0x09, r24 ; 9
UCSR0B = (1 << TXEN0) ; //允许发送
318: 88 e0 ldi r24, 0x08 ; 8
31a: 8a b9 out 0x0a, r24 ; 10
//外部SRAM/XMEM 使能
MCUCR |= (1 << SRE) | (1 << SRW10);
31c: 85 b7 in r24, 0x35 ; 53
31e: 80 6c ori r24, 0xC0 ; 192
320: 85 bf out 0x35, r24 ; 53
//等待两个时钟周期
XMCRA |= (1 << SRW11) | (1 << SRW01) | (1 << SRW00);
322: 80 91 6d 00 lds r24, 0x006D
326: 8e 60 ori r24, 0x0E ; 14
328: 80 93 6d 00 sts 0x006D, r24
//定时器 1 (系统时钟)/ 2 (串口超时判断) 初始化
TCCR1B = 0; // 暂停计数
32c: 1e bc out 0x2e, r1 ; 46
TCCR2 = 0; // 暂停计数
32e: 15 bc out 0x25, r1 ; 37
TIMSK = (1 << TOIE1) | (1 << TOIE2) ; // 允许定时器 0 / 2 溢出中断
330: 84 e4 ldi r24, 0x44 ; 68
332: 87 bf out 0x37, r24 ; 55
TCNT1 = 65535 - (CPU_CLOCK_HZ / OS_TICKS_PER_SEC / 256); // 定时常数
334: 8f eb ldi r24, 0xBF ; 191
336: 9d ef ldi r25, 0xFD ; 253
338: 9d bd out 0x2d, r25 ; 45
33a: 8c bd out 0x2c, r24 ; 44
TCNT2 = 195; // 初值
33c: 83 ec ldi r24, 0xC3 ; 195
33e: 84 bd out 0x24, r24 ; 36
//485输出控制端口
DDRB |= (1 << PB6);//输出
340: be 9a sbi 0x17, 6 ; 23
PORTD |= (1 << PD2); //RX0引脚使用内部上拉电阻
342: 92 9a sbi 0x12, 2 ; 18
//LED控制
DDRB |= ( 1<< PB1);//GLED
344: b9 9a sbi 0x17, 1 ; 23
DDRB |= ( 1<< PB2);//RLED
346: ba 9a sbi 0x17, 2 ; 23
GLED_OFF;
348: c1 9a sbi 0x18, 1 ; 24
RLED_OFF;
34a: c2 9a sbi 0x18, 2 ; 24
//DS1302控制线
DDRB |= (1 << PB3);//SCK
34c: bb 9a sbi 0x17, 3 ; 23
DDRB |= (1 << PB5);//RST
34e: bd 9a sbi 0x17, 5 ; 23
350: 08 95 ret
00000352 <main>:
}
int main (void)
{
352: cf ef ldi r28, 0xFF ; 255
354: d0 e1 ldi r29, 0x10 ; 16
356: de bf out 0x3e, r29 ; 62
358: cd bf out 0x3d, r28 ; 61
AvrInit(); // 硬件初始化
35a: 0e 94 84 01 call 0x308
OSInit();
35e: 0e 94 95 08 call 0x112a
UartRxSem = OSSemCreate(0); // 初始化发送缓冲区
362: 80 e0 ldi r24, 0x00 ; 0
364: 90 e0 ldi r25, 0x00 ; 0
366: 0e 94 93 07 call 0xf26
36a: 90 93 e3 03 sts 0x03E3, r25
36e: 80 93 e2 03 sts 0x03E2, r24
OSTaskCreate(Task1, (void *)0, (void *)&TaskStk[0][TASK_STK_SIZE - 1], 1);
372: 21 e0 ldi r18, 0x01 ; 1
374: 4f ed ldi r20, 0xDF ; 223
376: 52 e0 ldi r21, 0x02 ; 2
378: 60 e0 ldi r22, 0x00 ; 0
37a: 70 e0 ldi r23, 0x00 ; 0
37c: 82 e0 ldi r24, 0x02 ; 2
37e: 91 e0 ldi r25, 0x01 ; 1
380: 0e 94 38 08 call 0x1070
OSTaskCreate(Task2, (void *)0, (void *)&TaskStk[1][TASK_STK_SIZE - 1], 2);
384: 22 e0 ldi r18, 0x02 ; 2
386: 4f e5 ldi r20, 0x5F ; 95
388: 53 e0 ldi r21, 0x03 ; 3
38a: 60 e0 ldi r22, 0x00 ; 0
38c: 70 e0 ldi r23, 0x00 ; 0
38e: 86 e3 ldi r24, 0x36 ; 54
390: 91 e0 ldi r25, 0x01 ; 1
392: 0e 94 38 08 call 0x1070
OSTaskCreate(Task3, (void *)0, (void *)&TaskStk[2][TASK_STK_SIZE - 1], 3);
396: 23 e0 ldi r18, 0x03 ; 3
398: 4f ed ldi r20, 0xDF ; 223
39a: 53 e0 ldi r21, 0x03 ; 3
39c: 60 e0 ldi r22, 0x00 ; 0
39e: 70 e0 ldi r23, 0x00 ; 0
3a0: 81 e4 ldi r24, 0x41 ; 65
3a2: 91 e0 ldi r25, 0x01 ; 1
3a4: 0e 94 38 08 call 0x1070
OSStart(); // 开始多任务处理
3a8: 0e 94 86 04 call 0x90c
return 0;
}
3ac: 80 e0 ldi r24, 0x00 ; 0
3ae: 90 e0 ldi r25, 0x00 ; 0
3b0: 0c 94 1b 0c jmp 0x1836
000003b4 <__vector_30>:
/****************************************************************************************/
/************************************OS中断处理******************************************/
/****************************************************************************************/
//串口1接收到数据
UCOSISR(SIG_UART1_RECV)
{
PushRS();
3b4: 0f 92 push r0
3b6: 1f 92 push r1
3b8: 2f 92 push r2
3ba: 3f 92 push r3
3bc: 4f 92 push r4
3be: 5f 92 push r5
3c0: 6f 92 push r6
3c2: 7f 92 push r7
3c4: 8f 92 push r8
3c6: 9f 92 push r9
3c8: af 92 push r10
3ca: bf 92 push r11
3cc: cf 92 push r12
3ce: df 92 push r13
3d0: ef 92 push r14
3d2: ff 92 push r15
3d4: 0f 93 push r16
3d6: 1f 93 push r17
3d8: 2f 93 push r18
3da: 3f 93 push r19
3dc: 4f 93 push r20
3de: 5f 93 push r21
3e0: 6f 93 push r22
3e2: 7f 93 push r23
3e4: 8f 93 push r24
3e6: 9f 93 push r25
3e8: af 93 push r26
3ea: bf 93 push r27
3ec: cf 93 push r28
3ee: df 93 push r29
3f0: ef 93 push r30
3f2: ff 93 push r31
3f4: 0f b7 in r16, 0x3f ; 63
3f6: 00 68 ori r16, 0x80 ; 128
3f8: 0f 93 push r16
OSIntEnter();
3fa: 0e 94 14 04 call 0x828
if (OSIntNesting == 1)
3fe: 80 91 81 04 lds r24, 0x0481
402: 81 30 cpi r24, 0x01 ; 1
404: 41 f4 brne .+16 ; 0x416
OSTCBCur->OSTCBStkPtr = (OS_STK *)SP;
406: e0 91 82 04 lds r30, 0x0482
40a: f0 91 83 04 lds r31, 0x0483
40e: 8d b7 in r24, 0x3d ; 61
410: 9e b7 in r25, 0x3e ; 62
412: 80 83 st Z, r24
414: 91 83 std Z+1, r25 ; 0x01
UartRxBuf[UartRxCounter++] = UDR1;
416: 80 91 36 02 lds r24, 0x0236
41a: 90 91 37 02 lds r25, 0x0237
41e: fc 01 movw r30, r24
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -