我WIN10操作系统,开发环境用的AVR STUDIO7,下载了一个移植成功的例子。
改了一下,用软件定时器
代码如下:
#include <avr/io.h>
#include <util/delay.h>
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "LEDBlinkV1.h"
xTimerHandle xTmr;
long cnt;
void vTimerCallback(xTimerHandle pxTimer)
{
LED=~LED;
cnt++;
}
void LedOnTask( void *pvParameters ) // Task -1
{
for( ;; )
{
LED_ON;_delay_ms(1000);
taskYIELD();
//vTaskDelayUntil(&OnLastWakeTime,OnFrequency);
}
}
void LedOffTask( void *pvParameters ) //Task-2
{
for( ;; )
{
LED_OFF;_delay_ms(1000);
taskYIELD();
//vTaskDelayUntil(&OffLastWakeTime,OffFrequency);
}
}
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
xTmr=xTimerCreate("Timer",500/portTICK_RATE_MS,pdTRUE,1,vTimerCallback);
vTaskStartScheduler();//start scheduler
//you should never get here
while(1)
{
}
return 0;
}
提示出错:
请问高手,如何解决?谢谢
|