![Keil RTX51 Скачать руководство пользователя страница 45](http://html1.mh-extra.com/html/keil/rtx51/rtx51_manual_3913946045.webp)
RTX TINY
45
6
Application Examples
RTX_EX1: Your First RTX51 Program
The program RTX_EX1 demonstrates round
-
robin multitasking using RTX51 Tiny.
This program is composed of only one source file
RTX_EX1.C
located in the
\C51V4\RTX_TINY\RTX_EX1
or
\CDEMO\51\RTX_TINY\RTX_EX1
directory. The
contents of
RTX_EX1.C
is listed below.
/******************************************************************************/
/* */
/* RTX_EX1.C: The first RTX51 Program */
/* */
/******************************************************************************/
#pragma CODE DEBUG OBJECTEXTEND
#include <rtx51tny.h> /* RTX51 tiny functions & defines */
int counter0; /* counter for task 0 */
int counter1; /* counter for task 1 */
int counter2; /* counter for task 2 */
/******************************************************************************/
/* Task 0 'job0': RTX51 tiny starts execution with task 0 */
/******************************************************************************/
job0 () _task_ 0 {
os_create_task (1); /* start task 1 */
os_create_task (2); /* start task 2 */
while (1) { /* endless loop */
c+; /* increment counter 0 */
}
}
/******************************************************************************/
/* Task 1 'job1': RTX51 tiny starts this task with os_create_task (1) */
/******************************************************************************/
job1 () _task_ 1 {
while (1) { /* endless loop */
c+; /* increment counter 1 */
}
}
/******************************************************************************/
/* Task 2 'job2': RTX51 tiny starts this task with os_create_task (2) */
/******************************************************************************/
job2 () _task_ 2 {
while (1) { /* endless loop */
c+; /* increment counter 2 */
}
}
To compile and link RTX_EX1, type the following commands at the DOS command
prompt.
C51 RTX_EX1.C DEBUG OBJECTEXTEND
BL51 RTX_EX1.OBJ RTX51TINY
Once RTX_EX1 is compiled and linked, you can test it using DS51. Type
Содержание RTX51
Страница 4: ......
Страница 6: ......
Страница 20: ......
Страница 24: ......
Страница 39: ...RTX Tiny 39 4...
Страница 40: ......
Страница 44: ...44 RTX51 Tiny Specifications 5...
Страница 68: ...RTX51 TINY REAL TIME OPERATING SYSTEM User s Guide 2 95...