|ARM Technical Support Knowledge Articles|
Applies to: RTX51 Tiny Real-time Kernel
Information in this article applies to:
I have some problems understanding how to structure time sharing in a RTX51 Tiny application.
For example, in a system with 5 tasks, one of those tasks will take 10ms execution time and the remaining tasks will take 5ms each for execution. So the complete execution time is 30ms. When the default RTX Timer Tick of 10ms is used, time is equally shared among these 5 tasks when using round robin timeout. However, it seems that there is not much of a difference for a single task program (without using RTX tiny); each task would be invoked by a loop and has to wait about 30ms for next execution.
How should I structure a RTX Tiny application?
On what basis should I set the RTX Timer Tick value?
A real-time operation system like RTX Tiny helps you avoid long time delays in your application when reacting on external events, since the processing time can be split between tasks. The best way to get started with RTX51 Tiny is to work the program examples that are in the folder C51RtxTiny2Examples. Each program can be executed in the µVision Debugger/Simulator without real hardware:
When you work with these examples, you will see that your existing code needs a few small modifications for RTX Tiny to get the benefits of the real-time operation system. In general, each task should use the os_wait function, which frees the CPU execution for other tasks. When you have tasks that need a lot of CPU computing time, you should periodically call the RTX Tiny function os_switch_task. This function checks if other tasks need the CPU and will execute them.
The execution of each task should be based on events which may be either a timed or a signal event in RTX Tiny. For very fast events, you may use standard interrupt functions to preprocess the data and send a signal event to a task that does the final data processing.
The best value for the RTX Timer Tick depends on the delays that you need in your system. For getting started, you should keep the default 10ms (on classic 8051 12-cycle CPU). When you have very short time delays, you may reduce this value. But keep in mind, by reducing the RTX Timer Tick value, the time consumed in the real-time kernel management is increased.
Article last edited on: 2007-02-23 08:38:54
Did you find this article helpful? Yes No
How can we improve this article?