Keil RTX51 User manual

Preface 1
Preface
This manual explains how to use the RTX51 Tiny Real-Time Operating System and gives
an overview of the functionality of RTX51 Full. The manual is not a detailed introduc-
tion to real-time applications and assumes that you are familiar with Keil C51, A51, the
related Utilities, the DOS operating system and the hardware and instruction set of the
8051 microcontrollers.
The following literature is recommended as an extensive introduction in the area of real-
time programming:
Deitel, H.M., Operating Systems, second edition,
Addison-Wesley Publishing Company, 1990
Ripps, David, A Guide to Real-Time Programming, Englewood Cliffs, N.J,
Prentice Hall, 1988/
Allworth, S.T., Introduction to Real-Time Software Design,
Springer-Verlag Inc., New York
This user’s guide contains 6 parts:
Part 1: Overview, describes the functionality of a the RTX51 real-time opeating
systems and discusses the basic features and differences of RTX51 Tiny and
RTX51 Full. Also included are the technical data of RTX51 Full and
RTX51 Tiny.
Part 2: Requirements and Definitions, discusses the development tools and the
target system requirements of RTX51 Tiny, explains the terms used in the
the RTX51 Tiny manual and decribes the task definition.
Part 3: Creating RTX51 Tiny Applicaitons, describes the steps necessary to cre-
ate RTX51 Tiny applications.
Part 4: Library Functions, provides a reference for all RTX51 Tiny library rou-
tines.
Part 5: System Debugging, describes the stack handling of RTX51 Tiny and con-
tains information about the system debugging.
Part 6: Applications Examples, contains several examples using RTX51 Tiny and
describes the software development process. This information can be used
as a guideline for your real-time designs.

2Contents
OVERVIEW..........................................................................................................7
Introduction ............................................................................................................... 7
Single Task Program.................................................................................................. 8
Round-Robin Program............................................................................................... 8
Round-Robin Scheduling With RTX51..................................................................... 8
RTX51 Events ........................................................................................................... 9
Compiling and Linking with RTX51....................................................................... 11
REQUIREMENTS AND DEFINITIONS ..............................................................15
Development Tool Requirements............................................................................................................ 15
Target System Requirements................................................................................................................... 15
Interrupt Handling ................................................................................................... 15
Reentrant Functions................................................................................................. 16
C51 Library Functions............................................................................................. 16
Usage of Multiple Data Pointers and Arithmetic Units ........................................... 16
Registerbanks........................................................................................................... 17
Task Definition ....................................................................................................................................... 17
Task Management................................................................................................................................... 17
Task Switching ........................................................................................................ 18
Events...................................................................................................................... 18
CREATING RTX51 TINY APPLICATIONS ........................................................21
RTX51 Tiny Configuration..................................................................................................................... 21
Compiling RTX51 Tiny Programs.......................................................................................................... 23
Linking RTX51 Tiny Programs .............................................................................................................. 23
Optimizing RTX51 Tiny Programs......................................................................................................... 23
RTX51 TINY SYSTEM FUNCTIONS..................................................................25
Function Reference ................................................................................................................................. 26
isr_send_signal.................................................................................................................................. 27
os_clear_signal.................................................................................................................................. 28

Preface 3
os_create_task....................................................................................................................................29
os_delete_task....................................................................................................................................30
os_running_task_id............................................................................................................................31
os_send_signal...................................................................................................................................32
os_wait...............................................................................................................................................34
os_wait1.............................................................................................................................................36
os_wait2.............................................................................................................................................37
SYSTEM DEBUGGING......................................................................................41
Stack Management...................................................................................................................................41
Debugging with dScope-51......................................................................................................................41
APPLICATION EXAMPLES...............................................................................45
RTX_EX1: Your First RTX51 Program.................................................................................................45
RTX_EX2: A Simple RTX51 Application.............................................................................................47
TRAFFIC: A Traffic Light Controller....................................................................................................49
Traffic Light Controller Commands.........................................................................49
Software ...................................................................................................................49
Compiling and Linking TRAFFIC............................................................................62
Testing and Debugging TRAFFIC ...........................................................................62


