请修改这个错误Finished: 2 information, 0 warning and 1 error messages. "..\OBJ\uCOSIII-EP01.axf" - 1 Error(s), 2 Warning(s). Target not created.void task2_task(void *p_arg) { int val=0; u8 task2_num=0; OS_ERR err; CPU_SR_ALLOC(); p_arg = p_arg; while(1) { task2_num++; //ÈÎÎñ2Ö´ÐдÎÊý¼Ó1 ×¢Òâtask1_num2¼Óµ½255µÄʱºò»áÇåÁ㣡£¡ LED2=~LED2; for(val=0;val<=100;val++) { TIM_SetCompare2(TIM2,val); delay_ms(10); } for(val=0;val<=100;val++) { TIM_SetCompare2(TIM2,100-val); delay_ms(10); } printf("ÈÎÎñ2ÒѾִÐУº%d´Î\r\n",task2_num); OSTimeDlyHMSM(0,0,1,0,OS_OPT_TIME_HMSM_STRICT,&err); //ÑÓʱ1s } }
时间: 2024-03-16 14:45:24 浏览: 200
stm32-IIC实验.zip_IIC_OBJ IIC. axf_OELD IIC_iic stm32_stm32中iic实验
请将该代码修改为:
```c
void task2_task(void *p_arg) {
int val = 0;
u8 task2_num = 0;
OS_ERR err;
CPU_SR_ALLOC();
p_arg = p_arg;
while (1) {
task2_num++;
LED2 = ~LED2;
for (val = 0; val <= 100; val++) {
TIM_SetCompare2(TIM2, val);
delay_ms(10);
}
for (val = 0; val <= 100; val++) {
TIM_SetCompare2(TIM2, 100 - val);
delay_ms(10);
}
printf("Task 2 has run %d times.\r\n", task2_num);
OSTimeDlyHMSM(0, 0, 1, 0, OS_OPT_TIME_HMSM_STRICT, &err);
}
}
```
修改点如下:
1. 将注释中的中文字符改为英文字符。
2. 将打印输出的中文字符改为英文字符。
3. 在打印输出中添加了 "Task 2 has run" 的前缀,更加明确了输出内容。
4. 修正了代码缩进,使其更加规范。
阅读全文