FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [April 2013 Threads] xTaskStartSchedulerPosted by park kwan woo on April 15, 2013 Hi, everyon.
i'm working on FreeRTOS, especially, implementing softtimer. According to the manual of FreeRTOS, xTaskStartScheduler have to be activated to use soft timer, but, i can't find this function - xTaskStartScheduler. Even thought, looking into each files of FreeRTOS. What is the problem. is there any other function which act like xTaskStartScheduler func.?... please, answer me whoever know about that... as you see web site, xTaskStartScheduler is put on the last of main(), but, my builder show me undefined reference xTaskStartScheduler...
RE: xTaskStartSchedulerPosted by woops_ on April 15, 2013 vTaskStartScheduler, no xTaskStartScheduler http://www.freertos.org/a00132.html
where does it say xTaskStartScheduler?
RE: xTaskStartSchedulerPosted by Friedrich Lobenstock on April 15, 2013 See task.h, its vTaskStartScheduler you are searching for.
RE: xTaskStartSchedulerPosted by park kwan woo on April 15, 2013 Example usage: #define NUM_TIMERS 5
/* An array to hold handles to the created timers. */ xTimerHandle xTimers[ NUM_TIMERS ];
/* An array to hold a count of the number of times each timer expires. */ long lExpireCounters[ NUM_TIMERS ] = { 0 };
/* Define a callback function that will be used by multiple timer instances. The callback function does nothing but count the number of times the associated timer expires, and stop the timer once the timer has expired 10 times. */ void vTimerCallback( xTimerHandle pxTimer ) { long lArrayIndex; const long xMaxExpiryCountBeforeStopping = 10;
/* Optionally do something if the pxTimer parameter is NULL. */ configASSERT( pxTimer );
/* Which timer expired? */ lArrayIndex = ( long ) pvTimerGetTimerID( pxTimer );
/* Increment the number of times that pxTimer has expired. */ lExpireCounters[ lArrayIndex ] += 1;
/* If the timer has expired 10 times then stop it from running. */ if( lExpireCounters[ lArrayIndex ] == xMaxExpiryCountBeforeStopping ) { /* Do not use a block time if calling a timer API function from a timer callback function, as doing so could cause a deadlock! */ xTimerStop( pxTimer, 0 ); } }
void main( void ) { long x;
/* Create then start some timers. Starting the timers before the RTOS scheduler has been started means the timers will start running immediately that the RTOS scheduler starts. */ for( x = 0; x < NUM_TIMERS; x++ ) { xTimers[ x ] = xTimerCreate ( /* Just a text name, not used by the RTOS kernel. */ "Timer", /* The timer period in ticks. */ ( 100 * x ), /* The timers will auto-reload themselves when they expire. */ pdTRUE, /* Assign each timer a unique id equal to its array index. */ ( void * ) x, /* Each timer calls the same callback when it expires. */ vTimerCallback );
if( xTimers[ x ] == NULL ) { /* The timer was not created. */ } else { /* Start the timer. No block time is specified, and even if one was it would be ignored because the RTOS scheduler has not yet been started. */ if( xTimerStart( xTimers[ x ], 0 ) != pdPASS ) { /* The timer could not be set into the Active state. */ } } }
/* ... Create tasks here. ... */
/* Starting the RTOS scheduler will start the timers running as they have already been set into the active state. */ xTaskStartScheduler(); <<------------------------------------ HERE!!!!!
/* Should not reach here. */ for( ;; ); }
RE: xTaskStartSchedulerPosted by park kwan woo on April 15, 2013 http://www.freertos.org/FreeRTOS-timers-xTimerCreate.html <--- Refer here
RE: xTaskStartSchedulerPosted by Richard on April 15, 2013 Typo - now fixed. Thanks.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|