RTX Tiny 5
1
Notational Conventions
This manual uses the following format conventions:
Examples Description
BL51 Bold capital texts used for the names of executable programs, data files,
source files, environment variables, and other commands entered at the
DOS command prompt. This text usually represents commands that you
must type in literally. For example:
CLS DIR DS51.INI
C51 A51 SET
Note that you are not actually required to enter these commands using all
capital letters.
Courier Text in this typeface is used to represent the appearance of information
that would be displayed on the screen or printed on the printer.
This typeface is also used within the text when discussing or describing
items which appear on the command line.
KEYS Text in this typeface represents actual keys on the keyboard. For
example, “Press Enter to Continue.”
ALT+<x> Indicates an Alt key combination; the Alt and the <x> key must be
simultaneously pressed.
CTRL+<x> Indicates an control key combination; the Ctrl and the <x> key must be
simultaneously pressed.


RTX Tiny 7
1
Overview
RTX51 is a multitasking real-time operating system for the 8051 family of processors.
RTX51 simplifies software design of complex, time-critical projects.
There are two distinct versions of RTX51 available:
RTX51 Full Performs both round-robin and preemptive task switching using up
to four task priorities. RTX51 works in parallel with interrupt
functions. Signals and messages may be passed between tasks us-
ing a mailbox system. You can allocate and free memory from a
memory pool. You can force a task to wait for an interrupt, time-
out, or signal or message from another task or interrupt.
RTX51 Tiny Is a subset of RTX51 that will easily run on single-chip 8051 sys-
tems without any external data memory. RTX51 Tiny supports
many of the features found in RTX51 with the following excep-
tions: RTX51 Tiny only supports round-robin and the use of sig-
nals for task switching. Preemptive task switching is not sup-
ported. No message routines are included. No memory pool allo-
cation routines are available.
The remainder of this chapter uses RTX51 to refer to both variants. Differences between
the two are so stated in the text as their need becomes applicable.
Introduction
Many microcontroller applications require simultaneous execution of multiple jobs or
tasks. For such applications, a real-time operating system (RTOS) allows flexible sched-
uling of system resources (CPU, memory, etc.) to several tasks. RTX51 implements a
powerful RTOS which is easy to use. RTX51 works with all 8051 derivatives.
You write and compile RTX51 programs using standard C constructs and compiling them
with C51. Only a few deviations from standard C are required in order to specify the task
ID and priority. RTX51 programs also require that you include the real-time executive
header file and link using the BL51 Linker/Locator and the appropriate RTX51 library
file.

8RTX51 Real-Time Operating System
1Single Task Program
A standard C program starts execution with the main function. In an embedded applica-
tion, main is usually coded as an endless loop and can be thought of as a single task which
is executed continuously. For example:
int counter;
void main (void) {
counter = 0;
while (1) { /* repeat forever */
counter++; /* increment counter */
}
}
Round-Robin Program
A more sophisticated C program may implement what is called a round-robin pseudo-
multitasking scheme without using a RTOS. In this scheme, tasks or functions are called
iteratively from within an endless loop. For example:
int counter;
void main (void) {
counter = 0;
while (1) { /* repeat forever */
check_serial_io ();
process_serial_cmds (); /* process serial input */
check_kbd_io ();
process_kbd_cmds (); /* process keyboard input */
adjust_ctrlr_parms (); /* adjust the controller */
counter++; /* increment counter */
}
}
Round-Robin Scheduling With RTX51
RTX51 also performs round-robin multitasking which allows quasi-parallel execution of
several endless loops or tasks. Tasks are not executed concurrently but are time-sliced.
The available CPU time is divided into time slices and RTX51 assigns a time slice to
every task. Each task is allowed to execute for a predetermined amount of time. Then,
RTX51 switches to another task that is ready to run and allows that task to execute for a
while. The time slices are very short, usually only a few milliseconds. For this reason, it
appears as though the tasks are executing simultaneously.

