Task not executed ?!

nobody wrote on Wednesday, February 14, 2007:

Hello everybody !

I’m new in the world of FreeRTOS and I tried it on an Freescale HC12 card with the Help of CodeWarrior.
I created 2 tasks : one is turning on the Leds and the other do alternate them (on/off) like this :

xTaskHandle xh1, xh2 ;

xTaskCreate( off, "of", 512, NULL, 10, &xh1 );
xTaskCreate( onoff, "onoff", 512, NULL, 6, &xh2 );

When I launch the scheduler with vTaskStartScheduler(); only the second task is launched and the first one never !

Here’s the code of this 2 functions :

void on(void) {
    DDRB = 0xFF;  //turn on the Leds

void onoff(void) {
    int i ;
    for (i=0;i<=40;i++)
        PORTB ^= 0xFF; //alternate the Leds


Have you any idea why the first task isn’t called ?

Thanks a lot for helping me :slight_smile:

nobody wrote on Wednesday, February 14, 2007:

The on() task is not structured as a task.  It must be in an infinite loop or call vTaskDelete() prior to its end.

Your tasks will also need to block at some point, otherwise only one will run unless they are both at the same priority.