Getting Started with μC/OS-III
Depending on the value of #define constants, μC/OS-III will create the statistic
task ( OS_StatTask() ), the timer task ( OS_TmrTask() ), and the interrupt
handler queue management task ( OS_IntQTask() ). Those are discussed in
Chapter 5, “Task Management” on page 75.
Most of μC/OS-III’s functions return an error code via a pointer to an OS_ERR
variable, err in this case. If OSInit() was successful, err will be set to
OS_ERR_NONE . If OSInit() encounters a problem during initialization, it will
return immediately upon detecting the problem and set err accordingly. If this
occurs, look up the error code value in OS.H . Specifically, all error codes start
with OS_ERR_ .
It is important to note that OSInit() must be called before any other μC/OS-III
function.
L3-2(3)
Create a task by calling OSTaskCreate() . OSTaskCreate() requires 13
arguments. The first argument is the address of the OS_TCB that is declared for this
task. Chapter 5, “Task Management” on page 75 provides additional information
about tasks.
L3-2(4)
OSTaskCreate() allows a name to be assigned to each of the tasks. μC/OS-III
stores a pointer to the task name inside the OS_TCB of the task. There is no
limit on the number of ASCII characters used for the name.
L3-2(5)
The third argument is the address of the task code. A typical μC/OS-III task is
implemented as an infinite loop as shown:
void MyTask (void *p_arg)
{
/* Do something with “p_arg”.
while (1) {
/* Task body */
}
}
The task receives an argument when it first starts. As far as the task is
concerned, it looks like any other C function that can be called by the code.
However, the code must not call MyTask() . The call is actually performed
through μC/OS-III.
55
相关PDF资料
AD-UCUSBD-SPRD PRD LIC UCUSB DEV CORE CCES SGL
AD637-EVALZ BOARD EVALUATION FOR AD637
AD736-EVALZ BOARD EVALUATION FOR AD736
AD737-EVALZ BOARD EVALUATION FOR AD737
AD8007AKS-EBZ BOARD EVAL FOR AD8007AKS
AD8018ARU-EVAL BOARD EVAL FOR AD8018
AD8034ART-EBZ BOARD EVAL FOR AD8034ART
AD8040AR-EBZ BOARD EVAL FOR AD8040AR
相关代理商/技术参数
ADUCOSC100 制造商:Analog Devices 功能描述:ADC - Rail/Tube
ADUCOSC100-REEL 功能描述:DAC MICROCONVERTER DUAL TSSOP 制造商:analog devices inc. 系列:* 零件状态:上次购买时间 标准包装:1
ADUCOSC100-REEL7 功能描述:DAC MICROCONVERTER DUAL TSSOP 制造商:analog devices inc. 系列:* 零件状态:上次购买时间 标准包装:1
ADUCOSCZ100 制造商:Analog Devices 功能描述:
ADUCOSCZ100-REEL7 制造商:Analog Devices 功能描述:ANAADUCOSCZ100-REEL7 12 BIT ADC WITH EMB
ADuC-P7026 功能描述:开发板和工具包 - ARM PROTOTYPE BRD FOR ADUC7026 ARM7 RoHS:否 制造商:Arduino 产品:Development Boards 工具用于评估:ATSAM3X8EA-AU 核心:ARM Cortex M3 接口类型:DAC, ICSP, JTAG, UART, USB 工作电源电压:3.3 V
ADUCRF101 制造商:Analog Devices 功能描述:PRECISION ANALOG MICRCONTROLLER - Tape and Reel
ADUCRF101BCPZ128 制造商:Analog Devices 功能描述:PRECISION ANALOG MICROCONTROLLER WITH RF TRANSCEIVER, ARM CO - Trays