RTX Tiny 9
1
RTX51 uses a timing routine which is interrupt driven by one of the 8051 hardware tim-
ers. The periodic interrupt that is generated is used to drive the RTX51 clock.
RTX51 does not require you to have a main function in your program. It will automati-
cally begin executing task 0. If you do have a main function, you must manually start
RTX51 using the os_create_task function in RTX51 Tiny and the os_start_system
function in RTX51.
The following example shows a simple RTX51 application that uses only round-robin
task scheduling. The two tasks in this program are simple counter loops. RTX51 starts
executing task 0 which is the function names job0. This function adds another task
called job1. After job0 executes for a while, RTX51 switches to job1. After
job1 executes for a while, RTX51 switches back to job0. This process is repeated in-
definitely.
#include <rtx51tny.h>
int counter0;
int counter1;
void job0 (void) _task_ 0 {
os_create (1); /* mark task 1 as ready */
while (1) { /* loop forever */
counter0++; /* update the counter */
}
}
void job1 (void) _task_ 1 {
while (1) { /* loop forever */
counter1++; /* update the counter */
}
}
RTX51 Events
Rather than waiting for a task’s time slice to be up, you can use the os_wait function to
signal RTX51 that it can let another task begin execution. This function suspends execu-
tion of the current task and waits for a specified event to occur. During this time, any
number of other tasks may be executing.
Using Time-outs with RTX51
The simplest event you can wait for with the os_wait function is a time-out period in
RTX51 clock ticks. This type of event can be used in a task where a delay is required.
This could be used in code that polled a switch. In such a situation, the switch need only
be checked every 50ms or so.
The next example shows how you can use the os_wait function to delay execution while
allowing other tasks to execute.

10 RTX51 Real-Time Operating System
1#include <rtx51tny.h>
int counter0;
int counter1;
void job0 (void) _task_ 0 {
os_create (1); /* mark task 1 as ready */
while (1) { /* loop forever */
counter0++; /* update the counter */
os_wait (K_TMO, 3); /* pause for 3 clock ticks */
}
}
void job1 (void) _task_ 1 {
while (1) { /* loop forever */
counter1++; /* update the counter */
os_wait (K_TMO, 5); /* pause for 5 clock ticks */
}
}
In the above example, job0 enables job1 as before. But now, after incrementing
counter0, job0 calls the os_wait function to pause for 3 clock ticks. At this time,
RTX51 switches to the next task, which is job1. After job1 increments counter1,
it too calls os_wait to pause for 5 clock ticks. Now, RTX51 has no other tasks to exe-
cute, so it enters an idle loop waiting for 3 clock ticks to elapse before it can continue
executing job0.
The result of this example is that counter0 gets incremented every 3 timer ticks and
counter1 gets incremented every 5 timer ticks.
Using Signals with RTX51
You can use the os_wait function to pause a task while waiting for a signal (or binary
semaphore) from another task. This can be used for coordinating two or more tasks.
Waiting for a signal works as follows: If a task goes to wait for a signal, and the signal
flag is 0, the task is suspended until the signal is sent. If the signal flag is already 1 when
the task queries the signal, the flag is cleared, and execution of the task continues. The
following example illustrates this:
#include <rtx51tny.h>
int counter0;
int counter1;
void job0 (void) _task_ 0 {
os_create (1); /* mark task 1 as ready */
while (1) { /* loop forever */
if (++counter0 == 0) /* update the counter */
os_send_signal (1); /* signal task 1 */
}
}

RTX Tiny 11
1
void job1 (void) _task_ 1 {
while (1) { /* loop forever */
os_wait (K_SIG, 0, 0); /* wait for a signal */
counter1++; /* update the counter */
}
}
In the above example, job1 waits until it receives a signal from any other task. When it
does receive a signal, it will increment counter1 and again wait for another signal.
job0 continuously increments counter0 until it overflows to 0. When that happens,
job0 sends a signal to job1 and RTX51 marks job1 as ready for execution. job1
will not be started until RTX51 gets its next timer tick.
Priorities and Preemption
One disadvantage of the above program example is that job1 is not started immediately
when it is signaled by job0. In some circumstances, this is unacceptable for timing rea-
sons. RTX51 allows you to assign priority levels to tasks. A task with a higher priority
will interrupt or pre-empt a lower priority task whenever it becomes available. This is
called preemptive multitasking or just preemption.
NOTE Preemption and priority levels are not supported by RTX51 Tiny.
You can modify the above function declaration for job1 to give it a higher priority than
job0. By default, all tasks are assigned a priority level of 0. This is the lowest priority
level. The priority level can be 0 through 3. The following example shows how to define
job1 with a priority level of 1.
void job1 (void) _task_ 1 _priority_ 1 {
while (1) { /* loop forever */
os_wait (K_SIG, 0, 0); /* wait for a signal */
counter1++; /* update the counter */
}
}
Now, whenever job0 sends a signal to job1, job1 will start immediately.
Compiling and Linking with RTX51
RTX51 is fully integrated into the C51 programming language. This makes generation of
RTX51 applications very easy to master. The previous examples are executable RTX51
programs. You do not need to write any 8051 assembly routines or functions. You only
have to compile your RTX51 programs with C51 and link them with the BL51
Linker/Locator. For example, you should use the following command lines if you are
using RTX51 Tiny.
C51 EXAMPLE.C
BL51 EXAMPLE.OBJ RTX51TINY
Use the following command lines to compile and link using RTX51.

