{"id":6030,"date":"2021-05-26T08:48:21","date_gmt":"2021-05-26T08:48:21","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=6030"},"modified":"2023-09-02T16:18:25","modified_gmt":"2023-09-02T10:48:25","slug":"freertos-lecture-29-exercise-creating-freertos-tasks-part-2","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/","title":{"rendered":"FreeRTOS Lecture 29 &#8211; Exercise: Creating FreeRTOS Tasks Part-2"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\">\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; font-size: 30px; border-width: 0px; line-height: 45px;\"><span style=\"color: #000080;\">Exercise: Creating FreeRTOS Tasks Part-2<\/span><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: -25px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">After creating a task using xTaskCreate, you may observe lots of red lines, as shown below.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\"> This is because before using any FreeRTOS related header file, that means the header file related to different services like tasks, queues, semaphores, mutexes, etc. always include the main header file, i.e., FreeRTOS.h, which is there in the 3rd party FreeRTOS source include shown in Figure 1. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">This is a very important header file that must be included first.<\/span><\/p>\n<pre class=\"color-5-text-contrast color5-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px inset;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"color: #ff99cc;\">int<\/span> main(<span style=\"color: #ff99cc;\">void<\/span>)\r\n{\r\n   <span style=\"color: #008000;\"> \/\/1. Reset the RCC clock configuration to the default reset state.<\/span>\r\n<span style=\"color: #008000;\">    \/\/HSI ON, PLL OFF, HSE OFF, system clock = 16MHz, cpu_clock = 16MHz<\/span>\r\n    RCC_DeInit();\r\n\r\n    <span style=\"color: #008000;\">\/\/2. update the SystemCoreClock variable<\/span>\r\n    SystemCoreClockUpdate();\r\n\r\n   <span style=\"color: #008000;\"> \/\/3. lets create 2 tasks , task-1 and task-2<\/span>\r\n    xTaskCreate( vTask1_handler,\"Task-1\", configMINIMAL_STACK_SIZE,NULL,2,&amp;xTaskHandle1 );\r\n\r\n    <span style=\"color: #ff99cc;\">for<\/span>(;;);\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\"><span style=\"color: #000000;\">Creation of task 1 by using xTaskCreate() API<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6034\" aria-describedby=\"caption-attachment-6034\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-6034\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/05\/Figure-2-2.png\" alt=\"Including the FreeRTOS header file into the project\" width=\"744\" height=\"396\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-2-2.png 1919w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-2-2-300x160.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-2-2-768x409.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-2-2-1024x545.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-2-2-600x319.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-2-2-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-2-2-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-2-2-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-2-2-400x213.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-2-2-800x426.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-2-2-1200x638.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6034\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Including the FreeRTOS header file into the project.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Once you include the header file, you can see that most of the errors will vanish. There are some other errors that we will address later. Now let\u2019s create another task. Before that, let\u2019s implement the vTask1_handler or task function. The prototype of the task function is as shown in Figure 2. Now let\u2019s implement the task function for Task1 as follows:<\/span><\/p>\n<figure id=\"attachment_6035\" aria-describedby=\"caption-attachment-6035\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-6035\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/05\/Figure-3-2.png\" alt=\"Prototype for task function\" width=\"744\" height=\"396\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-3-2.png 1915w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-3-2-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-3-2-768x408.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-3-2-1024x544.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-3-2-600x319.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-3-2-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-3-2-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-3-2-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-3-2-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-3-2-800x425.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-3-2-1200x637.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6035\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Prototype for task function.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">The vTask1_handler takes a void pointer. Let\u2019s give the parameter name as params, and since this function returns void, mention the return type as void. The handler for Task 1 is shown in Figure 3.<\/span><\/li>\n<\/ul>\n<figure id=\"attachment_6036\" aria-describedby=\"caption-attachment-6036\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-6036\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/05\/Figure-4-2.png\" alt=\"Prototype of vTask1_handler, xTaskCreate\" width=\"744\" height=\"396\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-4-2.png 1919w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-4-2-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-4-2-768x408.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-4-2-1024x544.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-4-2-600x319.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-4-2-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-4-2-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-4-2-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-4-2-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-4-2-800x425.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-4-2-1200x637.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6036\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. Prototype of vTask1_handler.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now let\u2019s create another task, i.e., Task 2. Just copy and paste the statement you wrote to create Task1. Change the handle name, task name, and address of the task handle to vTask2_handler, Task-2, and &amp;xTaskHandle2, respectively, as shown below. Keep the remaining information as it is.<\/span><\/p>\n<pre class=\"color-5-text-contrast color5-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"color: #ff99cc;\">int<\/span> main(<span style=\"color: #ff99cc;\">void<\/span>)\r\n{\r\n<span style=\"color: #008000;\">   \/\/1. Reset the RCC clock configuration to the default reset state.<\/span>\r\n<span style=\"color: #008000;\">   \/\/HSI ON, PLL OFF, HSE OFF, system clock = 16MHz, cpu_clock = 16MHz<\/span>\r\n   RCC_DeInit();\r\n\r\n<span style=\"color: #008000;\">  \/\/2. update the SystemCoreClock variable<\/span>\r\n  SystemCoreClockUpdate();\r\n\r\n<span style=\"color: #008000;\">  \/\/3. lets create 2 tasks , task-1 and task-2<\/span>\r\n  xTaskCreate( vTask1_handler,\"Task-1\", configMINIMAL_STACK_SIZE,NULL,2,&amp;xTaskHandle1 );\r\n <strong> xTaskCreate( vTask2_handler,\"Task-2\", configMINIMAL_STACK_SIZE,NULL,2,&amp;xTaskHandle2 );<\/strong>\r\n\r\n<span style=\"color: #ff99cc;\">  for<\/span>(;;);\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\"><span style=\"color: #000000;\">Creation of task 2 by using xTaskCreate() API<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Again, implement the task function for task2 and call it vTask2_handler, as shown in Figure 4.<\/span><\/p>\n<figure id=\"attachment_6038\" aria-describedby=\"caption-attachment-6038\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6038\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/05\/Figure-6-2.png\" alt=\"Prototype of vTask2_handler, xTaskCreate\" width=\"744\" height=\"396\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-6-2.png 1915w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-6-2-300x160.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-6-2-768x409.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-6-2-1024x545.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-6-2-600x319.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-6-2-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-6-2-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-6-2-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-6-2-400x213.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-6-2-800x426.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-6-2-1200x639.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6038\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. Prototype of vTask2_handler.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Give the prototype of Task 1 handler and Task 2 handler in main.c.<\/span><\/p>\n<pre class=\"color-5-text-contrast color5-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px inset;\"><span style=\"color: #ff99cc;\">#include<\/span> \"stm32f4xx.h\"\r\n\r\n<span style=\"color: #ff99cc;\">#include<\/span> \"FreeRTOS.h\"\r\n<span style=\"color: #ff99cc;\">#include<\/span> \"task.h\"\r\n\r\n<span style=\"color: #33cccc;\">TaskHandle_t<\/span> xTaskHandle1=NULL;\r\n<span style=\"color: #33cccc;\">TaskHandle_t<\/span> xTaskHandle2=NULL;\r\n\r\n<strong><span style=\"color: #008000;\">\/\/Task functions prototypes<\/span><\/strong>\r\n<strong><span style=\"color: #ff99cc;\">void<\/span> vTask1_handler(<span style=\"color: #ff99cc;\">void<\/span> *params);<\/strong>\r\n<strong><span style=\"color: #ff99cc;\">void<\/span> vTask2_handler(<span style=\"color: #ff99cc;\">void<\/span> *params);\r\n\r\n<\/strong><span style=\"color: #ff99cc;\">int<\/span> main(<span style=\"color: #ff99cc;\">void<\/span>)\r\n{<\/pre>\n<p class=\"\" style=\"text-align: center;\"><span style=\"color: #000000;\">Prototype of Task 1 and Task 2 in main.c<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now let\u2019s try to build this code (Figure 5), and let\u2019s see how this goes.<\/span><\/p>\n<figure id=\"attachment_6041\" aria-describedby=\"caption-attachment-6041\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6041\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/05\/Figure-8-1.png\" alt=\"Building the project, xTaskCreate\" width=\"744\" height=\"396\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-8-1.png 1917w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-8-1-300x160.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-8-1-768x409.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-8-1-1024x545.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-8-1-600x320.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-8-1-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-8-1-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-8-1-200x107.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-8-1-400x213.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-8-1-800x426.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-8-1-1200x639.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6041\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. Building the project.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In Figure 6, you can see that the project was built successfully without any errors.<\/span><\/p>\n<figure id=\"attachment_6040\" aria-describedby=\"caption-attachment-6040\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6040\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/05\/Figure-9-1.png\" alt=\"Result of compilation, xTaskCreate\" width=\"744\" height=\"397\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-9-1.png 1919w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-9-1-300x160.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-9-1-768x409.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-9-1-1024x546.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-9-1-600x320.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-9-1-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-9-1-500x267.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-9-1-200x107.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-9-1-400x213.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-9-1-800x426.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-9-1-1200x640.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6040\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 6. Result of compilation.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><b>Summary:<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here we created two tasks. The name of the first task is Task 1, and the name of the second task is Task 2. When Task 1 runs, it actually executes vTask1_handler, and when Task 2 runs, it executes vTask2_handler. Task 1 consumes configMINIMAL_STACK_SIZE words of the stack in the RAM of the microcontroller, and Task 2 also consumes the same amount of the stack memory on the RAM of the microcontroller. Both the tasks have equal priorities, i.e., 2. &amp;xTaskHandle1 and &amp;xTaskHandle2 are the task handles in order to handle the task we created.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">After that, vTask1_handler and vTask2_handler are the task handlers. Remember that, in FreeRTOS, the task handler should never return since they will always be running. That\u2019s why let\u2019s keep while(1) in the task handlers, as shown in Figure 7.<\/span><\/p>\n<figure id=\"attachment_6042\" aria-describedby=\"caption-attachment-6042\" style=\"width: 744px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6042\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2021\/05\/Figure-10-1.png\" alt=\"Creating FreeRTOS Tasks Part-2, xTaskCreate\" width=\"744\" height=\"395\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-10-1.png 1917w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-10-1-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-10-1-768x407.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-10-1-1024x543.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-10-1-600x318.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-10-1-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-10-1-500x265.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-10-1-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-10-1-400x212.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-10-1-800x424.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-10-1-1200x637.png 1200w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><figcaption id=\"caption-attachment-6042\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 7. Placing infinite loops inside the task handlers.<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 20px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">Click here:<\/span>&nbsp;<span style=\"color: #000080;\"><a style=\"color: #000080;\" href=\"https:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\">https:\/\/fastbitlab.com\/course1<\/a><\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Exercise: Creating FreeRTOS Tasks Part-2 &nbsp; &nbsp; After creating a task using xTaskCreate, you may observe lots of red lines, as shown below. This is because before using any FreeRTOS related header file, that means the header file related to different services like tasks, queues, semaphores, mutexes, etc. always include the main header file, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6033,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[19],"class_list":["post-6030","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-freertos-lectures","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>FreeRTOS Lecture 29 - Exercise: Creating FreeRTOS Tasks Part-2<\/title>\n<meta name=\"description\" content=\"The step-by-step process of creating FreeRTOS task in your embedded project. Learn how to include essential headers, configure task creation\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FreeRTOS Lecture 29 - Exercise: Creating FreeRTOS Tasks Part-2\" \/>\n<meta property=\"og:description\" content=\"The step-by-step process of creating FreeRTOS task in your embedded project. Learn how to include essential headers, configure task creation\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-26T08:48:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-02T10:48:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-1-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1917\" \/>\n\t<meta property=\"og:image:height\" content=\"1021\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"FreeRTOS Lecture 29 &#8211; Exercise: Creating FreeRTOS Tasks Part-2\",\"datePublished\":\"2021-05-26T08:48:21+00:00\",\"dateModified\":\"2023-09-02T10:48:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/\"},\"wordCount\":571,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Figure-1-2.png\",\"keywords\":[\"FreeRTOS Lectures\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/\",\"name\":\"FreeRTOS Lecture 29 - Exercise: Creating FreeRTOS Tasks Part-2\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Figure-1-2.png\",\"datePublished\":\"2021-05-26T08:48:21+00:00\",\"dateModified\":\"2023-09-02T10:48:25+00:00\",\"description\":\"The step-by-step process of creating FreeRTOS task in your embedded project. Learn how to include essential headers, configure task creation\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Figure-1-2.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Figure-1-2.png\",\"width\":1917,\"height\":1021,\"caption\":\"Figure 1. Creation of task 1 by using xTaskCreate() API.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FreeRTOS Lecture 29 &#8211; Exercise: Creating FreeRTOS Tasks Part-2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FreeRTOS Lecture 29 - Exercise: Creating FreeRTOS Tasks Part-2","description":"The step-by-step process of creating FreeRTOS task in your embedded project. Learn how to include essential headers, configure task creation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/","og_locale":"en_US","og_type":"article","og_title":"FreeRTOS Lecture 29 - Exercise: Creating FreeRTOS Tasks Part-2","og_description":"The step-by-step process of creating FreeRTOS task in your embedded project. Learn how to include essential headers, configure task creation","og_url":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2021-05-26T08:48:21+00:00","article_modified_time":"2023-09-02T10:48:25+00:00","og_image":[{"width":1917,"height":1021,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-1-2.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"FreeRTOS Lecture 29 &#8211; Exercise: Creating FreeRTOS Tasks Part-2","datePublished":"2021-05-26T08:48:21+00:00","dateModified":"2023-09-02T10:48:25+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/"},"wordCount":571,"commentCount":1,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-1-2.png","keywords":["FreeRTOS Lectures"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/","url":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/","name":"FreeRTOS Lecture 29 - Exercise: Creating FreeRTOS Tasks Part-2","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-1-2.png","datePublished":"2021-05-26T08:48:21+00:00","dateModified":"2023-09-02T10:48:25+00:00","description":"The step-by-step process of creating FreeRTOS task in your embedded project. Learn how to include essential headers, configure task creation","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-1-2.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2021\/05\/Figure-1-2.png","width":1917,"height":1021,"caption":"Figure 1. Creation of task 1 by using xTaskCreate() API."},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/freertos-lecture-29-exercise-creating-freertos-tasks-part-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"FreeRTOS Lecture 29 &#8211; Exercise: Creating FreeRTOS Tasks Part-2"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=6030"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6030\/revisions"}],"predecessor-version":[{"id":15440,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6030\/revisions\/15440"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/6033"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=6030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=6030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=6030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}