好文档就是一把金锄头!
欢迎来到金锄头文库![会员中心]
电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

单片机操作系统RTX51原理分析与移植.docx

45页
  • 卖家[上传人]:人***
  • 文档编号:427240424
  • 上传时间:2022-11-14
  • 文档格式:DOCX
  • 文档大小:177.90KB
  • / 45 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • 单片机操作系统RTX51原理分析与移植发布时间:-7-25  阅读次数:286  字体大小: 【小】 【中】【大】一.课题规定:仔细分析单片机操作系统RTX51的原理,将其移植到单片机实验平台上,并规定编写一种简短的程序来验证其运营的对的性(例如,编写两个具有显示不同样内容的任务)二.RTX51原理注释:由于英文原文会比较好,因此我没有翻译过来(但是也写了部分的翻译),直接提取出来某些英文,总结在一起1. 进程管理( Task Management )1) 进程类型( Classes of Tasks )RTX-51 recognizes two classes of tasks:1. Fast tasksn Contain especially short responses and interrupt disable times.n Contain a separate register bank and a separate stack area (register banks 1, 2 and 3).(Figure 1)n Contain the highest task priority (priority 3) and can therefore interrupt standard tasks.n All contain the same priority and can therefore not be mutually interrupted.n Can be interrupted by c51 interrupt functions.n A maximum of three fast tasks can be active in the system.2. Standard tasksn Require somewhat more time for the task switching compared to fast tasks.n Share a common register bank and a common stack area (register bank 0).n The current contents of registers and stack are stored in the external (XDATA) memory during a task change.n Can be interrupted by fast tasks.n Can interrupt themselves mutually.n Can be interrupt by c51 interrupt functions.n A maximum 16 standard tasks can be active in the system.<单片机操作系统RTX51原理分析> Figure 3: Task Classes and Memory Allocation每一种原则进程都涉及一种设备上下文在扩展内存(XDATA)中。

      在原则进程执行进程切换的时候,会把它自己的Register和Stack存储到相应的设备上下文中(在扩展内存中的一种区域)之后,Register和Statck又从设备上下文中重新载入,继续执行互换技术)相比而言,迅速进程则不用这样麻烦,由于它们有各自独立的Register和Stack,因此只要激活相应的Register(修改PSW)和指向Stack的指针(Mov SP,#XX)即可2) 进程状态(Task states)RTX-51 recognizes four task states:1. READY All tasks which can run are READY. One of these tasks is the RUNNING (ACTIVE)task.2. RUNNING (ACTIVE) Task which is currently being executed bythe processor. Only one task (maximum) can be in this state at a time.3. BLOCKED (WAITING) Task waits for an event.4. SLEEPING All tasks which were not started or which have terminated themselves are in this state.3) 进程调度(Task switch)The RTX-51 system section which the processors assigns to the individual tasks is referred to as the scheduler (also dispatcher).The RTX_51 scheduler works according to the following rules:1. The task with the highest priority of all tasks in the READY state is executed.2. If several tasks of the same priority are in the READY state,the task that has been ready the longest will be the next to execute.3. Task switchings are only executed if the first rule would have been otherwise violated (exception: round-robin scheduling).Time-slice task change (round-robin scheduling) are executed if the following conditions are satisfied:1. Round-robin scheduling must be enabled (see configuration).2. The RUNNING task has the priority of 0 and is currently not executing a floating-point operation (see section "Floating-Point Operations", page 28).3. At least one task with the priority zero must be in the READY state.4. The last task change must have occurred after the selected system time interval (see system function "os_set_slice"). The system time interval can be changed dynamically during program execution.4) 进程通信和同步(Task Communication and Synchronisation)There three two mechanisms:1. SignalSignals represent the simplest and fastest form of task communication. These can always be used when a pure task synchronisation is required without data exchange.Each active task contains its own signal flag with which the following operations can be executed:l Wait for a signall Send signall Clear signalThe task number (see section section "Task Declaration") of the receiver task is used for identifying the signals for the individual operations.2. Message(via MailBoxes(FIFO))n By means of the mailbox concept, messages can be exchanged free of conflicts between the individual tasks.n RTX-51 provides a fixed number of eight mailboxes. Messages can be exchanged in words (2 bytes) via these mailboxes. In this case, a message can represent the actual data to be transferred or the identification of a data buffer(defined by the user). In comparison to the signals, mailboxes are not assigned a fixed task, but can be freely used by all tasks and interrupt functions. These are identified with a mailbox number.Mailboxes allow the following operations:l Send a messagel Read a messageEach mailbox is internally consists of three wait lists.(Figure 2)Figure 21. Message listList of the messages written in the mailbox. These comprise a maximum of eight messages.2. Write wait listWait list for tasks which want to write a message in the message list of the mailbox (maximum 16 tasks).3. Read wait listWait list for tasks which want to read a message from the message list of the mailbox (maximum 16 tasks).3. Semaphoren By means of the semaphore concept, resources can be shared free of conflicts between the individual tasks.n A semaphore contains a token that your code acquires to continue execution. If the res。

      点击阅读更多内容
      关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
      手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
      ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.