12 RTX51 Real-Time Operating System
1C51 EXAMPLE.C
BL51 EXAMPLE.OBJ RTX51
Interrupts
RTX51 works in parallel with interrupt functions. Interrupt functions can communicate
with RTX51 and can send signals or messages to RTX51 tasks. RTX51 Full allows the
assignment of interrupts to a task.
Message Passing
RTX51 Full supports the exchange of messages between tasks with the functions: SEND
& RECEIVE MESSAGE and WAIT for MESSAGE. A message is a 16-bit value, which
can be interpreted as a number or as a pointer to a memory block. RTX51 Full supports
variable sized messages with a memory pool system.
CAN Communication
Controller Area Networks are easily implemented with RTX51/CAN. RTX51/CAN is a
CAN task integrated into RTX51 Full. A RTX51 CAN task implements message passing
via the CAN network. Other CAN stations can be configured either with or without
RTX51.
BITBUS Communication
RTX51 Full covers Master and Slave BITBUS tasks supporting message passing with the
Intel 8044.
Events
RTX51 supports the following events for the WAIT function:
•Timeout: Suspends the running task for a defined amount of clock ticks.
•Interval: (RTX51 Tiny only) is similar to timeout, but the software timer is not
reset to allow generation of periodic intervals (required for clocks).
•Signal: For inter task coordination.
•Message: (RTX51 Full only) for exchange of messages.
•Interrupt: (RTX51 Full only) A task can wait for 8051 hardware interrupts.
•Semaphore: (RTX51 Full only) binary semaphores for management of shared
system resources.

RTX Tiny 13
1
RTX51 Functions
The following table shows all RTX51 functions; RTX51 Tiny supports only the functions
marked with (*). (Timings are measured with RTX51 Full)
Execution Time
Function Description (cycles)
os_create (*) move a task to execution queue 302
os_delete (*) remove a task from execution queue 172
os_send_signal (*) send a signal to a task (call from tasks) 408 with task switch.
316 with fast task switch
71 without task switch
os_clear_signal (*) delete a sent signal 57
isr_send_signal (*) send a signal to a task (call from interrupt) 46
os_wait (*) wait for event 68 for pending signal
160 for pending mes-
sage
os_attach_interrupt assign task to interrupt source 119
os_detach_interrupt remove interrupt assignment 96
os_disable_isr disable 8051 hardware interrupts 81
os_enable_isr enable 8051 hardware interrupts 80
os_send_message/ send a message or set a semaphore (call 443 with task switch
os_send_token from task) 343 with fast task switch
94 without task switch
isr_send_message send a message (call from interrupt) 53
isr_recv_message receive a message (call from interrupt) 71 (with message)
os_create_pool define a memory pool 644 (size 20 * 10 bytes)
os_get_block get a block from a memory pool 148
os_free_block return a block to a memory pool 160
os_set_slice define RTX51 system clock value 67
Additional DEBUG and SUPPORT functions: check_mailboxes, check_task,
check_tasks, check_mail, check_pool, set_int_mask, reset_int_mask.
CAN Functions (only available with RTX51 Full)
CAN controllers supported: Philips 82C200, 80C592 and Intel 82526 (more CAN con-
trollers in preparation).
CAN Function Description
can_task_create create the CAN communication task
can_hw_init CAN controller hardware initialization
can_def_obj define the communication objects
can_start / can_stop start and stop the CAN communication
can_send send an object over the CAN bus
can_write write new data to an object without sending it
can_read read an objects data direct
can_receive receive all not bound objects
can_bind_obj bind an object to a task; task is started when object is received
can_unbind_obj untie the binding between task and object
can_wait wait for receiving of a bound object
can_request send a remote frame for the specified object
can_get_status get the actual CAN controller status

