0
0
FreeRTOSprogramming~10 mins

xTaskCreate() function in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a FreeRTOS task named "Task1".

FreeRTOS
xTaskCreate([1], "Task1", 100, NULL, 1, NULL);
Drag options to blanks, or click blank then click option'
AvTaskFunction
BTaskHandle_t
CxTaskCreate
DvTaskStartScheduler
Attempts:
3 left
💡 Hint
Common Mistakes
Using the task handle type instead of the function name.
Calling xTaskCreate instead of passing the function pointer.
2fill in blank
medium

Complete the code to set the stack size of the task to 256 words.

FreeRTOS
xTaskCreate(TaskFunction, "Task2", [1], NULL, 2, NULL);
Drag options to blanks, or click blank then click option'
A128
B512
C64
D256
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing bytes with words for stack size.
Using too small or too large stack size without reason.
3fill in blank
hard

Fix the error in the priority argument to create a high priority task.

FreeRTOS
xTaskCreate(TaskFunction, "Task3", 200, NULL, [1], NULL);
Drag options to blanks, or click blank then click option'
A0
BconfigMAX_PRIORITIES
CconfigMAX_PRIORITIES - 1
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using configMAX_PRIORITIES directly causes error.
Using negative priority values.
4fill in blank
hard

Fill both blanks to create a task with a handle and check if creation was successful.

FreeRTOS
TaskHandle_t [1] = NULL;
BaseType_t result = xTaskCreate(TaskFunction, "Task4", 150, NULL, 1, [2]);
if (result == pdPASS) {
    // Task created successfully
}
Drag options to blanks, or click blank then click option'
AtaskHandle
BNULL
C&taskHandle
DtaskFunction
Attempts:
3 left
💡 Hint
Common Mistakes
Passing NULL instead of the address of the handle variable.
Not declaring a handle variable before use.
5fill in blank
hard

Fill all three blanks to create a task with a parameter, priority 3, and store its handle.

FreeRTOS
int param = 10;
TaskHandle_t [1] = NULL;
BaseType_t result = xTaskCreate(TaskFunction, "Task5", 120, [2], [3], &taskHandle);
Drag options to blanks, or click blank then click option'
AtaskHandle
B&param
C3
Dparam
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the address of param instead of param itself.
Mixing up priority and parameter arguments.
Not storing the task handle.