代码:
#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;
}
FreeRTOSconfig里
#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
用_delay_ms()就好使,用vTaskDelay就不行。我用的atmega128
请问高手,如何解决?谢谢
|