-
Home
- Ti dsp/bios lab
- Lab 2
- Tsk sem lab
The module is a lab assignment to better understand the TI DSP/BIOS TSK and SEM modules.
Introduction
This lab module will help you become familiar with the TI DSP/BIOS TSK module and SEM module.
Reading
- SPRU423 TMS320 DSP/BIOS Users Guide: Read the sections on Semaphores and Tasks.
Lab module prerequisites
None
Laboratory
Part 1
- In this part we will create two tasks that will have the same priority and will run independent of each other.
- Follow the procedure in
Code Composer Studio v4 DSP/BIOS Project to create a new CCS DSP/BIOS project. Name the project
tsklab
. Your project should have a DSP/BIOS configuration file named
tsklab.tcf
.
- Create a LOG object by right clicking on Instrumentation->LOG and selecting Insert LOG. Change the name to
trace
. Set its properties to have a length of 128 and be a fixed buffer.
- Create two TSKs with the following properties
- Name:
TSK0
, priority: 1, function:
_funTSK0
.
- Name:
TSK1
, priority: 1, function:
_funTSK1
.
- Create a
main.c
file and include a
main
function that does nothing.
- In the
main.c
file make functions for your TSKs,
funTSK0
and
funTSK1
. Each function should print to the
trace
LOG object once at the beginning of the function to indicate that the particular TSK is starting and once at the end of the function to indicate that the particular TSK is ending.
- Add code to each task that loops 5 times and prints to
trace
the task number and the loop number each time through the loop. It should look something like:
TSK0 Number 0
TSK0 Number 1...
- The basic structure of
main.c
should be:
#include<std.h>#include "tsklabcfg.h"void main()
{}void funTSK0()
{/* code here */
}void funTSK1(){
/* code here */}
- Start the debug session.
- Open the log view by selecting
Tools->RTA->Printf Logs .
- Run the program and record the results.
Part 2
- In this part we will change the tasks so that they yield to each other within their loops.
- Have in your system two TSKs with the following properties
- Name:
TSK0
, priority: 1, function:
_funTSK0
.
- Name:
TSK1
, priority: 1, function:
_funTSK1
.
- Each yields to the other in their loop.
- Copy the
main.c
file from above to a new file
main2.c
. Exclude the
main.c
from your project build.
- Change the code so that the two tasks yield to each other within the loop. Put a print statement before the yield and one after the yield so you will know when the function has completed the loop. Do this for subsequent parts of this lab also.
- Start the debug session.
- Open the log view by selecting
Tools->RTA->Printf Logs .
- Run the program and record the results.
Part 3
- In this part we will change the tasks so that one is a higher priority than the other. They yield to each other in their loops.
- Have in your system two TSKs with the following properties
- Name:
TSK0
, priority: 2, function:
_funTSK0
.
- Name:
TSK1
, priority: 1, function:
_funTSK1
.
- Each yields to the other in their loop.
- This part will still be executing
main2.c
.
- Set
TSK0
to a higher priority than the other.
- Start the debug session.
- Open the log view by selecting
Tools->RTA->Printf Logs .
- Run the program and record the results.
- Does the execution appear different from part 2?
Source:
OpenStax, Ti dsp/bios lab. OpenStax CNX. Sep 03, 2013 Download for free at http://cnx.org/content/col11265/1.8
Google Play and the Google Play logo are trademarks of Google Inc.