ADuC831,电子系统设计——基于RTX51实时操作系统程序设.ppt
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《ADuC831,电子系统设计——基于RTX51实时操作系统程序设.ppt》由会员分享,可在线阅读,更多相关《ADuC831,电子系统设计——基于RTX51实时操作系统程序设.ppt(35页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、电子系统设计基于RTX51实时操作系统程序设计基础实时操作系统概述DACCON.7DACCON.6DACCON.5DACCON.4DACCON.3DACCON.2DACCON.1DACCON.0MODERNG1RNG0CLR1CLR0SYNC*PD1*PD0一、实时操作系统概述操作系统操作系统是一种管理计算机硬件的程序,为应用程序提供了基本的运行条件,在计算机用户和计算机硬件之间扮演着中介的角色。The operating system(OS)is the main program that controls how your computer system functions.The OS
2、manages the computers hardware,including the processor,memory,and storage devices,as well as peripheral devices.It is responsible for the management,scheduling,and interaction of tasks.Your first interaction with the OS is the user interface.Four categories:Real-Time(RTOS)Single-User,Single-TaskSing
3、le-User,MultitaskMultiuserWHAT THE OS DOESProvides user interfaceManages the CPUManages memory and storageManages hardware and peripheral devicesCoordinates application software with the CPUThe operating systems provides a way for the user to interact with the computer,manages the processor(CPU),man
4、ages the memory and storage,manages the computer systems hardware and peripheral devices,and provides a consistent means for software applications to work with the CPU.THE USER INTERFACEEnables you to interact with the computerTypes of interfaces:Command-driven interfaceMenu-driven interfaceGraphica
5、l user interface(GUI)PROCESSOR MANAGEMENTControls the timing of events the processor works onInterruptsInterrupt handlerInterrupt tableStack MEMORY AND STORAGE MANAGEMENTThe operating system allocates space in RAM for instructions and dataHARDWARE AND PERIPHERAL DEVICE MANAGEMENTDevice driversProgra
6、ms that enable the operating system to communicate with peripheral devicesProvided by the manufacturer of the device Plug and PlayHardware and software standardFacilitates the installation of new hardwareFILE MANAGEMENTThe operating system provides an organizational structure for the computers conte
7、ntsHierarchical structure of directoriesDrivesFoldersvSubfoldersFilesREAL-TIME OPERATING SYSTEMSREAL-TIME OPERATING SYSTEMS实时系统指系统的计算正确性不仅取决于计算的逻辑正确性,还取决于产生结果的时间。一个实时操作系统面对外界环境发生的变化(包括时间的消逝)时,必须确定性地保证在满足时间要求的情况下予以正确的反应处理。Multiple events handled by a single processor Events may occur simultaneously P
8、rocessor must handle multiple,often competing events Wide range of RTOS systemsSystems with a specific purpose and a certain resultUses include:Industrial machinesRobotic equipmentAutomobilesVideo game consolesHome appliancesREAL-TIME OPERATING SYSTEMSREAL-TIME OPERATING SYSTEMSA task is a program r
9、unning on the CPU core of a microcontroller.1、TaskA real-time operating system allows the execution of multiple tasks on a single CPU.All tasks execute as if they completely owned the entire CPU.Without a multitasking kernel(an RTOS),only one task can be executed by the CPU at a time.This is called
10、a single-task system.REAL-TIME OPERATING SYSTEMSa、Single-task systems(superloop)A superloop application is basically a program that runs in an endless loop,calling OS functions to execute theappropriate operations(task level).No real-time kernel is used,so interrupt service routines(ISRs)must be use
11、d for real-time parts of the software or critical operations(interrupt level).This type of system is typically used in small,uncomplex systems or if real-time behavior is not critical.REAL-TIME OPERATING SYSTEMSvoid main(void)int counter=0;while(1)/*repeat forever*/check_serial_io();/*check for seri
12、al 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*/b、COOPERATIVE MULTITASKINGREAL-TIME OPERATING SYSTEMSCooperative multitasking ex
13、pects cooperation of all tasks.Tasks can only be suspended by calling a function of the operating system.If they do not,the system“hangs”,which means that other tasks have no chance of being executed by the CPU while the first task is being carried out.REAL-TIME OPERATING SYSTEMSREAL-TIME OPERATING
14、SYSTEMSc、PREEMPTIVES MULTITASKINGA real-time operating system needs a regular timer-interrupt to interrupt tasks at defined times and to perform task-switches if necessary.The highestprioritytask in the READY state is therefore always executed,whether it is an interrupted task or not.If an ISR makes
15、a higher priority task ready,a task switch will occur and the task will be executed before the interrupted task is returned to.REAL-TIME OPERATING SYSTEMSREAL-TIME OPERATING SYSTEMS1、SchedulingThere are different algorithms that determine which task to execute,called schedulers.All schedulers have o
16、ne thing in common:they distinguish between tasks that are ready to be executed(in the READY state)and the other tasks thatare suspended for any reason(delay,waiting for mailbox,waiting for semaphore,waiting for event,and so on).The scheduler selects one of the tasks in the READY state and activates
17、 it(executes the program of this task).The task which is currently executing is referred to as the active task.REAL-TIME OPERATING SYSTEMSa、ROUND-ROBIN SCHEDULING ALGORITHMWith round-robin scheduling,the scheduler has a list of tasks and,when deactivating the active task,activates the next task that
18、 is in the READY state.Round-robin can be used with either preemptive or cooperative multitasking.It works well if you do not need to guarantee response time,if the response time is not an issue,or if all tasks have the same priority.All tasks are on the same level;the possession of the CPU changes
19、periodically after a predefined execution time.This time is called timeslice,and may be defined individually for every task.REAL-TIME OPERATING SYSTEMSb、PRIORITY-CONTROLLED SCHEDULING ALGORITHMIn real-world applications,different tasks require different response times.For example,in an application t
20、hat controlsa motor,a keyboard,and a display,the motor usually requires faster reaction time than the keyboard and display.While the display is being updated,the motor needs to be controlled.This makes preemptive multitasking a must.Round-robin might work,but because it cannot guarantee a specific r
21、eaction time.In priority-controlled scheduling,every task is assigned a priority.The order of execution depends on this priority.The scheduler activates the task that has the highest priority of all tasks in the READY state.This means that every time a task with higher priority than the active task
22、gets ready,it immediately becomes the active task.REAL-TIME OPERATING SYSTEMSREAL-TIME OPERATING SYSTEMS2、Communication between tasksIn a multitasking(multithreaded)program,multiple tasks work completely separately.Because they all work in the same application,it will sometimes be necessary for them
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- ADuC831 电子 系统 设计 基于 RTX51 实时 操作系统 程序
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内