// Function that creates a task.\r
void vOtherFunction( void )\r
{\r
- unsigned char ucParameterToPass;\r
+ static unsigned char ucParameterToPass;\r
xTaskHandle xHandle;\r
\r
- // Create the task, storing the handle.\r
+ // Create the task, storing the handle. Note that the passed parameter ucParameterToPass\r
+ // must exist for the lifetime of the task, so in this case is declared static. If it was just an\r
+ // an automatic stack variable it might no longer exist, or at least have been corrupted, by the time\r
+ // the new time attempts to access it.\r
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, &ucParameterToPass, tskIDLE_PRIORITY, &xHandle );\r
\r
// Use the handle to delete the task.\r