Difference between a task and a task function


Assignment Task 1:

Difference between a task and a task function a task is an "executing instance" of a task function; a task occupies memory with its own stack space and text space; whereas a task function is simply a template for how to construct a task in memory

EXERCISE: modify board.h/board.c so that we can access the LPC1769 red and blue LEDs

GPIOs are bit-mapped in an embedded system--- there is a register corresponding to each GPIO port; each BIT of the register corresponds to one of the GPIO pins

for reference: Red LED (P0.22), Green LED (P3.25), Blue LED (P3.26)

be careful how you modify your board.h/board.c libraries because others will use them! --- you will find these libraries in the lpcboard1769 project !

We are dealing with two APIs:

1) NXP LPCXpresso API

2) FreeRTOS API

Please download the tutorial video on changing the NXP board driver code (Part 1), found on the github repository...

Part 2 video just uploaded! Please watch as well...

Please download "getting started with FreeRTOS Blinky" video and watch...

Note that FreeRTOSConfig.h is a "local" parameters file that is specific to a project (in other words, it's "your file" rather than a part of the FreeRTOS API)

FreeRTOS special API delay functions: vTaskDelay(), vTaskDelayUntil() --- these are ways to put a task in Block state

from task.h:

#define tskIDLE_PRIORITY( ( unsigned portBASE_TYPE ) 0U )

If you use a for-loop instead of vTaskDelay() or vTaskDelayUntil() to create a time delay, your task does not go into Block state. Remember that Block means that the task does not need to run for a particular length of time. In other words, if your highest priority task does not have a vTaskDelay() or vTaskDelayUntil() call in it, it will never allow another task to run!

In FreeRTOS, you must make the task Block state EXPLICIT! You need to use the API functions like vTaskDelay() or vTaskDelayUntil() to create a Block state.

Task:

Compose a FreeRTOS application that flashes the LPC1769 RGB LED as follows:

0) all LEDs OFF

1) RED LED On for 1 second

2) all LEDs are off 0.5 seconds

3) GREEN LED On for 1 second

4) all LEDs are off 0.5 seconds

5) BLUE LED On for 1 second

6) all LEDs are off for 0.5 seconds

7) go to 1)

NOTE: there can be no color overlapping. While any given colour is on, there is no other colour on.

Do it using THREE LED task functions and THREE LED tasks. Moreover, you must prioritize the tasks as follows:

RED LED Task priority = 3

GREEN LED Task priority = 2

BLUE LED Task priority = 1

HINT: Use vTaskDelay() in each task to help you accomplish this--- it may be helpful to draw out a timing diagram for this problem!!!

Assignment Task 2:

FreeRTOS Enhanced Blinky Project

Now that you're getting a handle on FreeRTOS applications, your next assignment should take your embedded-C RTOS skills another step higher.

See if you can refine your non-overlapping-colours Blinky project so that only one task function is needed (you will need to use pvParameters). Strive to make your code as streamlined as possible.

Next, for periodic applications, vTaskDelayUntil() is preferred, because it operates on a kind of absolute clock (rather than relative to when it was last called). Read up on vTaskDelayUntil() in the Mastering FreeRTOS documentation, and modify your code to incorporate this function, rather than vTaskDelay().

Finally, look into incorporating two buttons in your project. Look at the schematic of the LPC1769 board provided in the documentation folder of the teaching repository on github.com. Identify two GPIOs that you can use for push buttons. Check out board.h/board.c to identify suitable API functions to setup your GPIO pins as inputs and include (if possible) internal pull-up or pull-down resistors. Now, designate one button to increase the 0.5-second sampling period of this application. The other button should decrease the interval. Use steps corresponding to 125-milliseconds, and the minimum allowed sampling period should be 0.125 seconds (corresponding to 125 ticks). Allow a user to adjust the period of your program and record the results.

Attachment:- Task and task function.rar

Request for Solution File

Ask an Expert for Answer!!
Other Subject: Difference between a task and a task function
Reference No:- TGS03051803

Expected delivery within 24 Hours