14 RTX51 Real-Time Operating System
1Technical Data
Description RTX51 Full RTX51 Tiny
Number of tasks 256; max. 19 tasks active 16
RAM requirements 40 .. 46 bytes DATA 7 bytes DATA
20 .. 200 bytes IDATA (user stack) 3 * <task count> IDATA
min. 650 bytes XDATA
Code requirements 6KB .. 8KB 900 bytes
Hardware requirements timer 0 or timer 1 timer 0
System clock 1000 .. 40000 cycles 1000 .. 65535 cycles
Interrupt latency < 50 cycles < 20 cycles
Context switch time 70 .. 100 cycles (fast task) 100 .. 700 cycles
180 .. 700 cycles (standard task) depends on stack load
depends on stack load
Mailbox system 8 mailboxes with 8 int entries each not available
Memory pool system up to 16 memory pools not available
Semaphores 8 * 1 bit not available

RTX Tiny 15
2
Requirements and Definitions
The following chapter describes the software and hardware requiremens of RTX51 Tiny
and defines the terms used within this manual. RTX51 Tiny uses a combination of system
calls as well as the _task_ keyword for the task definition which is built in to the C51
compiler. The task definition and the major features of RTX51 Tiny are also described
within this chapter.
Development Tool Requirements
The following software products are required to operate RTX51 Tiny:
•C51 Compiler
•BL51 Code Banking Linker
•A51 Macro Assembler
The library file RTX51TNY.LIB must be stored in the library path specified with the
DOS envirionment variable C51LIB. Usually this is the directory C51\LIB.
The include file RTX51TNY.H must be stored in the include path specified with the
DOS envirionment variable C51INC. Usually this is the directory C51\INC.
Target System Requirements
RTX51 Tiny can run on single-chip 8051 systems without any external data memory.
However the application can access external memory. RTX51 Tiny can use all memory
models supported by C51. The selected memory model only influences the location of
application objects. The RTX51 Tiny system variables and the stack area of the applica-
tion are always stored in internal 8051 memory (DATA or IDATA). Typically, RTX51
Tiny applications are implemented in the SMALL model.
RTX51 Tiny performs round-robin task switching only. Preemptive task switching and
task priorities are not supported. If your application needs preemptive task switching you
need to use the RTX51 Full Real-Time Executive.
RTX51 Tiny is not designed for use with bank switching programs. If you require
real-time multitasking in your code banking applications you need to use the RTX51 Full
Real-Time Executive.
Interrupt Handling
RTX51 Tiny can operate parallel with interrupt functions. Similar to other 8051 applica-
tions, the interrupt source must be enabled in the 8051 hardware registers in order to trig-
ger for an interrupt. RTX51 Tiny does not contain any management for interrupts; for
this reason, the interrupt enable is sufficient to process interrupts.

16 Introduction to RTX51 Tiny
2
RTX51 Tiny uses the 8051 timer 0 and the timer 0 interrupt of the 8051. Globally dis-
abling all interrupts (EA bit) or the timer 0 interrupt stops therefore the operation of
RTX51 Tiny. Except for a few 8051 instructions, the timer 0 interrupt should not be dis-
abled.
Reentrant Functions
It is not allowed to call non-reentrant C functions from several tasks or interrupt proce-
dures. Non-reentrant C51 functions store their parameters and automatic variables (local
data) in static memory segments; for this reason, this data is overwritten when multiple
function calls occur simultaneously. Therefore non-reentrant C functions can only be call
for several tasks, if the user can ensure that they are not called recursive. Usally this
means that the Round-Robin task scheduling must be disabled and that such functions do
not call any RTX51 Tiny system functions.
C functions which are only using registers for parameter and automatic variables are in-
herently reentrant and can be called without any restrictions from different RTX51 Tiny
tasks.
The C51 Compiler provides also reentrant functions. Refer to the C51 User’s Manual for
more information. Reentrant functions store their parameters and local data variables on
a reentrant stack and the data are protected in this way against multiple calls. However,
RTX51 Tiny does not contain any management for the C51 reentrant stack. If you are
using reentrant functions in your application you must ensure that these functions do not
call any RTX51 Tiny system functions and that reentrant functions are not interrupted by
the Round-Robin task scheduling of RTX51 Tiny. The full version, RTX51 Full contains
a stack management for reentrant functions.
C51 Library Functions
All C51 library functions which are reentrant can be used in all tasks without any restric-
tions.
For C51 library functions which are non-reentrant the same restrictions apply as for non-
reentrant C functions. Refer to Reentrant Functions for more information.
Usage of Multiple Data Pointers and Arithmetic Units
The C51 compiler allows you to use Multiple Data Pointers and Arithmetic Units of vari-
ous 8051 derivatives. Since RTX51 Tiny does not contain any management for these
hardware components it is recommended that you are not using these components to-
gether with RTX51 Tiny. However you can use Multiple Data Pointers and Arithmetic
Units if you can ensure that there is no round-robin task during the execution of program
parts using such additional hardware components.

