dragie wrote on Sunday, May 25, 2008:
hi all,
i was trying to run 4 tasks, 4 difrent prioritys. just basic to see how it works.
source i made wil only show 2 task because the last 2 basicly are the same.:
int main(void)
{
DDRD = 0xff;
PORTD = 0x00;
taskstarter();
vTaskStartScheduler();
}
void taskstarter()
{
xTaskCreate(task1, (dunno what i must put after this priority 1 or something)
xTaskCreate(task2, (dunno what i must put after this priority 2 or something)
xTaskCreate(task3, (dunno what i must put after this priority 3 or something)
xTaskCreate(task4, (dunno what i must put after this priority 4 or something)
}
void task1(void)
{
portTickType xDelay, xNextTime;
xNextTime = xTaskGetTickCount () + ( portTickType ) 10;
for(;
{
xDelay = xNextTime - xTaskGetTickCount ();
xNextTime += ( portTickType ) 10;
PORTD = 0x20; // led 1 on
vTaskDelay(xDelay);
PORTD = 0x00; // all leds off
}
}
void task2(void)
{
portTickType xDelay, xNextTime;
xNextTime = xTaskGetTickCount () + ( portTickType ) 10;
for(;
{
xDelay = xNextTime - xTaskGetTickCount ();
xNextTime += ( portTickType ) 10;
PORTD = 0x40; // led 2 on
vTaskDelay(xDelay);
PORTD = 0x00; // all leds off
}
}
my questions:
1) what values must i give to xTaskCreate()
2) how do i @ those tasks to the Scheduler.
3) vTaskDelay can i make that something like vTaskDelay(100); i found this xDelay in an example but i stil don’t know how manny msec or sec this delay takes. got a 8Mhz crystal on the microcontroler.
thanks for your time and help
Dragie