Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

xTaskStartScheduler

Posted 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: xTaskStartScheduler

Posted by woops_ on April 15, 2013
vTaskStartScheduler, no xTaskStartScheduler http://www.freertos.org/a00132.html

where does it say xTaskStartScheduler?

RE: xTaskStartScheduler

Posted by Friedrich Lobenstock on April 15, 2013
See task.h, its vTaskStartScheduler you are searching for.

RE: xTaskStartScheduler

Posted 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: xTaskStartScheduler

Posted by park kwan woo on April 15, 2013
http://www.freertos.org/FreeRTOS-timers-xTimerCreate.html <--- Refer here

RE: xTaskStartScheduler

Posted by Richard on April 15, 2013
Typo - now fixed. Thanks.

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists