Hi,
I was testing SoftwareTimer in metware SYNOPSYS ARC IDE. I am following the example program given in the FreeRTOS Manuel. which like this…
CASE 1:
void vTimerCallback( TimerHandle_t xTimer )
{
printf(“callback function\n”):
…….
…….
}
void main( void )
{
TimerHandle_t xTimers = NULL;
xTimers = xTimerCreate( "Timer",10,pdTRUE, ( void * ) 0,vTimerCallback );
vTaskStartScheduler();
}
for this I am able to see the print “callback function” in the Resrult only once.
CASE 2 : if I I created a timer in the Task, like as shown in the following…
void vTimerCallback( TimerHandle_t xTimer )
{
printf(“callback function”):
…….
…….
}
void main( void )
{
TaskHandle_t xTask1Handle1 = NULL;
xTaskCreate( prvTask1, "Tsk1Work", TASK1_STACK_SIZE, (void*)pcTextForTask1, 12, &xTask1Handle1 );
vTaskStartScheduler();
}
void prvTask1( void *pvParameters )
{
printf("task is created\n);
TimerHandle_t xTimers = NULL;
xTimers = xTimerCreate( "Timer",10,pdTRUE, ( void * ) 0,vTimerCallback );
}
in this example I am able to see the “callback function” prints infinite time until I stop the timer.
Why this type of behaviour?, is it we have to create a timer in the Task to work as Auto Reloud Timers. or if I create that in the main function it is behaving as one shot Timer.
above case2 example is printing infinite times, so as shown in example code of FreeRTOS Manuel I gave the condition like count is 30 then timer should stop. after writing this condition the case 2 also printing only once.
please tell the reason behind this or else any mistakes I am doing to test the Timers…
in the freeRTOSConfig.h I have defined Like this
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configUSE_TIMERS 1
#define INCLUDE_xTimerPendFunctionCall 1
#define configTIMER_TASK_STACK_DEPTH 104
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_PRIORITY 10
Thanks and Regards…
Mansoor Basha