Download MR8C/4 V.1.01 User`s Manual
Transcript
MR8C/4 3 Introduction to Kernel Key input Task Remote control Task Program execution interrupt Program execution resumed During this interval, it appears that the key input microcomputer is haled. Figure 3.5 Task Execution Interruption and Resumption In the state shown in Figure 3.5, it appears to the programmer that the key input task or its microcomputer is halted while another task assumes execution control. Task execution restarts at the point of last interruption as the register contents prevailing at the time of the last interruption are recovered. In other words, task switching refers to the action performed to save the currently executed task register contents into the associated task management memory area and recover the register contents for the task to switch to. To establish the kernel, therefore, it is only necessary to manage the register for each task and change the register contents upon each task switching so that it looks as if a number of microcomputers exist (See Figure 3.6). R0 R1 Actual Register PC Kernel Key input Task Remote control Task R0 R0 R1 R1 PC PC Register Register Figure 3.6 Task Switching The example presented in Figure 3.7 5 indicates how the individual task registers are managed. In reality, it is necessary to provide not only a register but also a stack area for each task. R20UT0657EJ0101 Rev.1.01 Sep 16, 2011 Page 10 of 178