RTX Tiny 17
2
Registerbanks
RTX51 Tiny assigns all tasks to registerbank 0. For this reason, all task functions must
be compiled with the default setting of C51, REGISTERBANK (0). The interrupt func-
tions can use the remaining registerbanks. However, RTX51 Tiny requires 6 permanent
bytes in the registerbank area. The registerbank used by RTX51 Tiny for these bytes can
be defined with the configurarion variable INT_REGBANK. Refer to chapter 3, RTX51
Tiny configuration for more information.
Task Definition
Real-Time or multitasking applications are composed of one or more tasks that perform
specific operations. RTX51 Tiny allows for up to 16 tasks. Tasks are simply C functions
that have a void return type and a void argument list and are declared using the _task_
function attribute using the following format
void func (void) _task_ num
where num is a task ID number from 0 to 15.
Example:
void job0 (void) _task_ 0 {
while (1) {
counter0++; /* increment counter */
}
}
defines the function job0 to be task number 0. All that this task does is increment a
counter and repeat. You should note that all tasks are implemented as endless loops in
this fashion.
Task Management
Each task that you define for RTX51 Tiny can be in one of a number of different states.
The RTX51 Tiny Kernel maintains the proper state for each task. Following is a descrip-
tion of the different states.
State Description
RUNNING The task currently being executed is in the RUNNING State. Only one task can be
running at a time.
READY Tasks which are waiting to be executed are in the READY STATE. After the currently
running task has finished processing, RTX51 Tiny starts the next task that is ready.
WAITING Tasks which are waiting for an event are in the WAITING STATE. If the event occurs,
the task is placed into the READY STATE.
DELETED Tasks which are not started are in the DELETED STATE.
TIME-OUT Tasks which were interrupted by a round-robin time-out are placed in the TIME-OUT
STATE. This state is equivalent to the READY STATE.

18 Introduction to RTX51 Tiny
2
Task Switching
RTX51 Tiny performs round-robin multitasking which allows quasi-parallel execution of
several endless loops or tasks. Tasks are not executed concurrently but are time-sliced.
The available CPU time is divided into time slices and RTX51 Tiny assigns a time slice
to every task. Each task is allowed to execute for a predetermined amount of time. Then,
RTX51 Tiny switches to another task that is ready to run and allows that task to execute
for a while. The duration of a time slice can be defined with the configurarion variable
TIMESHARING. Refer to chapter 3, RTX51 Tiny configuration for more information.
Rather then wait for a task’s time slice to expire, you can use the os_wait system function
to signal RTX51 Tiny that it can let another task begin execution. os_wait suspends the
execution of the current task and waits for a specified event to occur. During this time,
any number of other tasks may be executing.
The section of RTX51 Tiny which assigns the processor to a task is called the scheduler.
The RTX51 Tiny scheduler defines which task is running according to the following
rules:
The currently running task is interrupted if…
1. The task calls the os_wait function and the specified event has not occurred.
2. The task has executed for longer than the defined round-robin time-out.
Another task is started if…
1. No other task is running.
2. The task which is to be started is in the READY or TIME-OUT State.
Events
The os_wait function of RTX51 Tiny supports the following event types:
SIGNAL:Bit for task communication. A signal can be set or cleared using RTX51
Tiny system functions. A task can wait for a signal to be set before con-
tinuing. If a task calls the os_wait function to wait for a signal and if the
signal is not set, the task is suspended until the signal gets set. Then, the
task is returned to the READY State and can begin execution.
TIMEOUT:A time delay which is started by the os_wait function. The duration of the
time delay is specified in timer ticks. The task who is calling the os_wait
funciton with a TIMEOUT value is suspended until the time delay is over.
Then, the task is returned to the READY State and can begin execution.
INTERVAL:A interval delay which is started by the os_wait function. The interval delay
is also specified in in timer ticks. The difference to a timeout delay is that
the RTX51 timer is not reset. Therefore the event INTERVAL works with a
timer which is running permantly. An interval can be used if the task is to
be executed in synchronous intervals; a simple example is a clock.

RTX Tiny 19
2
Note: The event SIGNAL can be combined with the events TIMEOUT and so that
RTX51 Tiny waits for both a signal and a time period.

Table of contents
Other Keil Computer Hardware manuals