3
INTRODUCTION RTX51 Tiny is a real-time operating system (RTOS) whih allows yo! to reate appli sim!ltaneo!sly per"orm m!ltiple "!ntions or tas#s$ This is o"ten re%!ire& in an e appliation$ hile it is ertainly possi'le to reate real-time programs witho!t a e e!ting one or more "!ntions or tas#s in a loop)* there are n!mero!s she&!lin an& timing iss!es that an RTOS li#e RTX51 Tiny an sol+e "or yo!$ , real-time operating system (RTOS) allows "le i'le she&!ling o" system reso!re C U an& memory* an& o""ers omm!niation 'etween tas#s$ RTX51 Tiny is a power"!l that is easy to !se an& that wor#s with all ./51 &eri+ati+es$ RTX51 Tiny programs are written !sing stan&ar& C onstr!ts an& ompile& with the Compiler$ ,&&itions to the C lang!age allow yo! to easily &elare tas# "!ntions w nee& "or omple sta# an& +aria'le "rame on"ig!ration$ RTX51 Tiny programs re%! that yo! inl!&e a speial hea&er "ile an& lin# the RTX51 Tiny li'rary into yo!r p The "ollowing so"tware appliations are re%!ire& to !se RTX51 Tiny C51 Compiler The C 51 Optimi2ing C Compiler is a omplete implementation o" the ,merian National Stan&ar&s Instit!te (,NSI) stan&ar& "or the C lang!age$ The C 51 Co not a !ni+ersal C ompiler a&apte& "or the ./51 target$ It is a gro!n&-!p im &e&iate& to generating e tremely "ast an& ompat o&e "or the ./51 miropr The C 51 Compiler pro+i&es yo! with the "le i'ility o" programming in C an& e""iieny an& spee& o" assem'ly lang!age$ ,51 3aro ,ssem'ler Development Tools Support Microcontrollers Description ,51 3aro ,ssem'ler 4 51 in#er6 oater I451 i'rary 3anager De+elopment Tools "or classic 8051 $ Inl!&es s!pport "or 78 9:04 o&e 'an#s$ ,X51 3aro ,ssem'ler X51 ; ten&e& in#er6 oater I4X51 i'rary 3anager De+elopment Tools "or classic an&extended 8051 +ersions ( NXP 80C51MX, Dallas 30 * et$) S!pports !p to 1934 o&e an& &ata memory$ ,851 3aro ,ssem'ler 851 in#er6 oater I4851 i'rary 3anager De+elopment Tools "or the 851$

Rtx51 Tiny

Embed Size (px)

DESCRIPTION

embedded

Citation preview

INTRODUCTIONRTX51 Tiny is a real-time operating system (RTOS) which allows you to create applications that simultaneously perform multiple functions or tasks. This is often required in an embedded application. While it is certainly possible to create real-time programs without an RTOS (by executing one or more functions or tasks in a loop), there are numerous scheduling, maintenance, and timing issues that an RTOS like RTX51 Tiny can solve for you.A real-time operating system (RTOS) allows flexible scheduling of system resources, like the CPU and memory, and offers communication between tasks. RTX51 Tiny is a powerful RTOS that is easy to use and that works with all 8051 derivatives.RTX51 Tiny programs are written using standard C constructs and compiled with the Keil C51 C Compiler. Additions to the C language allow you to easily declare task functions without the need for complex stack and variable frame configuration. RTX51 Tiny programs require only that you include a special header file and link the RTX51 Tiny library into your program.

The following software applications are required to use RTX51 Tiny:1. C51 Compiler:The Cx51 Optimizing C Compiler is a complete implementation of the American National Standards Institute (ANSI) standard for the C language. The Cx51 Compiler is not a universal C compiler adapted for the 8051 target. It is a ground-up implementation, dedicated to generating extremely fast and compact code for the 8051 microprocessor. The Cx51 Compiler provides you with the flexibility of programming in C and the code efficiency and speed of assembly language.1. A51 Macro Assembler

Development ToolsSupport Microcontrollers Description

A51 Macro AssemblerBL51 Linker/LocaterLIB51 Library Manager

Development Tools for classic 8051.Includes support for 32 x 64KB code banks.

AX51 Macro AssemblerLX51 Extended Linker/LocaterLIBX51 Library Manager

Development Tools for classic and extended 8051 versions (NXP 80C51MX, Dallas 390, etc.) Supports up to 16MB code and xdata memory.

A251 Macro AssemblerL251 Linker/LocaterLIB251 Library ManagerDevelopment Tools for the 251.

1. BL51 Linker or LX51 LinkerThe BL51 Linker/Locator creates an absolute object module by linking together object modules created using the Keil A51 Assembler, C51 Compiler, Intel ASM-51 Assembler, and Intel PL/M-51 Compiler. Object modules created by these tools are relocatable and cannot be directly executed (even if they consist of only one source module). They must be linked and converted into an absolute object modules using the linker.

REAL TIME EXAMPLEvoid check_serial_io_task (void) _task_ 1{/* This task checks for serial I/O */}

void process_serial_cmds_task (void) _task_ 2{/* This task processes serial commands */}

void check_kbd_io_task (void) _task_ 3{/* This task checks for keyboard I/O */}

void process_kbd_cmds_task (void) _task_ 4{/* This task processes keyboard commands */}

void startup_task (void) _task_ 0{os_create_task (1); /* Create serial_io Task */os_create_task (2); /* Create serial_cmds Task */os_create_task (3); /* Create kbd_io Task */os_create_task (4); /* Create kbd_cmds Task */

os_delete_task (0); /* Delete the Startup Task */}MULTI TASKING EXAMPLEvoid main (void){int counter = 0;

while (1) /* repeat forever */ { check_serial_io (); /* check for serial input */ process_serial_cmds (); /* process serial input */

check_kbd_io (); /* check for keyboard input */ process_kbd_cmds (); /* process keyboard input */

adjust_ctrlr_parms (); /* adjust the controller */

counter++; /* increment counter */ }}In this example, each function performs a separate operation or task. The functions (or tasks) are executed in order, one after another.Scheduling starts to become an issue as more tasks are added. For example, if the process_kbd_cmds function executes for a long time, the main loop may take too long to get back around to the check_serial_io function and serial data may be lost. Of course, the check_serial_io function may be called more often in the main loop to correct this issue, but eventually this technique will not work.