Difference between revisions of "Embedded System Tutorial Tasks"
From Embedded Systems Learning Academy
Line 9: | Line 9: | ||
} | } | ||
+ | // Create another task and run this code in a while(1) loop | ||
void task_two_code(void) | void task_two_code(void) | ||
{ | { |
Revision as of 21:45, 13 January 2018
The objective of the assignment is to create multiple tasks and observe how they behave. Please create two tasks, and have them run the following code:
// Create a task and run this code in a while(1) loop
void task_one_code(void)
{
uart0_puts("aaaaaaaaaaaaaaaaaaaa");
vTaskDelay(100);
}
// Create another task and run this code in a while(1) loop
void task_two_code(void)
{
uart0_puts("bbbbbbbbbbbbbbbbbbbb");
vTaskDelay(100);
}
Further Guidelines
- Use FreeRTOS xTaskCreate() to create tasks and use example code for reference.
- You may have to take some things for granted, such as "stack size" and 2048 bytes is enough stack size to run these tasks
- Use vTaskDelay() to "sleep"
- Do not use printf, instead use uart0_puts() function from #include "uart0_min.h"
Hints
- The printf data appears over 38400bps UART, which can roughly send 4 characters per millisecond
- When you send 20 chars (aaaaaaaaaaaaaaaaaaaa), it would take roughly 5ms to send the data
- The SJ-One board RTOS runs at 1Khz
Assignment
Observe and turn in with your assignment:
- How come 4(or 3 sometimes) characters are printed from each task? Why not 2 or 5, or 6?
- Alter the priority of one of the tasks, and note down the observations. Note down WHAT you see and WHY.
Turn in (to Canvas):
- Relevant code
- Your observation and explanation
- Snapshot of the output for all scenarios.