freertos里vTaskDelay不起作用
<p>代码:</p><pre>
<code>#include <avr/io.h>
#include <util/delay.h>
#include "FreeRTOS.h"
#include "task.h"
#include "LEDBlinkV1.h"
void LedOnTask( void *pvParameters ) // Task -1
{
for( ;; )
{
LED_ON;_delay_ms(1000);
taskYIELD();
//vTaskDelayUntil(&OnLastWakeTime,OnFrequency);
}
}
void LedOffTask( void *pvParameters )//Task-2
{
portTickType xLastWakeTime;
for( ;; )
{
LED_OFF;
//_delay_ms(1000);
//vTaskDelayUntil(&xLastWakeTime,1000);
vTaskDelay(1000);
taskYIELD();
//vTaskDelayUntil(&OffLastWakeTime,OffFrequency);
}
vTaskDelete(NULL);
}
portSHORT main(void)
{
vCPU_Port_Init();
xTaskCreate( LedOnTask, ( signed char * ) "LON", configMINIMAL_STACK_SIZE, NULL, 1, NULL ); //Task creation for task-1
xTaskCreate( LedOffTask, ( signed char * ) "LOFF", configMINIMAL_STACK_SIZE, NULL,2, NULL );//Task creation for task-2
vTaskStartScheduler();//start scheduler
//you should never get here
while(1)
{
}
return 0;
}
</code></pre>
<p>FreeRTOSconfig里</p>
<pre>
<code>#define INCLUDE_vTaskPrioritySet 0
#define INCLUDE_uxTaskPriorityGet 0
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 0
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1</code></pre>
<p>用_delay_ms()就好使,用vTaskDelay就不行。我用的atmega128</p>
<p>请问高手,如何解决?谢谢</p>
<p>这是怎么测试出来不起作用的啊</p>
lemonboard 发表于 2024-11-17 23:25
这是怎么测试出来不起作用的啊
<p>灯不闪啊</p>
<p>建议用ai做代码检查,在看看</p>
<p>看代码,您的LED灯是不是常亮啊</p>
lemonboard 发表于 2024-11-18 14:41
看代码,您的LED灯是不是常亮啊
<p>常灭</p>
<div class='shownolgin' data-isdigest='no'>bmahu001 发表于 2024-11-18 14:37
建议用ai做代码检查,在看看
<p>ai检查Python代码还行,单片机感觉还是训练的不够</p>
</div><script>showreplylogin();</script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script>
页:
[1]