67 views|1 replies

3181

Posts

0

Resources
The OP
 

vTaskDelay does not work in freertos [Copy link]

 

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;
}

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

Using _delay_ms() works fine, but using vTaskDelay doesn't work. I'm using atmega128

Can any experts please tell me how to solve this problem? Thank you

Latest reply

How come this test doesn't work?   Details Published on 2024-11-17 23:25
Personal signature为江山踏坏了乌骓马,为社稷拉断了宝雕弓。
 

106

Posts

0

Resources
2
 

How come this test doesn't work?

 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list