JP2003131891A - Multiple task control method, computer program, recording medium, multiple task control system, device and printer - Google Patents

Multiple task control method, computer program, recording medium, multiple task control system, device and printer

Info

Publication number
JP2003131891A
JP2003131891A JP2001322794A JP2001322794A JP2003131891A JP 2003131891 A JP2003131891 A JP 2003131891A JP 2001322794 A JP2001322794 A JP 2001322794A JP 2001322794 A JP2001322794 A JP 2001322794A JP 2003131891 A JP2003131891 A JP 2003131891A
Authority
JP
Japan
Prior art keywords
task
interrupt processing
executed
interrupt
procedure
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2001322794A
Other languages
Japanese (ja)
Inventor
Yasutetsu Orii
康哲 折井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2001322794A priority Critical patent/JP2003131891A/en
Publication of JP2003131891A publication Critical patent/JP2003131891A/en
Pending legal-status Critical Current

Links

Landscapes

  • Accessory Devices And Overall Control Thereof (AREA)

Abstract

PROBLEM TO BE SOLVED: To realize a multiple task control method by which processing can be carried out at high speed, a computer program to execute a multiple task control method in a device, a recording medium recorded with the program, a multiple task control system by which the high speed processing can be carried out, a device provided with the multiple task control system, and a printer provided with the multiple task control system. SOLUTION: In the multiple task control system controlling a multiple number of tasks by using an interrupt handling provided with a procedure to generate change to a task to be executed, it is characteristic of the procedure provided to the interrupt handling that it is in a state where another interrupting process different from the before mentioned interrupting process where a system call is executed to generate the change in the execute task can be carried out.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は、マルチタスク管理
方法、コンピュータプログラム、記録媒体、マルチタス
ク管理システム、装置、及び、プリンタに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a multitask management method, computer program, recording medium, multitask management system, device, and printer.

【0002】[0002]

【従来の技術】一般に、コンピュータ、あるいはその上
のプログラムはシーケンシャルに走るものであり、同時
に二つのことを行う能力はない。ところが、各種の制御
装置等に使用される「組み込みシステム」等の場合に
は、外部で発生したいろいろな刺激や環境の変化をセン
サで感知して、それに対して応答の動作を起こしたり、
周期的に外部に対して動作を起こしたりする能力が必要
とされる。したがって、センサが複数存在し、それらを
平行して監視しなければならないことが多い。監視する
ものが二つあれば、プログラムも二つに分け、それらが
同時に並行して走ると考える方が自然であり、プログラ
ミングも容易になる。このような要求から生まれたのが
マルチタスクの考え方である。すなわち、全体の処理の
うちで、平行した流れを持つ部分をタスクとして分割
し、プログラムをタスクに分けることによって、わかり
やすさやプログラムの生産性を上げようというものであ
る。マルチタスク機能を持つオペレーティングシステム
をマルチタスクオペレーティングシステムと呼び、これ
は組み込みシステム等に使用されるオペレーティングシ
ステムとして有効なものである。
2. Description of the Related Art Generally, a computer or a program running on it runs sequentially and does not have the ability to do two things at the same time. However, in the case of an "embedded system" used for various control devices, etc., various external stimuli and changes in the environment are detected by a sensor, and a response operation is caused,
The ability to periodically make an action to the outside is required. Therefore, there are often multiple sensors that must be monitored in parallel. If there are two things to monitor, it is more natural to divide the program into two and run them in parallel at the same time, and programming will be easier. The concept of multitasking was born from these requirements. That is, in the entire processing, a part having a parallel flow is divided into tasks, and the programs are divided into tasks, thereby improving the intelligibility and the productivity of the programs. An operating system having a multitasking function is called a multitasking operating system, which is effective as an operating system used in an embedded system or the like.

【0003】上記オペレーティングシステムでもうひと
つ重要な要素は、リアルタイム性と呼ばれるものであ
る。リアルタイム性とは、抽象的に説明すると、コンピ
ュータの処理が外部の状況の変化に追従できることであ
るが、具体的には、処理結果を出すまでの時間が制限さ
れていることを指す。組み込みシステム等の場合には、
計算すること自体が目的なのではなく、計算結果を使っ
て他の機器を制御することが主要な目的の一つである。
したがって、処理時間に対する要求が厳しく、処理が遅
れると、結果を出しても無意味になってしまうことが多
いのである。
Another important element in the above operating system is called real-time property. To explain in an abstract manner, the real-time property means that the computer process can follow changes in the external situation, but specifically, it means that the time until the process result is output is limited. In case of embedded system etc.,
It is not the purpose of the calculation itself, but one of the main purposes is to control other devices using the calculation results.
Therefore, if the processing time is strict and the processing is delayed, it is often meaningless even if the result is obtained.

【0004】マルチタスクオペレーティングシステムに
おいては、物理的には、OSの制御のもとで、各々のタ
スクが時分割で実行されることになるが、実行されるタ
スクが切り替わるのは、システムコールが実行された時
やシステムコールが実行される手順を含む割込みが発生
した時等である。なお、「システムコール」とは、プロ
グラム中でオペレーティングシステムのサービスを必要
とする場合にオペレーティングシステムのルーチンを呼
ぶことを言う。
In a multi-task operating system, each task is physically executed in a time-sharing manner under the control of the OS, but the task to be executed is switched by a system call. This is, for example, when an interrupt is generated or when an interrupt including a procedure for executing a system call occurs. The "system call" means to call an operating system routine when a service of the operating system is required in a program.

【0005】前者について、図1を用いて説明する。図
1は、システムコール実行時の実行されるタスクを切り
替える手順について説明した図である。タスクAで示さ
れる列において、実線部はタスクAが実行されているこ
とを示し、点線部はタスクAが実行されていないことを
示している。また、同様に、タスクBで示される列にお
いて、実線部はタスクBが実行されていることを示し、
点線部はタスクBが実行されていないことを示してい
る。
The former will be described with reference to FIG. FIG. 1 is a diagram illustrating a procedure of switching a task to be executed when a system call is executed. In the column indicated by task A, the solid line portion indicates that task A is being executed, and the dotted line portion indicates that task A is not being executed. Similarly, in the column indicated by task B, the solid line portion indicates that task B is being executed,
The dotted line portion indicates that task B is not executed.

【0006】まず始めに、タスクAが実行されていると
する。ここで、実行されるタスクの変更を生じさせるた
めのシステムコールを実行する(ステップS6)。この
ようなシステムコールは多種あるが、ここでは、タスク
Bを待ち状態から実行可能状態へ遷移させるWake
UpタスクBというシステムコールを例に説明する。
First, it is assumed that task A is being executed. Here, a system call for causing a change in the task to be executed is executed (step S6). There are various types of system calls, but here, Wake that causes task B to transit from the wait state to the ready state
A system call called Up task B will be described as an example.

【0007】本システムコールにおいては、まず、レジ
スタの退避を行う(ステップS8)。具体的にはレジス
タの情報をタスクAのタスク制御ブロックのスタックエ
リアに記憶させる。これは、本システムコールにより実
行されるタスクの変更が生じる可能性があるため、変更
後のタスクの実行、すなわち、タスクB等の実行によ
り、タスクAで使用されたレジスタの情報を破壊されな
いようにするためである。したがって、タスクBの実行
の終了後等に再度タスクAが実行される際には、レジス
タの復帰、すなわち、レジスタの情報をタスクAのタス
ク制御ブロックのスタックエリアからレジスタへ戻す作
業が行われる。
In this system call, first, the registers are saved (step S8). Specifically, the information of the register is stored in the stack area of the task control block of task A. This is because there is a possibility that the task executed by this system call may be changed, so that the execution of the changed task, that is, the execution of task B etc., does not destroy the information of the register used in task A. This is because Therefore, when the task A is executed again after the completion of the execution of the task B, the operation of returning the register, that is, returning the information of the register from the stack area of the task control block of the task A to the register is performed.

【0008】次に、タスクBを待ち状態から、実行可能
状態に遷移させる(ステップS10)。待ち状態とは、
そのタスクを実行できる条件が整わない等のために、実
行ができない状態を意味する。実行可能状態とは、タス
ク側の実行の準備は整っているが、そのタスクよりも優
先度が高いタスクが実行中であるため、そのタスクの実
行はできないという状態を意味する。
Next, the task B is transited from the waiting state to the ready state (step S10). What is a waiting state?
It means a state in which the task cannot be executed because the conditions for executing the task are not satisfied. The ready state means that the task is ready for execution, but the task with a higher priority than the task is being executed, so the task cannot be executed.

【0009】次に、スケジューラへジャンプする(ステ
ップS12)。ここまでが、システムコールWake
UpタスクBで行われる手順の内容である。
Next, the process jumps to the scheduler (step S12). Up to here, the system call Wake
These are the contents of the procedure performed in the Up task B.

【0010】次に、スケジューラが動作する(ステップ
S14)。スケジューラとは、タスク毎に定義された優
先度にしたがい実行可能状態のタスクの中から最も優先
度の高いタスクを実行させるためにスケジューリングを
行う機能である。図1においては、実行しているタスク
AとシステムコールWake UpタスクBにより実行
可能状態とされたタスクB双方の優先度が比較されるこ
ととなる。タスクBの優先度の方が高ければ、実行され
るタスクがタスクBに切り替わることになる。なお、タ
スクBに切り替わる際には、タスクBのレジスタの復
帰、すなわち、レジスタ情報をタスクBのタスク制御ブ
ロックのスタックエリアからレジスタへ戻す作業が行わ
れる(ステップS15)。
Next, the scheduler operates (step S14). The scheduler is a function of performing scheduling in order to execute the task having the highest priority among the tasks in the ready state according to the priority defined for each task. In FIG. 1, the priorities of both the task A that is being executed and the task B that has been made executable by the system call Wake Up task B are compared. If the task B has a higher priority, the task to be executed is switched to the task B. When switching to the task B, the operation of returning the register of the task B, that is, the operation of returning the register information from the stack area of the task control block of the task B to the register is performed (step S15).

【0011】次に後者、すなわち、割込みが発生した時
に、実行されるタスクが切り替わる場合について、図2
を用いて説明する。図2は、割込み発生時の実行される
タスクを切り替える手順について説明した図である。タ
スクAで示される列において、実線部はタスクAが実行
されていることを示し、点線部はタスクAが実行されて
いないことを示していること、また、タスクBで示され
る列において、実線部はタスクBが実行されていること
を示し、点線部はタスクBが実行されていないことを示
していることは、図1の場合と同様である。なお、割込
み処理は、タスクとの比較において、割込み処理に入る
直前に実行中だったタスクを特定することが無意味であ
り、自タスクの概念が存在しない処理であると言える。
このようなことから、タスク独立部と呼ばれることもあ
る。したがって、図2においても、タスクA,Bとは別
に割込み処理16で示される列を用意し、実線部により
割込み処理が実行されていることを示し、点線部により
割込み処理が実行されていないことを示している。
Next, in the latter case, that is, in the case where the task to be executed is switched when an interrupt occurs, FIG.
Will be explained. FIG. 2 is a diagram illustrating a procedure of switching a task to be executed when an interrupt occurs. In the column indicated by task A, the solid line portion indicates that task A is being executed, the dotted line portion indicates that task A is not being executed, and in the column indicated by task B, the solid line portion As in the case of FIG. 1, the part indicates that the task B is being executed, and the dotted line part indicates that the task B is not being executed. It should be noted that in the interrupt process, it is meaningless to specify the task that was being executed immediately before entering the interrupt process in comparison with the task, and it can be said that the concept of the own task does not exist.
Because of this, it is sometimes called the task-independent part. Therefore, also in FIG. 2, a column indicated by the interrupt processing 16 is prepared separately from the tasks A and B, the solid line indicates that the interrupt processing is being executed, and the dotted line indicates that the interrupt processing is not being executed. Is shown.

【0012】まず始めに、タスクAが実行されていると
する。ここで、ある割込みが発生するものとする。この
割込み処理においては本割込み原因に応じた処理が行わ
れることになる(ステップS22)。
First, assume that task A is being executed. Here, it is assumed that a certain interrupt occurs. In this interrupt processing, processing according to the cause of this interrupt is performed (step S22).

【0013】割込み処理の起動時にはオペレーティング
システムが直接介入しないため、割込み処理発生時に
は、ハードウエアの割込み処理メカニズムにより、割込
み処理が直接起動される。したがって、既述のシステム
コール実行時の実行されるタスクを切り替える手順とは
異なり、割込み処理で使用するレジスタの退避を割込み
処理開始の際に確実に行うような設計にしなければなら
ない(ステップS20)。
Since the operating system does not directly intervene when the interrupt processing is started, when the interrupt processing occurs, the interrupt processing is directly started by the hardware interrupt processing mechanism. Therefore, unlike the procedure for switching the task to be executed at the time of executing the system call described above, it is necessary to design so that the registers used in the interrupt processing are surely saved at the start of the interrupt processing (step S20). .

【0014】本割込み原因に応じた処理等の中で、実行
されるタスクの変更を生じさせるためのシステムコール
を実行する(ステップS24)。ここでも、タスクBを
待ち状態から実行可能状態へ遷移させるWake Up
タスクBというシステムコールを例に説明する。通常、
割込み処理中に実行されるシステムコールは、図1で説
明したシステムコールと比較して、同じ目的のもので
も、別のシステムコールが用意されており、システムコ
ールの処理手順も若干異なっている。異なる点の一つ
は、システムコール終了の際に、スケジューラへジャン
プしないことである。これは、一回の割込み処理で、実
行可能状態とされるタスクが一つだけとは限らず、そこ
でスケジューラに入ってタスクを実行させてしまうと、
割込み処理が終わらなくなってしまうから等の理由によ
る。もう一つの異なる点は、既述の通り割込み処理開始
の際にレジスタの退避が行われること等から、システム
コール開始の際に、レジスタの退避は行われないという
ことである。タスクBを待ち状態から、実行可能状態に
遷移させることは行われる(ステップS26)。
In the processing according to the cause of the interrupt, a system call for changing the task to be executed is executed (step S24). Here again, Wake Up that changes task B from the waiting state to the ready state
A system call called task B will be described as an example. Normal,
As for the system call executed during the interrupt processing, another system call is prepared for the same purpose as the system call described in FIG. 1, and the processing procedure of the system call is slightly different. One of the differences is that it does not jump to the scheduler when the system call ends. This is because one interrupt process does not mean that only one task is in the READY state. If you enter the scheduler there and execute the task,
The reason is that interrupt processing is not completed. Another difference is that the registers are not saved at the start of the system call because the registers are saved at the start of the interrupt processing as described above. The task B is changed from the waiting state to the ready state (step S26).

【0015】また、既述したレジスタの退避について、
上記のように割込み処理において、実行されるタスクの
変更を生じさせるためのシステムコールを実行する(ス
テップS24)場合には、割込み処理で使用するレジス
タだけでなく、基本的に全レジスタ、少なくとも変更前
のタスクに使用されるレジスタの退避を行っておく必要
がある。変更後のタスクの実行、すなわち、タスクB等
の実行により、タスクAで使用されたレジスタの情報を
破壊されないようにするためである。
Regarding the saving of the registers described above,
As described above, in the interrupt processing, when the system call for causing the change of the task to be executed is executed (step S24), not only the registers used in the interrupt processing but basically all the registers, at least the change is performed. It is necessary to save the registers used for the previous task. This is to prevent the information of the register used in the task A from being destroyed by the execution of the task after the change, that is, the execution of the task B or the like.

【0016】次に、スケジューラへジャンプする(ステ
ップS30)。通常は、割込み処理からの復帰を行うた
めの特別なシステムコールにおいて実現される。そし
て、スケジューラが動作する(ステップS14)が、図
2においては、割込み処理前に実行していたタスクAと
システムコールWake UpタスクBにより実行可能
状態とされたタスクB双方の優先度が比較されることと
なる。タスクBの優先度の方が高ければ、実行されるタ
スクがタスクBに切り替わることになる。なお、タスク
Bに切り替わる際には、タスクBのレジスタの復帰、す
なわち、レジスタ情報をタスクBのタスク制御ブロック
のスタックエリアからレジスタへ戻す作業が行われる
(ステップS15)。
Next, the process jumps to the scheduler (step S30). Normally, it is implemented in a special system call for returning from interrupt processing. Then, the scheduler operates (step S14), but in FIG. 2, the priorities of the task A that was executed before the interrupt processing and the task B that was made executable by the system call Wake Up task B are compared. The Rukoto. If the task B has a higher priority, the task to be executed is switched to the task B. When switching to the task B, the operation of returning the register of the task B, that is, the operation of returning the register information from the stack area of the task control block of the task B to the register is performed (step S15).

【0017】ところで、割込みというものは、実行され
ているタスクとは無関係に、いわば、突然に入ってくる
ものである。このことより、割込み処理は、特に、リア
ルタイム性が要求され、処理時間に対する要求が厳しい
ということが言える。また、割込みの中には、例えば一
定周期で割込みが入ってくるようなタイマ割込みという
ものが用意されており、この場合、処理時間がその周期
を超えた場合は全く意味がないものとなってしまう。
By the way, an interrupt is, so to speak, suddenly introduced regardless of the task being executed. From this, it can be said that interrupt processing requires real-time processing in particular, and the processing time is severely demanded. In addition, among interrupts, for example, a timer interrupt that allows interrupts to come in at a fixed cycle is prepared. In this case, if the processing time exceeds that cycle, it has no meaning at all. I will end up.

【0018】再度、図2を参照する。今、割込み処理1
6とは別の割込み処理28を考えると、割込み処理間に
おいても優先度が設定されるから、割込み処理16の優
先度が別の割り込み処理28よりも高い場合には、割込
み処理16の処理中には別の割込み処理28は実行され
得ない。この優先度は、各々の割込みの割込み原因やそ
れに応じた処理内容により設定されるが、割込み処理1
6の中の一部においては、例えば、システムコール部に
おいては、別の割込み処理28の処理の待ち時間を短縮
させるために、別の割込み処理28よりも優先度を下げ
て良い場合もあり得る。しかしながら、割込み処理16
の中に、別の割込み処理28よりも優先度を高くしなけ
ればならない処理が含まれている時などは、このような
優先度の設定は不可能であり、よって、システムコール
部等を割込み処理16から切り離し、別途低位の優先度
を設定できるようにすることが望まれる。
Referring again to FIG. Interrupt processing 1 now
Considering the interrupt processing 28 different from 6, the priority is set between the interrupt processings. Therefore, if the priority of the interrupt processing 16 is higher than that of the other interrupt processing 28, the interrupt processing 16 is being processed. No further interrupt handling 28 can be performed. This priority is set depending on the interrupt cause of each interrupt and the processing content corresponding to it.
In part of 6, for example, in the system call part, the priority may be lower than that of the other interrupt processing 28 in order to shorten the waiting time of the processing of the other interrupt processing 28. . However, interrupt processing 16
When a process that requires a higher priority than another interrupt process 28 is included in such a case, it is impossible to set such a priority. Therefore, the system call unit or the like is interrupted. It is desirable to separate it from the processing 16 so that a lower priority can be set separately.

【0019】次に、図3を参照する。図3は、図2の変
形例であり、割込み処理部を示したものである。図3の
図2との相違点は、割込み原因に応じた処理(ステップ
S22)にある。すなわち、割込み処理が複数回実行さ
れ、その割込み処理毎に、カウンタによりその回数をカ
ウントし(ステップS32)、それが100回目になっ
たときのみ(ステップS34)割込み処理中のWake
UpタスクBというシステムコールを実行する(ステ
ップS24)。このような割込み処理の場合、割込み処
理中に実行されるタスクの変更を生じさせるためのシス
テムコールを実行する(ステップS24)から、既述の
通り、割込み処理で使用するレジスタだけでなく、基本
的に全レジスタ、少なくとも変更前のタスクに使用され
るレジスタの退避を行っておく必要がある(ステップS
20)。しかしながら、実際には、100回のうち1回
しか、かかるシステムコールの実行はないから、毎回、
全レジスタ又は変更前のタスクに使用されるレジスタの
退避を行うと、無駄が生じてしまう。そして、この無駄
は割込み処理の処理時間の長期化というデメリットを発
生させる。
Next, referring to FIG. FIG. 3 is a modified example of FIG. 2 and shows an interrupt processing unit. The difference between FIG. 3 and FIG. 2 lies in the processing (step S22) depending on the cause of the interrupt. That is, the interrupt process is executed a plurality of times, the number of times is counted by the counter for each interrupt process (step S32), and only when it reaches the 100th time (step S34), the wake during interrupt process is performed.
A system call called Up task B is executed (step S24). In the case of such an interrupt process, a system call for causing a change of a task executed during the interrupt process is executed (step S24). Therefore, as described above, not only the registers used in the interrupt process but also the basic process are executed. It is necessary to save all registers, at least the registers used for the task before the change (step S
20). However, in practice, such a system call is executed only once in 100 times, so each time,
If all the registers or the registers used for the task before the change are saved, waste occurs. Then, this waste causes a disadvantage of prolonging the processing time of the interrupt processing.

【0020】また、より具体的には、マルチタスク管理
システムを有するプリンタ等の装置に係る処理、例えば
プリンタに用いられるDCモータのPID制御等におい
て、割込み処理の処理時間が、周期的に実行される割込
みの1周期に相応した時間より長すぎて、制御が乱れる
という問題がある。
More specifically, in processing related to a device such as a printer having a multitask management system, for example, PID control of a DC motor used in the printer, the processing time of interrupt processing is periodically executed. There is a problem that the control is disturbed because it is longer than the time corresponding to one cycle of the interrupt.

【0021】[0021]

【発明が解決しようとする課題】本発明は、かかる課題
に鑑みてなされたものであり、その目的とするところ
は、高速な処理を行うことが可能なマルチタスク管理方
法、かかるマルチタスク管理方法を装置において実行す
るためのコンピュータプログラム、かかるプログラムを
記録した記憶媒体、高速な処理を行うことが可能なマル
チタスク管理システム、かかるマルチタスク管理システ
ムを有する装置、かかるマルチタスク管理システムを有
するプリンタを実現することにある。
The present invention has been made in view of the above problems, and an object of the present invention is to provide a multitask management method capable of performing high-speed processing, and the multitask management method. A computer program for executing the program in a device, a storage medium recording the program, a multitask management system capable of performing high-speed processing, a device having the multitask management system, and a printer having the multitask management system. It is to be realized.

【0022】[0022]

【課題を解決するための手段】主たる本発明は、実行さ
れるタスクの変更を生じさせるための手順を有する割込
み処理を用いて複数のタスクを管理するマルチタスク管
理方法において、前記割込み処理が有する前記手順は、
実行されるタスクの変更を生じさせるためのシステムコ
ールを実行する、該割込み処理とは異なる他の割込み処
理を実行可能状態とすることを特徴とするマルチタスク
管理方法である。
The main object of the present invention is to provide a multitask management method for managing a plurality of tasks by using an interrupt process having a procedure for causing a change of a task to be executed, the interrupt process having The procedure is
It is a multitask management method characterized in that a system call for causing a change of a task to be executed is executed and another interrupt process different from the interrupt process is set to an executable state.

【0023】本発明の他の特徴については、添付図面及
び以下の記載により明らかにする。
Other features of the present invention will be apparent from the accompanying drawings and the following description.

【0024】[0024]

【発明の実施の形態】===開示の概要=== 本明細書における発明の詳細な説明の項の記載により、
少なくとも次のことが明らかにされる。
BEST MODE FOR CARRYING OUT THE INVENTION === Summary of Disclosure === By the description in the detailed description of the invention in the present specification,
At least the following is revealed.

【0025】実行されるタスクの変更を生じさせるため
の手順を有する割込み処理を用いて複数のタスクを管理
するマルチタスク管理方法において、前記割込み処理が
有する前記手順は、実行されるタスクの変更を生じさせ
るためのシステムコールを実行する、該割込み処理とは
異なる他の割込み処理を実行可能状態とすることを特徴
とするマルチタスク管理方法。
In a multi-task management method for managing a plurality of tasks using interrupt processing having a procedure for causing a change of a task to be executed, the procedure included in the interrupt processing is A multitask management method, characterized in that another interrupt process different from the interrupt process, which executes a system call for causing it, is set to an executable state.

【0026】前記割込み処理が有する前記手順は、実行
されるタスクの変更を生じさせるためのシステムコール
を実行する、該割込み処理とは異なる他の割込み処理を
実行可能状態とすることにより、本システムコールの実
行が前記割込み(以下、第一割込みとする)処理の中では
なく、本割込み処理とは異なる他の割込み(以下、第二
割込みとする)処理の中で行われることになるから、第
一割込み処理の優先度と切り離して、第二割込み処理
の、言い換えれば上記システムコールの実行の優先度を
自由に設定することができる。上記優先度を他の第三割
込み処理よりも下位に設定した場合には、第二割込み処
理の実行中に第三割込み処理を受け付けることができ、
第三割込み処理の処理時間を短縮させることができる
(第一の効果)。
According to the procedure of the interrupt processing, a system call for causing a change of a task to be executed is executed, and another interrupt processing different from the interrupt processing is set in an executable state, so that the system of the present invention can be executed. Since the execution of the call is performed not in the interrupt (hereinafter, first interrupt) process, but in another interrupt (hereinafter, second interrupt) process different from this interrupt process, Separately from the priority of the first interrupt processing, the priority of the second interrupt processing, in other words, the execution of the system call can be freely set. If the priority is set lower than the other third interrupt processing, the third interrupt processing can be accepted during execution of the second interrupt processing,
The processing time of the third interrupt processing can be shortened (first effect).

【0027】また、前記割込み処理の実行中に前記他の
割込み処理が実行可能とされ、該割込み処理が終了した
後、該他の割込処理が、前記システムコールを実行する
こととしてもよい これにより、第一の効果を維持しながら、割込み原因に
応じた処理を優先して高速に処理することが可能となる
(第二の効果)。
Further, the other interrupt processing may be executed during execution of the interrupt processing, and after the interrupt processing is completed, the other interrupt processing may execute the system call. As a result, while maintaining the first effect, it is possible to prioritize the processing corresponding to the cause of the interrupt and perform high-speed processing (second effect).

【0028】実行されるタスクの変更を生じさせるため
の手順を有する割込み処理を用いて複数のタスクを管理
するマルチタスク管理方法において、前記割込み処理が
有する前記手順は、実行されるタスクの変更を生じさせ
るためのシステムコールを特定する情報を記憶させ、前
記記憶させられた情報に基づいて前記システムコールを
実行する、該割込み処理とは異なる他の割込み処理を実
行可能状態とすることを特徴とするマルチタスク管理方
法。
In a multi-task management method for managing a plurality of tasks using interrupt processing having a procedure for causing a change of a task to be executed, the procedure included in the interrupt processing is Information for specifying a system call to be generated is stored, and another interrupt process different from the interrupt process that executes the system call based on the stored information is set to an executable state. How to manage multitasking.

【0029】前記割込み処理が有する前記手順は、実行
されるタスクの変更を生じさせるためのシステムコール
を特定する情報を記憶させ、前記記憶させられた情報に
基づいて前記システムコールを実行する、該割込み処理
とは異なる他の割込み処理を実行可能状態とすることに
より、第一の効果が奏されることに加えて、システムコ
ール毎に第二割込み処理を用意する必要はなく、各シス
テムコールに共通の第二割込み処理を用意すればよいこ
ととなる(第三の効果)。
The procedure included in the interrupt processing stores information specifying a system call for causing a change of a task to be executed, and executes the system call based on the stored information. In addition to providing the first effect by enabling other interrupt processing different from the interrupt processing, it is not necessary to prepare a second interrupt processing for each system call. A common second interrupt process should be prepared (third effect).

【0030】また、前記割込み処理の実行中に、実行さ
れるタスクの変更を生じさせるためのシステムコールを
特定する情報が記憶され、かつ、前記他の割込み処理が
実行可能とされ、該割込み処理が終了した後、該他の割
込処理が、前記記憶させられた情報に基づいて前記シス
テムコールを実行することとしてもよい。
Further, during execution of the interrupt processing, information for specifying a system call for causing a change of a task to be executed is stored, and the other interrupt processing is enabled, and the interrupt processing is performed. After completion of the above, the other interrupt processing may execute the system call based on the stored information.

【0031】これにより、第三の効果を維持しながら、
割込み原因に応じた処理を優先して高速に処理すること
が可能となる(第四の効果) また、複数回実行される
前記割込み処理のうち一部の回数の前記割込み処理にお
いて前記手順が実行されるときには、前記手順が実行さ
れる割込み処理を開始する際に該割込み処理のために使
用されるレジスタを退避し、前記他の割込み処理を開始
する際に前記変更前に実行されるタスクのために使用さ
れるレジスタを退避し、前記手順が実行される割込み処
理を終了する際に該割込み処理のために使用されるレジ
スタを復帰し、かつ、前記他の割込み処理を終了する際
に前記変更後に実行されるタスクのために使用されるレ
ジスタを復帰してもよい。
As a result, while maintaining the third effect,
It becomes possible to preferentially process at high speed according to the cause of the interrupt (fourth effect). Further, the procedure is executed in a part of the interrupt processes of the interrupt processes executed a plurality of times. When this is done, the registers used for the interrupt processing are saved when starting the interrupt processing in which the procedure is executed, and the task executed before the change is executed when starting the other interrupt processing. Register used for saving the interrupt, restores the register used for the interrupt processing when the interrupt processing in which the procedure is executed is terminated, and saves the register used when the other interrupt processing is terminated. The registers used for the task executed after the modification may be restored.

【0032】これにより、全体として退避及び復帰を行
うべきレジスタの数を少なくすることができ、割込み処
理の処理時間を短縮させることができる(第五の効
果)。
As a result, the number of registers to be saved and restored can be reduced as a whole, and the processing time of interrupt processing can be shortened (fifth effect).

【0033】また、前記システムコールを特定する前記
情報は、先入れ先出し方式で、メモリに書き込まれ、か
つ、メモリから読み込まれることとしてもよい。
The information specifying the system call may be written in and read from the memory in a first-in first-out system.

【0034】これにより、実行されるタスクの変更を生
じさせるための手順が第一割込み処理中に複数備えられ
ている場合でも、第三乃至第五の効果を奏することが可
能となる(第六の効果)。
As a result, even if a plurality of procedures for changing the task to be executed are provided in the first interrupt processing, it is possible to obtain the third to fifth effects (sixth). Effect).

【0035】また、このようなマルチタスク管理方法を
装置において実現するためのコンピュータプログラム及
び該コンピュータプログラムを記録したコンピュータ読
み取り可能な記録媒体も実現可能である。
A computer program for realizing such a multitask management method in an apparatus and a computer-readable recording medium recording the computer program can also be realized.

【0036】次に、実行されるタスクの変更を生じさせ
るための手順を有する割込み処理を用いて複数のタスク
を管理するマルチタスク管理システムにおいて、前記割
込み処理が有する前記手順は、実行されるタスクの変更
を生じさせるためのシステムコールを実行する、該割込
み処理とは異なる他の割込み処理を実行可能状態とする
ことを特徴とするマルチタスク管理システム。
Next, in a multi-task management system for managing a plurality of tasks by using an interrupt process having a procedure for causing a change of a task to be executed, the procedure included in the interrupt process is The multi-task management system is characterized in that another interrupt process different from the interrupt process is executed to execute a system call for causing the change.

【0037】これにより、第一の効果と同様の効果を奏
するマルチタスク管理システムを実現することが可能と
なる。
As a result, it is possible to realize a multi-task management system having the same effect as the first effect.

【0038】また、前記割込み処理の実行中に前記他の
割込み処理が実行可能とされ、該割込み処理が終了した
後、該他の割込処理が、前記システムコールを実行する
こととしてもよい。
Further, the other interrupt processing may be enabled during execution of the interrupt processing, and after the interrupt processing is completed, the other interrupt processing may execute the system call.

【0039】これにより、第二の効果と同様の効果を奏
するマルチタスク管理システムを実現することが可能と
なる。
As a result, it is possible to realize a multi-task management system having the same effect as the second effect.

【0040】実行されるタスクの変更を生じさせるため
の手順を有する割込み処理を用いて複数のタスクを管理
するマルチタスク管理システムにおいて、前記割込み処
理が有する前記手順は、実行されるタスクの変更を生じ
させるためのシステムコールを特定する情報を記憶さ
せ、前記記憶させられた情報に基づいて前記システムコ
ールを実行する、該割込み処理とは異なる他の割込み処
理を実行可能状態とすることを特徴とするマルチタスク
管理システム。
In a multi-task management system that manages a plurality of tasks by using an interrupt process having a procedure for causing a change of a task to be executed, the procedure of the interrupt process includes a change of the task to be executed. Information for specifying a system call to be generated is stored, and another interrupt process different from the interrupt process that executes the system call based on the stored information is set to an executable state. A multitasking management system.

【0041】これにより、第三の効果と同様の効果を奏
するマルチタスク管理システムを実現することが可能と
なる。
As a result, it is possible to realize a multi-task management system having the same effect as the third effect.

【0042】また、前記割込み処理の実行中に、実行さ
れるタスクの変更を生じさせるためのシステムコールを
特定する情報が記憶され、かつ、前記他の割込み処理が
実行可能とされ、該割込み処理が終了した後、該他の割
込処理が、前記記憶させられた情報に基づいて前記シス
テムコールを実行することとしてもよい。
Further, during the execution of the interrupt processing, information for specifying a system call for causing a change of a task to be executed is stored, and the other interrupt processing can be executed. After completion of the above, the other interrupt processing may execute the system call based on the stored information.

【0043】これにより、第四の効果と同様の効果を奏
するマルチタスク管理システムを実現することが可能と
なる。
As a result, it is possible to realize a multi-task management system having the same effect as the fourth effect.

【0044】また、複数回実行される前記割込み処理の
うち一部の回数の前記割込み処理において前記手順が実
行されるときには、前記手順が実行される割込み処理を
開始する際に該割込み処理のために使用されるレジスタ
を退避し、前記他の割込み処理を開始する際に前記変更
前に実行されるタスクのために使用されるレジスタを退
避し、前記手順が実行される割込み処理を終了する際に
該割込み処理のために使用されるレジスタを復帰し、か
つ、前記他の割込み処理を終了する際に前記変更後に実
行されるタスクのために使用されるレジスタを復帰して
もよい。
Further, when the procedure is executed in a part of the interrupt processing of the interrupt processing executed a plurality of times, the interrupt processing is performed when the interrupt processing in which the procedure is executed is started. When saving the register used for the above, saving the register used for the task executed before the change when starting the other interrupt processing, and ending the interrupt processing executing the above procedure It is also possible to restore the register used for the interrupt processing, and restore the register used for the task executed after the change when the other interrupt processing is finished.

【0045】これにより、第五の効果と同様の効果を奏
するマルチタスク管理システムを実現することが可能と
なる。
As a result, it is possible to realize a multi-task management system which has the same effect as the fifth effect.

【0046】また、前記システムコールを特定する前記
情報は、先入れ先出し方式で、メモリに書き込まれ、か
つ、メモリから読み込まれることとしてもよい。
The information specifying the system call may be written in and read from the memory in a first-in first-out system.

【0047】これにより、第六の効果と同様の効果を奏
するマルチタスク管理システムを実現することが可能と
なる。
As a result, it is possible to realize a multi-task management system having the same effect as the sixth effect.

【0048】また、このようなマルチタスク管理システ
ムを有する装置又はプリンタも実現可能である。
An apparatus or printer having such a multitask management system can also be realized.

【0049】===第一の実施の形態=== 以下、本実施の形態を図面に基づいて説明する。図4
は、第一の実施の形態を示す流れ図である。タスクAで
示される列において、実線部はタスクAが実行されてい
ることを示し、点線部はタスクAが実行されていないこ
とを示していること、また、タスクBで示される列にお
いて、実線部はタスクBが実行されていることを示し、
点線部はタスクBが実行されていないことを示している
ことは、図1又は図2の場合と同様である。図4におい
ても、タスクA,Bとは別に割込み処理で示される列を
用意し、実線部により割込み処理が実行されていること
を示し、点線部により割込み処理が実行されていないこ
とを示している。本実施の形態の説明のために、第一割
込み処理36、第二割込み処理38、及び、第三割込み
処理40が図に示されている。
=== First Embodiment === The present embodiment will be described below with reference to the drawings. Figure 4
3 is a flow chart showing a first embodiment. In the column indicated by task A, the solid line portion indicates that task A is being executed, the dotted line portion indicates that task A is not being executed, and in the column indicated by task B, the solid line portion Shows that task B is being executed,
Similar to the case of FIG. 1 or 2, the dotted line indicates that the task B is not executed. In FIG. 4 as well, a column for interrupt processing is prepared separately from tasks A and B, the solid line portion indicates that the interrupt processing is being executed, and the dotted line portion indicates that the interrupt processing is not being executed. There is. For the purpose of explaining the present embodiment, the first interrupt process 36, the second interrupt process 38, and the third interrupt process 40 are shown in the figure.

【0050】まず始めに、タスクAが実行されており、
ここで、ある割込み、すなわち、第一割込みが発生し、
この割込み処理においては本割込み原因に応じた処理が
行われることになる(ステップS44)点については、
図2において従来の技術で説明したものと同様である。
そして、レジスタの退避を割込み処理開始の際に確実に
行うような設計にしなければならない(ステップS4
2)。
First of all, task A is being executed,
Here, an interrupt occurs, that is, the first interrupt occurs,
In this interrupt processing, processing according to the cause of this interrupt is performed (step S44).
This is the same as that described in the related art in FIG.
Then, it must be designed so that the registers are saved without fail at the start of interrupt processing (step S4).
2).

【0051】本実施の形態においては、図2において従
来の技術で説明したような割込み原因に応じた処理等の
中で実行されるタスクの変更を生じさせるためのシステ
ムコールを実行する(ステップS24)という手順では
なく、第二割込み処理というものを準備し、割込み原因
に応じた処理等の中でかかる第二割込み処理を実行可能
とする、換言すれば、第二割込み処理を起動する(ステ
ップS46)。加えて、かかる第二割込み処理の優先度
を第一割込み処理の優先度よりも下位に設定する。この
ようにすると、第二割込み処理は起動後直ちに実行はさ
れず、第一割込み処理終了後に実行されることとなる。
In the present embodiment, a system call for changing the task to be executed in the processing according to the cause of interrupt as described in the prior art in FIG. 2 is executed (step S24). ), But a second interrupt process is prepared so that the second interrupt process can be executed among the processes according to the cause of the interrupt, in other words, the second interrupt process is activated (step S46). In addition, the priority of the second interrupt process is set lower than the priority of the first interrupt process. In this case, the second interrupt process is not executed immediately after starting, but is executed after the first interrupt process is completed.

【0052】やがて、割込み原因に応じた処理が完了
し、第一割込み処理が終了することになるが、本処理終
了の際に、従来の技術の項で述べたのと同様の理由で、
レジスタの復帰を行う(ステップS48)。なお、この
時点では、スケジューラへのジャンプは行われない。
Eventually, the processing corresponding to the cause of the interrupt will be completed and the first interrupt processing will be ended. At the end of this processing, for the same reason as described in the section of the prior art,
The register is restored (step S48). At this point, no jump to the scheduler is performed.

【0053】第一割込みが終了したら、次に実行可能状
態とされていた、すなわち起動されていた第二割込み処
理が実行される。ここでも、レジスタの退避を割込み処
理開始の際に行う(ステップS50)。
When the first interrupt is completed, the second interrupt process which is in the ready state, that is, which has been activated, is executed next. Here again, the registers are saved at the start of interrupt processing (step S50).

【0054】第二割込み処理においては、実行されるタ
スクの変更を生じさせるためのシステムコールの実行を
行う(ステップS52)。すなわち、従来の技術で述べ
られた例においては第一割込み処理で行われた当該手順
を、本実施の形態においては第一割込み処理とは別に準
備された第二割込み処理の中で実施する。ここで、タス
クBを待ち状態から実行可能状態へ遷移させるWake
UpタスクBというシステムコールを例に説明する。
また、割込み処理中に実行されるシステムコールとして
別のシステムコールが用意されている点、システムコー
ルの処理手順も若干異なっており、システムコール終了
の際にスケジューラへジャンプしない点、システムコー
ル開始の際にレジスタの退避が行われない点について
も、図2において従来の技術で説明したものと同様であ
る。タスクBを待ち状態から、実行可能状態に遷移させ
ることは行われる(ステップS54)。
In the second interrupt process, a system call for changing the task to be executed is executed (step S52). That is, the procedure performed in the first interrupt process in the example described in the related art is performed in the second interrupt process prepared separately from the first interrupt process in the present embodiment. Here, Wake for transitioning the task B from the waiting state to the ready state
A system call called Up task B will be described as an example.
In addition, another system call is prepared as a system call executed during interrupt processing, the processing procedure of the system call is slightly different, and it does not jump to the scheduler when the system call ends. The fact that the registers are not saved at this time is also the same as that described in the related art in FIG. The task B is changed from the waiting state to the ready state (step S54).

【0055】次に、スケジューラへジャンプし (ステッ
プS56)、そして、スケジューラが動作する(ステッ
プS58)。割込み処理前に実行していたタスクAとシ
ステムコールWake UpタスクBにより実行可能状
態とされたタスクB双方の優先度が比較されることとな
り、タスクBの優先度の方が高ければ、実行されるタス
クがタスクBに切り替わることになる。なお、タスクB
に切り替わる際には、タスクBのレジスタの復帰、すな
わち、レジスタ情報をタスクBのタスク制御ブロックの
スタックエリアからレジスタへ戻す作業が行われる(ス
テップS60)。
Next, jump to the scheduler (step S56), and the scheduler operates (step S58). The priorities of the task A that was being executed before the interrupt processing and the task B that was made ready by the system call Wake Up task B are compared, and if the priority of the task B is higher, it is executed. Task to be switched to task B. In addition, task B
At the time of switching to, the operation of returning the register of task B, that is, the operation of returning the register information from the stack area of the task control block of task B to the register is performed (step S60).

【0056】今、第一割込み処理36及び第二割込み処
理38とは別の第三割込み処理40を考える。従来の技
術においては、割込み処理16の優先度が別の割り込み
処理28よりも高い場合には、システムコール部も含め
て割込み処理16の処理中には別の割込み処理28は実
行され得なかった。
Now, consider a third interrupt process 40 different from the first interrupt process 36 and the second interrupt process 38. In the prior art, if the priority of the interrupt processing 16 is higher than that of the other interrupt processing 28, another interrupt processing 28 cannot be executed during the processing of the interrupt processing 16 including the system call part. .

【0057】しかし、本実施の形態においては、システ
ムコールの実行が第一割込み処理36の中ではなく、第
二割込み処理38の中で行われることになるから、第一
割込み処理36の優先度と切り離して、第二割込み処理
38の、言い換えれば上記システムコールの実行の優先
度を自由に設定することができる。図4に示されるよう
に第二割込み処理38の優先度を第三割込み処理40よ
りも下位に設定した場合には、第二割込み処理38の実
行中に第三割込み処理40を受け付けることができ、第
三割込み処理40の処理時間を短縮させることができ
る。換言すれば、従来の技術の例においては、割込み処
理16の実行中に、別の割込みが発生すれば、割込み処
理16の優先度が別の割り込み処理28よりも高いの
で、割込み処理16終了まで別の割込み処理28の実行
が延期されるが、本実施の形態の例においては、第二割
込み処理38の実行中に第三割込み処理40が発生すれ
ば、第二割込み処理38の優先度が第三割込み処理40
の優先度よりも低いので、直ちに第三割込み処理40が
実行され、かかる処理の処理時間を短縮させることがで
きる。
However, in the present embodiment, the system call is executed in the second interrupt processing 38, not in the first interrupt processing 36, so that the priority of the first interrupt processing 36 is high. Separately from the above, the priority of execution of the second interrupt processing 38, in other words, the execution of the system call can be freely set. As shown in FIG. 4, when the priority of the second interrupt processing 38 is set lower than that of the third interrupt processing 40, the third interrupt processing 40 can be accepted during execution of the second interrupt processing 38. The processing time of the third interrupt processing 40 can be shortened. In other words, in the example of the conventional technique, if another interrupt occurs during execution of the interrupt process 16, the priority of the interrupt process 16 is higher than that of the other interrupt process 28. Although the execution of another interrupt process 28 is postponed, in the example of the present embodiment, if the third interrupt process 40 occurs during the execution of the second interrupt process 38, the priority of the second interrupt process 38 becomes higher. Third interrupt processing 40
Since the priority is lower than the priority of, the third interrupt process 40 is immediately executed, and the processing time of this process can be shortened.

【0058】なお、本実施の形態においては、第一割込
み処理の優先度が第二割込み処理の優先度よりも高い場
合について示されているが、逆に、第二割込み処理の優
先度が第一割込み処理の優先度よりも高い場合であって
もよい。この場合には、第二割込み処理は起動後直ちに
実行され、所謂「割込みの多重」の状態となる。この場
合においても、第一割込み処理の優先度と切り離して、
第二割込み処理の、言い換えれば上記システムコールの
実行の優先度を自由に設定することができる。第二割込
み処理の優先度を上位に、第三割込み処理の優先度を中
位に、第一割込み処理の優先度を下位に設定すれば、第
一割込み処理実行中には第三割込み処理を受け付けさ
せ、第二割込み処理実行中には第三割込み処理を受け付
けさせないようにすることができる。ただし、割込み原
因に応じた処理を、システムコールの実行よりも優先し
て高速に処理させることを重要視する場合には、第一割
込み処理の優先度を第二割込み処理の優先度よりも高く
する方が望ましい。
In this embodiment, the case where the priority of the first interrupt processing is higher than the priority of the second interrupt processing is shown. On the contrary, the priority of the second interrupt processing is the first. It may be higher than the priority of one interrupt process. In this case, the second interrupt process is executed immediately after the start-up, resulting in a so-called "interrupt multiple" state. Even in this case, separate from the priority of the first interrupt processing,
The priority of the second interrupt processing, in other words, the execution of the system call can be freely set. If the priority of the second interrupt process is set to high, the priority of the third interrupt process is set to medium, and the priority of the first interrupt process is set to low, the third interrupt process will be executed during execution of the first interrupt process. It is possible to accept the third interrupt process while accepting the second interrupt process. However, if it is important to prioritize the processing according to the cause of the interrupt at a higher speed than the execution of the system call, set the priority of the first interrupt processing higher than that of the second interrupt processing. It is better to do.

【0059】また、図4においては、第二割込み処理を
実行可能状態とする手順(ステップS46)は、割込み
原因に応じた処理手順(ステップS44)内に含まれて
いるが、割込み原因に応じた処理手順の前又は後であっ
てもよい。
In FIG. 4, the procedure for setting the second interrupt process to the executable state (step S46) is included in the processing procedure (step S44) according to the cause of the interrupt. It may be before or after the treatment procedure.

【0060】===第二の実施の形態=== 次に、他の実施の形態を図面に基づいて説明する。図5
は、第二の実施の形態を示す流れ図である。
=== Second Embodiment === Next, another embodiment will be described with reference to the drawings. Figure 5
9 is a flow chart showing a second embodiment.

【0061】図5の図4との相違点は以下の通りであ
る。第一に、第一割込み処理36の中の割込み原因に応
じた処理(ステップS44)において、割込み原因を実
行可能状態とする(ステップS46)前に、実行される
タスクの変更を生じさせるためのシステムコールを特定
する情報を記憶させる手順を設ける(ステップS6
2)。本情報の記憶方法としては、メモリやバッファに
書き込む方法等が考えられるが、かかる方法に限定され
るものではない。本実施の形態では、かかるシステムコ
ールの例を、既述と同様、「割込み処理中のWake
UpタスクB」としている。第二に、これに対応して、
第二割込み処理38の中の上記システムコールを実行す
る手順(ステップS52)の前に、上記記憶された情報
を取り出す手順を設ける(ステップS64)。本実施の
形態では、かかるシステムコールの例を、既述と同様、
「割込み処理中のWake UpタスクB」としてい
る。
The difference between FIG. 5 and FIG. 4 is as follows. First, in the process according to the interrupt cause in the first interrupt process 36 (step S44), before the cause of the interrupt is set to the executable state (step S46), the task to be executed is changed. A procedure for storing information specifying a system call is provided (step S6).
2). A method of storing this information may be a method of writing it in a memory or a buffer, but is not limited to this method. In the present embodiment, an example of such a system call is the same as “Wake during interrupt processing” as described above.
Up task B ”. Second, in response to this,
Before the procedure of executing the system call in the second interrupt processing 38 (step S52), a procedure of extracting the stored information is provided (step S64). In the present embodiment, an example of such a system call is
It is referred to as "Wake Up task B during interrupt processing".

【0062】以下、順を追って説明する。まず始めに、
タスクAが実行されており、ここで、ある割込み、すな
わち、第一割込みが発生し、この割込み処理においては
本割込み原因に応じた処理が行われることになる(ステ
ップS44)。そして、レジスタの退避を割込み処理開
始の際に確実に行うような設計にしなければならない
(ステップS42)。
The steps will be described below in order. First of all,
Task A is being executed, and an interrupt, that is, a first interrupt is generated here, and in this interrupt processing, processing according to the cause of this interrupt is performed (step S44). Then, the register must be saved so that it is surely saved when interrupt processing is started (step S42).

【0063】また、第二割込み処理というものを準備
し、割込み原因に応じた処理等の中でかかる第二割込み
処理を実行可能とする、換言すれば、第二割込み処理を
起動する(ステップS46)。加えて、かかる第二割込み
処理の優先度を第一割込み処理の優先度よりも下位に設
定し、第二割込み処理は起動後直ちに実行はされず、第
一割込み処理終了後に実行されることとなる。ここまで
は第一の実施の形態と同様である。
Further, a second interrupt process is prepared so that the second interrupt process can be executed among the processes according to the cause of the interrupt. In other words, the second interrupt process is activated (step S46). ). In addition, the priority of the second interrupt processing is set to be lower than the priority of the first interrupt processing, and the second interrupt processing is not executed immediately after starting, but is executed after the end of the first interrupt processing. Become. The process up to this point is the same as in the first embodiment.

【0064】次に、本実施の形態においては、第二割込
み処理内において実施されるシステムコールである「割
込み処理中のWake UpタスクB」を特定する情報
が、割込み原因を実行可能状態とする(ステップS4
6)前に記憶される(ステップS62)。
Next, in the present embodiment, the information that specifies "Wake Up task B during interrupt processing", which is a system call executed in the second interrupt processing, makes the interrupt cause executable. (Step S4
6) It is stored before (step S62).

【0065】やがて割込み原因に応じた処理が完了し、
第一割込み処理終了の際に、レジスタの復帰を行う(ス
テップS48)点、第一割込みの終了後起動されていた
第二割込み処理が実行される点、レジスタの退避を割込
み処理開始の際に行う(ステップS50)点について
は、第一の実施の形態と同様である。
Eventually, the processing corresponding to the cause of the interrupt is completed,
At the end of the first interrupt processing, the register is restored (step S48), the second interrupt processing that was started after the completion of the first interrupt is executed, and the saving of the register is performed at the time of starting the interrupt processing. The point of performing (step S50) is the same as that of the first embodiment.

【0066】次に、本実施の形態においては、第二割込
み処理内において実施されるシステムコールである「割
込み処理中のWake UpタスクB」を特定する情報
を取り出し(ステップS64)、かかる情報に基づいて
前記システムコールの実行を行う(ステップS52)。
以下の手順については、第一の実施の形態と同様であ
る。
Next, in the present embodiment, the information for identifying the "Wake Up task B in the interrupt process" which is the system call executed in the second interrupt process is extracted (step S64), and the information is extracted. Based on this, the system call is executed (step S52).
The following procedure is the same as in the first embodiment.

【0067】上記のようなシステムコールを特定する情
報の記憶及び取り出しを行う手順が無い場合には、第二
割込み処理として複数の処理を用意しなければならな
い。例えば、第二割込み処理aが「割込み処理中のWa
ke UpタスクB」、第二割込み処理bが「割込み処
理中のWake UpタスクC」、第二割込み処理cが
「割込み処理中のReceive Message」の
ごとくである。しかし、本実施の形態においては、上記
システムコールを特定する情報、例えば、「割込み処理
中のWake UpタスクB」、「割込み処理中のWa
ke UpタスクC」、「割込み処理中のReceiv
e Message」という情報を記憶し、また、取り
出す手順を有するため、第二割込み処理自体を複数用意
する必要はなく、上記システムコールに共通の第二割込
み処理を用意すればよいこととなる。
If there is no procedure for storing and retrieving the information for specifying the system call as described above, a plurality of processes must be prepared as the second interrupt process. For example, the second interrupt processing a is “Wa during interrupt processing
“Ke Up task B”, the second interrupt process “b” is “Wake Up task C during interrupt process”, and the second interrupt process c is “Receive Message during interrupt process”. However, in the present embodiment, information specifying the system call, such as “Wake Up task B in interrupt processing” and “Wa in interrupt processing” is used.
ke Up task C ”,“ Receive during interrupt processing ”
Since there is a procedure for storing and retrieving the information "e Message", it is not necessary to prepare a plurality of second interrupt processes themselves, and it is sufficient to prepare a common second interrupt process for the above system call.

【0068】なお、上記実施の形態においては、実行さ
れるタスクの変更を生じさせるためのシステムコールを
特定する情報を記憶させる手順(ステップS62)は、
第二割込み処理を実行可能状態とする手順(ステップS
46)の前にあるが、第二割込み処理を実行可能状態と
する手順(ステップS46)の後でもよい。また、実行
されるタスクの変更を生じさせるためのシステムコール
を特定する情報を記憶させる手順(ステップS62)
は、割込み原因に応じた処理(ステップS44)内に含
まれているが、割込み原因に応じた処理(ステップS4
4)内に含まれていなくてもよい。
In the above embodiment, the procedure for storing the information for specifying the system call for causing the change of the task to be executed (step S62) is as follows.
Procedure for making the second interrupt process ready (step S
Although it is before step 46), it may be after the procedure (step S46) for making the second interrupt processing ready. In addition, a procedure for storing information specifying a system call for causing a change in the executed task (step S62)
Is included in the process according to the cause of the interrupt (step S44), but the process according to the cause of the interrupt (step S4)
4) It does not need to be included in.

【0069】また、第一の実施の形態で記述した「割込
みの多重」という形態を許す点、及び、第二割込み処理
を実行可能状態とする手順(ステップS46)は、割込
み原因に応じた処理手順(ステップS44)内に含まれ
ていなくても良い点については本実施の形態にも該当す
る。
The point that the form of "multiple interruptions" described in the first embodiment is allowed, and the procedure for making the second interrupt process executable (step S46) is the process according to the cause of the interrupt. The fact that it does not have to be included in the procedure (step S44) also corresponds to the present embodiment.

【0070】===第三の実施の形態=== 次に、他の実施の形態を図面に基づいて説明する。図6
は、第三の実施の形態を示す流れ図である。
=== Third Embodiment === Next, another embodiment will be described with reference to the drawings. Figure 6
9 is a flow chart showing a third embodiment.

【0071】図6に示される第三の実施の形態は、従来
の技術で既に述べた図3に対応したものである。すなわ
ち、第一割込み処理が複数回実行され、その割込み処理
毎に、カウンタによりその回数をカウントし(ステップ
S66)、それが100回目であるときとそうでないと
きとで異なる処理が行われる(ステップS68)場合に
ついて示している。
The third embodiment shown in FIG. 6 corresponds to FIG. 3 already described in the prior art. That is, the first interrupt process is executed a plurality of times, the number of times is counted by the counter for each interrupt process (step S66), and different processes are performed depending on whether it is the 100th time or not (step S66). S68) is shown.

【0072】以下、順を追って説明する。まず始めに、
タスクAが実行されており、ここで、ある割込み、すな
わち、第一割込みが発生し、この割込み処理においては
本割込み原因に応じた処理が行われることになる(ステ
ップS44)。そして、レジスタの退避を割込み処理開
始の際に行う必要がある(ステップS42)。ここまで
は、第一の実施の形態と同様である。
The steps will be described below in order. First of all,
Task A is being executed, and an interrupt, that is, a first interrupt is generated here, and in this interrupt processing, processing according to the cause of this interrupt is performed (step S44). Then, it is necessary to save the registers at the time of starting the interrupt processing (step S42). Up to this point, the process is the same as in the first embodiment.

【0073】次に、実行される第一割り込み処理の回数
をカウンタによりカウントする(ステップS66)。カ
ウンタの値が100になったときのみ割込み処理中のW
ake UpタスクBというシステムコールを実行させ
るので、カウンタの値が1乃至99である場合には、割
込み原因に応じた処理を行った(ステップS44)後
に、第一割込み処理を抜けて、スケジューラ実行という
手順(ステップS58)となる。ここでは、タスクBは
実行可能状態とされていないので、割込み処理前に実行
していたタスクAが再度実行されることとなる。そし
て、タスクAのレジスタの復帰が行われることとなる
(ステップS70)。
Next, the number of times the first interrupt process is executed is counted by the counter (step S66). W during interrupt processing only when the counter value reaches 100
Since a system call called ake Up task B is executed, if the counter value is 1 to 99, the process corresponding to the cause of the interrupt is performed (step S44), the first interrupt process is exited, and the scheduler is executed. The procedure (step S58). Here, since the task B is not in the ready state, the task A that was being executed before the interrupt processing will be executed again. Then, the registers of task A are restored (step S70).

【0074】カウンタの値が100である場合には、第
一の実施の形態と同様、従来の技術で説明したような割
込み原因に応じた処理等の中で実行されるタスクの変更
を生じさせるためのシステムコールを実行する(ステッ
プS24)という手順ではなく、第二割込み処理という
ものを準備し、割込み原因に応じた処理等の中でかかる
第二割込み処理を実行可能とする、換言すれば、第二割
込み処理を起動する(ステップS46)。やがて、割込み
原因に応じた処理が完了し、第一割込み処理が終了する
ことになるが、この際にレジスタの復帰を行う(ステッ
プS48)。以下の手順については、第一の実施の形態
と同様である。なお、上記のカウンタは、カウンタの値
が100を超えたらリセットされる。
When the value of the counter is 100, as in the first embodiment, the change of the task executed in the processing according to the cause of the interrupt as described in the prior art is caused. A procedure for executing a system call for (step S24), a second interrupt process is prepared so that the second interrupt process can be executed in the process according to the cause of the interrupt. , Starts the second interrupt process (step S46). Eventually, the process corresponding to the cause of the interrupt is completed and the first interrupt process is completed. At this time, the register is restored (step S48). The following procedure is the same as in the first embodiment. The above counter is reset when the counter value exceeds 100.

【0075】手順としては上記の通りであるが、ここ
で、レジスタの復帰及び退避に着目する。図6に示され
るステップで言えば、ステップS42,ステップS4
8、ステップS50、ステップS60及びステップS7
0である。
Although the procedure is as described above, attention is paid to the restoration and saving of the registers. The steps shown in FIG. 6 include steps S42 and S4.
8, step S50, step S60 and step S7
It is 0.

【0076】従来の技術の項で述べたとおり、割込み処
理中に実行されるタスクの変更を生じさせるためのシス
テムコールを実行する(ステップS24)場合には、図
2のステップS20において、割込み処理で使用するレ
ジスタだけでなく、基本的に全レジスタ、少なくとも変
更前のタスク、すなわち、タスクAに使用されるレジス
タの退避を行っておく必要がある。同様に、図2のステ
ップS15の後タスクBが実行される際には、基本的に
全レジスタ、少なくとも変更後のタスク、すなわちタス
クBに使用されるレジスタの復帰を行っておく必要があ
る。
As described in the section of the prior art, when the system call for causing the change of the task executed during the interrupt processing is executed (step S24), the interrupt processing is performed in step S20 of FIG. It is necessary to save not only the registers used in step 1. but basically all registers, at least the task before the change, that is, the registers used for task A. Similarly, when the task B is executed after step S15 in FIG. 2, it is basically necessary to restore all the registers, at least the changed task, that is, the register used for the task B.

【0077】一方、本実施の形態において、復帰及び退
避を行うレジスタの数に着目すると次のようになる。先
ず、ステップS42においては,第一割込み処理のため
に使用されるレジスタを退避する。そして、カウンタの
値が1乃至99である場合には、ステップS70におい
て本レジスタを復帰する。一方、カウンタの値が100
である場合には、ステップS48において、本レジスタ
を復帰し、次に、ステップS50において、基本的に全
レジスタ、少なくともタスクAに使用されるレジスタの
退避を行い、ステップS60において、基本的に全レジ
スタ、少なくともタスクBに使用されるレジスタの復帰
を行う。
On the other hand, in the present embodiment, focusing on the number of registers to be restored and saved, it becomes as follows. First, in step S42, the registers used for the first interrupt processing are saved. If the counter value is 1 to 99, this register is restored in step S70. On the other hand, the counter value is 100
If so, in step S48, this register is restored, then in step S50, basically all registers, at least the registers used for task A, are saved, and in step S60, basically all registers are saved. Restore the registers, at least the registers used for task B.

【0078】ここで、具体的に、全体として退避及び復
帰を行うべきレジスタの数に注目する。第一割込み処理
のために使用されるレジスタの数を2、基本的に全レジ
スタ、少なくともタスクA若しくはタスクBに使用され
るレジスタの数を10とすると、従来の技術の場合に
は、退避されるレジスタの数は10個×100回=10
00個、復帰されるレジスタの数は同式により1000
個となるのに対し、本実施の形態の場合には、退避され
るレジスタの数は2個×99回+(2個×1回+10個
×1回)=210個、復帰されるレジスタの数は同式に
より210個となる。このように、全体として、退避及
び復帰を行うべきレジスタの数を少なくすることがで
き、したがって、割込み処理の処理時間を短縮させるこ
とができる。
Here, specifically, attention is paid to the number of registers to be saved and restored as a whole. Assuming that the number of registers used for the first interrupt processing is 2, and basically all the registers, at least the number of registers used for task A or task B, is 10, the conventional technique saves them. The number of registers is 10 × 100 = 10
00, the number of restored registers is 1000 by the same formula.
In contrast to this, in the case of the present embodiment, the number of registers saved is 2 × 99 times + (2 × 1 times + 10 × 1 times) = 210, and the number of registers to be restored is The number is 210 by the same formula. In this way, the number of registers to be saved and restored can be reduced as a whole, and thus the processing time of interrupt processing can be shortened.

【0079】なお、上記実施の形態においては、100
回のうち1回異なる処理を行うこととしたが、例えば、
50回のうち1回、100回のうち2回のように、複数
回実行される第一割込み処理のうち一部の回数の第一割
込み処理において異なる処理が行われる場合であればよ
い。また、回数の把握はカウンタによるものでなくとも
よい。
In the above embodiment, 100
It was decided to perform different processing once in each time.
It suffices that different processes are performed in some of the first interrupt processes of the plurality of first interrupt processes, such as once in 50 times and twice in 100 times. Further, the number of times may not be grasped by a counter.

【0080】また、復帰、退避されるレジスタの数は1
0個又は2個としたが、これに限られるものではない。
The number of registers restored and saved is 1
The number is 0 or 2, but the number is not limited to this.

【0081】また、実行されるタスクの変更を生じさせ
るためのシステムコールを特定する情報を記憶させ、か
かる記憶させられた情報に基づいてシステムコールを実
行する手順があってもよい。
There may be a procedure of storing information specifying a system call for causing a change of a task to be executed and executing the system call based on the stored information.

【0082】また、カウンタに係る手順(ステップS6
6、ステップS68)及び第二割込み処理を実行可能状
態とする手順(ステップS46)は、割込み原因に応じ
た処理手順(ステップS44)内に含まれているが、割
込み原因に応じた処理手順の前又は後であってもよい。
Further, the procedure relating to the counter (step S6
6, step S68) and the procedure (step S46) for setting the second interrupt processing to the executable state are included in the processing procedure (step S44) according to the interrupt cause, but It may be before or after.

【0083】===第四の実施の形態=== 次に、他の実施の形態を図面に基づいて説明する。図7
は、第四の実施の形態を示す流れ図である。
=== Fourth Embodiment === Next, another embodiment will be described with reference to the drawings. Figure 7
9 is a flowchart showing a fourth embodiment.

【0084】図7に示される第四の実施の形態は、実行
されるタスクの変更を生じさせるための手順が第一割込
み処理中に複数備えられており、この場合の処理が上記
実施の形態とは異なる。
In the fourth embodiment shown in FIG. 7, a plurality of procedures for changing the task to be executed are provided in the first interrupt processing, and the processing in this case is performed in the above-described embodiment. Is different from.

【0085】以下、順を追って説明する。まず始めに、
タスクAが実行されており、ここで、ある割込み、すな
わち、第一割込みが発生し、この割込み処理においては
本割込み原因に応じた処理が行われることになる(ステ
ップS44)。そして、レジスタの退避を割込み処理開
始の際に確実に行うような設計にしなければならない
(ステップS42)。
The steps will be described below in order. First of all,
Task A is being executed, and an interrupt, that is, a first interrupt is generated here, and in this interrupt processing, processing according to the cause of this interrupt is performed (step S44). Then, the register must be saved so that it is surely saved when interrupt processing is started (step S42).

【0086】また、第二割込み処理というものを準備
し、割込み原因に応じた処理等の中でかかる第二割込み
処理を実行可能とする、換言すれば、第二割込み処理を
起動する(ステップS46)。加えて、かかる第二割込み
処理の優先度を第一割込み処理の優先度よりも下位に設
定し、第二割込み処理は起動後直ちに実行はされず、第
一割込み処理終了後に実行されることとなる。
Also, a second interrupt process is prepared so that the second interrupt process can be executed among the processes according to the cause of the interrupt, in other words, the second interrupt process is activated (step S46). ). In addition, the priority of the second interrupt processing is set to be lower than the priority of the first interrupt processing, and the second interrupt processing is not executed immediately after starting, but is executed after the end of the first interrupt processing. Become.

【0087】また、第二割込み処理内において実施され
るシステムコールである「割込み処理中のWake U
pタスクB」を特定する情報が、割込み原因を実行可能
状態とする(ステップS46)前に記憶される(ステッ
プS72)。ここまでは、第二の実施の形態と同様であ
る。
A system call "Wake U during interrupt processing" which is a system call executed in the second interrupt processing.
The information specifying "p task B" is stored (step S72) before the cause of the interrupt is set to the executable state (step S46). Up to this point, the process is the same as in the second embodiment.

【0088】しかし、本実施の形態においては、実行さ
れるタスクの変更を生じさせるためのもう一つの手順
が、第一割込み処理内に存在する。これについても、従
来の技術で説明したような割込み原因に応じた処理等の
中で実行されるタスクの変更を生じさせるためのシステ
ムコールを実行する(ステップS24)という手順では
なく、第二割込み処理というものを準備し、割込み原因
に応じた処理等の中でかかる第二割込み処理を実行可能
とする、換言すれば、第二割込み処理を起動する(ステ
ップS75)。加えて、かかる第二割込み処理の優先度
を第一割込み処理の優先度よりも下位に設定する。さら
に、第二割込み処理内において実施されるシステムコー
ル、例えば、「割込み処理中のWake Upタスク
C」を特定する情報が、割込み割込み原因を実行可能状
態とする(ステップS75)前に記憶される(ステップ
S74)。
However, in the present embodiment, another procedure for causing the change of the task to be executed exists in the first interrupt processing. In this case as well, the second interrupt rather than the procedure of executing the system call for causing the change of the task executed in the processing according to the cause of the interrupt as described in the related art (step S24) A process is prepared so that the second interrupt process can be executed among the processes according to the cause of the interrupt, in other words, the second interrupt process is activated (step S75). In addition, the priority of the second interrupt process is set lower than the priority of the first interrupt process. Further, a system call executed in the second interrupt process, for example, information specifying "Wake Up task C in interrupt process" is stored before the interrupt interrupt cause is set to the executable state (step S75). (Step S74).

【0089】また、本実施の形態においては、上記実行
されるタスクの変更を生じさせるためのシステムコール
を特定する情報の記憶は、バッファ等のメモリに書きこ
むことによって行われる。
Further, in the present embodiment, the information for specifying the system call for causing the change of the task to be executed is stored by writing it in the memory such as the buffer.

【0090】なお、上記においては、第二割込み処理を
実行可能状態とする手順が二重に行われている(ステッ
プS46、ステップS75)が、通常は、二度目の手順
を行ったときには、第二割込み処理は既に実行可能状態
となっており、かかる状態に変化は発生しない。ただ
し、第二割込み処理を実行可能状態とする手順の回数を
カウントし、既に本手順が行われているときには、第二
割込み処理を実行可能状態としないような手順としても
よい。
In the above description, the procedure for making the second interrupt process executable is duplicated (steps S46 and S75), but normally, when the second procedure is performed, (2) The interrupt processing is already in the executable state, and there is no change in this state. However, it is also possible to count the number of times of the procedure for making the second interrupt processing executable and not to make the second interrupt processing executable when this procedure has already been performed.

【0091】やがて割込み原因に応じた処理が完了し、
第一割込み処理終了の際に、レジスタの復帰を行う(ス
テップS48)点、第一割込みの終了後起動されていた
第二割込み処理が実行される点、レジスタの退避を割込
み処理開始の際に行う(ステップS50)点について
は、第二の実施の形態と同様である。
Eventually, the processing corresponding to the cause of the interrupt is completed,
At the end of the first interrupt processing, the register is restored (step S48), the second interrupt processing that was started after the completion of the first interrupt is executed, and the saving of the register is performed at the time of starting the interrupt processing. The point of performing (step S50) is the same as that of the second embodiment.

【0092】次に、第二割込み処理内において実施され
るシステムコールを特定する情報を取り出し、かかる情
報に基づいて前記システムコールの実行を行うが、本実
施の形態においては、上記情報が2種類存在する。これ
については、以下のような手順で処理が行われる。
Next, the information for specifying the system call to be executed in the second interrupt processing is taken out and the system call is executed based on this information. In the present embodiment, there are two types of the above information. Exists. With respect to this, processing is performed in the following procedure.

【0093】先ず、システムコールを特定する情報が記
憶されるメモリが空かどうかを判定する(ステップS7
8)。メモリには「割込み処理中のWake Upタス
クB」と「割込み処理中のWake UpタスクC」い
う情報が入っておりメモリは空でないので、メモリから
情報を読み込み、これに基づいたシステムコールを実行
し(ステップS80)、ステップS78へ戻る。なお、
詳細は後述するが、本実施の形態においては、メモリへ
の書きこみ及びメモリからの読み込みについて先入れ先
出し方式を採用するため、初めに、メモリから「割込み
処理中のWake UpタスクB」という情報が読み込
まれる。
First, it is judged whether or not the memory for storing the information for specifying the system call is empty (step S7).
8). The memory contains information such as "Wake Up Task B during interrupt processing" and "Wake Up Task C during interrupt processing", and the memory is not empty, so the information is read from the memory and the system call based on this is executed. Then (step S80), the process returns to step S78. In addition,
Although details will be described later, in the present embodiment, since the first-in first-out method is used for writing to and reading from the memory, first, the information "Wake Up task B during interrupt processing" is read from the memory. Be done.

【0094】次に、ステップS78が繰り返されるが、
メモリには「割込み処理中のWake UpタスクC」
いう情報が残っているから、メモリは依然空でない。よ
って、メモリから情報を読み込み、これに基づいたシス
テムコール、すなわち「割込み処理中のWake Up
タスクC」というシステムコールを実行し(ステップS
80)、ステップS78へ戻る。
Next, step S78 is repeated,
"Wake Up Task C during interrupt processing" is stored in the memory
The memory is still non-empty because there is information left to say. Therefore, information is read from the memory and a system call based on the information is read, that is, "Wake Up during interrupt processing.
A system call "task C" is executed (step S
80) and returns to step S78.

【0095】再度、ステップS78が繰り返されるが、
今度はメモリが空となっており、この場合は、スケジュ
ーラへジャンプする(ステップS56)。
Step S78 is repeated again,
This time, the memory is empty, and in this case, the process jumps to the scheduler (step S56).

【0096】上記をもって、割込み処理からのタスクへ
の復帰がなされ、そして、スケジューラが動作する点に
ついては、第二の実施の形態と同様であるが(ステップ
S82)、本実施の形態においては、割込み処理前に実
行していたタスクA、システムコールWake Upタ
スクBにより実行可能状態とされたタスクB、及びシス
テムコールWake UpタスクCにより実行可能状態
とされたタスクCの優先度が比較されることとなり、最
も優先度の高いタスクが実行されることとなる(ステッ
プS84)。なお、タスクBに切り替わる際には、タス
クBのレジスタの復帰、すなわち、レジスタ情報をタス
クBのタスク制御ブロックのスタックエリアからレジス
タへ戻す作業が行われる点については、第二の実施の形
態と同様である(ステップS84)。
As described above, the point that the task is returned from the interrupt processing and the scheduler operates is the same as in the second embodiment (step S82), but in this embodiment, The priorities of the task A that was executed before the interrupt processing, the task B that was made executable by the system call Wake Up task B, and the task C that was made executable by the system call Wake Up task C are compared. This means that the task with the highest priority will be executed (step S84). It should be noted that, when switching to the task B, the task of restoring the register of the task B, that is, the task of returning the register information from the stack area of the task control block of the task B to the register is performed, as compared with the second embodiment. The same is true (step S84).

【0097】次に、先入れ先出し方式によるメモリへの
書きこみ及びメモリからの読み込みについて図面に基づ
いて説明する。図8は、先入れ先出し方式によるメモリ
への書きこみ及びメモリからの読み込みについての概念
図である。
Next, writing in and reading from the memory by the first-in first-out method will be described with reference to the drawings. FIG. 8 is a conceptual diagram of writing to and reading from a memory by the first-in first-out method.

【0098】84、86、88、90及び92という番
号で示された四角枠は各々メモリを表したものである。
メモリ84→メモリ86→メモリ88という順にメモリ
に情報が書き込まれ、メモリ88→メモリ90→メモリ
92という順にメモリから情報が読み込まれていく。
The square boxes designated by the numbers 84, 86, 88, 90 and 92 respectively represent memories.
Information is written in the memory in the order of memory 84 → memory 86 → memory 88, and information is read from the memory in the order of memory 88 → memory 90 → memory 92.

【0099】先ず、メモリ84には何も情報が書きこま
れていない。次に、ステップS72において「割込み処
理中のWake UpタスクB」いう情報が書き込まれ
るとメモリ86に示す状態となる。さらに、ステップS
74において「割込み処理中のWake Upタスク
C」いう情報が書き込まれるとメモリ88に示す状態と
なる。
First, no information is written in the memory 84. Next, when the information "Wake Up task B under interrupt processing" is written in step S72, the state shown in the memory 86 is obtained. Furthermore, step S
When information "Wake Up task C under interrupt processing" is written in 74, the state shown in the memory 88 is obtained.

【0100】次に、読み込みの手順となるが、先入れ先
出し方式を採用するので、「割込み処理中のWake
UpタスクB」いう情報の方が先に読み出され、メモリ
90に示す状態となる。さらに、「割込み処理中のWa
ke UpタスクB」いう情報が読み出され、情報が書
き込まれていないメモリ92に示す状態となる。
Next, regarding the reading procedure, since the first-in first-out method is adopted, "Wake during interrupt processing is performed.
The information "Up task B" is read out first, and the state shown in the memory 90 is obtained. In addition, "Wa during interrupt processing
The information "ke Up task B" is read, and the state shown in the memory 92 in which the information is not written is obtained.

【0101】本実施の形態によれば、実行されるタスク
の変更を生じさせるための手順が第一割込み処理中に複
数備えられている場合でも、第二の実施の形態及び第三
の実施の形態による上記効果を奏することが可能とな
る。
According to the present embodiment, even when a plurality of procedures for causing the change of the task to be executed are provided in the first interrupt processing, the second embodiment and the third embodiment are executed. It is possible to achieve the above effects depending on the form.

【0102】なお、上記実施の形態においては、第二割
込み処理内において実施されるシステムコールを特定す
る情報は2種類であったが、3種類以上であっても同様
に上記効果を奏することが可能である。
In the above embodiment, there are two types of information for specifying the system call executed in the second interrupt processing, but the same effect can be obtained even if there are three or more types. It is possible.

【0103】また、既述と同様、システムコールを特定
する情報をメモリに書き込む手順(ステップS72、ス
テップS74)と第二割込み処理を実行可能とする手順
(ステップS46、ステップS75)との位置関係は自
由である。また、これらは、割込み原因に応じた処理
(ステップS44)に含まれなくてもよい。
Also, as described above, the positional relationship between the procedure for writing the information for specifying the system call to the memory (steps S72, S74) and the procedure for enabling the second interrupt processing (steps S46, S75). Is free. Further, these may not be included in the process (step S44) according to the cause of the interrupt.

【0104】また、ステップS80において、メモリか
ら複数の情報を一時に読み込み、この情報をどこかに保
存しておいて、順次、システムコールを実行してもよ
い。
In step S80, a plurality of pieces of information may be temporarily read from the memory, the pieces of information may be stored somewhere, and system calls may be sequentially executed.

【0105】また、第一割込み処理を開始する際にかか
る割込み処理のために使用されるレジスタを退避し、第
二割込み処理を開始する際に変更前に実行されるタスク
のために使用されるレジスタを退避し、第一割込み処理
を終了する際にかかる割込み処理のために使用されるレ
ジスタを復帰し、かつ、第二割込み処理を終了する際に
変更後に実行されるタスクのために使用されるレジスタ
を復帰してもよい。
Further, the registers used for the interrupt processing at the time of starting the first interrupt processing are saved and used for the task executed before the change at the time of starting the second interrupt processing. Saves registers, restores registers used for interrupt processing when terminating first interrupt processing, and is used for tasks executed after modification when terminating second interrupt processing. Register may be restored.

【0106】なお、上記実施の形態においては、実行さ
れるタスクの変更を生じさせるためのシステムコールと
して、主にWake Up命令を例に説明したが、これ
に限られるものではない。該当するシステムコールとし
ては、メッセージによるタスク間通信を実現するSen
d Message命令やReceive Messa
ge命令、タスク間同期を実現するためのSet Ev
ent命令、タスクの優先度を変更するChange
Priority命令等がある。
In the above embodiment, the Wake Up instruction is mainly described as an example of the system call for changing the task to be executed, but the system call is not limited to this. As the corresponding system call, Sen that realizes inter-task communication by message
d Message instruction or Receive Message
ge command, Set Ev for realizing synchronization between tasks
ent command, Change to change task priority
There are Priority commands and the like.

【0107】また、これまでに説明してきたマルチタス
ク管理方法を装置において実現するためのコンピュータ
プログラム及び該コンピュータプログラムを記録したコ
ンピュータ読み取り可能な記録媒体も実現可能である。
Also, a computer program for realizing the multitask management method described so far in an apparatus and a computer-readable recording medium recording the computer program can be realized.

【0108】さらに、これまでに説明してきた実施の形
態による効果と同様の効果を奏し、CPUやプログラム
等の共同動作により上記マルチタスク管理方法を実行す
るマルチタスク管理システムを実現することも可能であ
る。
Furthermore, it is also possible to realize a multitask management system which achieves the same effects as those of the above-described embodiments and executes the above-mentioned multitask management method by the joint operation of the CPU, the program and the like. is there.

【0109】===プリンタに係る実施の形態=== 次に、プリンタに係る実施の形態について、図面に基づ
いて説明する。先ず、プリンタの例としてインクジェッ
トプリンタの概略を説明した後、主に紙送りモータのD
Cモータ制御を例にプリンタに係る実施の形態を説明す
る。
=== Embodiment of Printer === Next, an embodiment of the printer will be described with reference to the drawings. First, an outline of an inkjet printer will be described as an example of a printer, and then D of a paper feed motor will be mainly used.
An embodiment relating to a printer will be described by taking C motor control as an example.

【0110】<<<インクジェットプリンタの概略>>
>インクジェットプリンタの概略について説明する。図
9は、インクジェットプリンタの概略構成を示したブロ
ック図である。
<<<< Outline of Inkjet Printer >>
> An outline of the inkjet printer will be described. FIG. 9 is a block diagram showing a schematic configuration of an inkjet printer.

【0111】図9に示したインクジェットプリンタは、
紙送りを行う紙送りモータ(以下、PFモータともい
う。)101と、紙送りモータ101を駆動する紙送り
モータドライバ102と、印刷紙150にインクを吐出
するヘッド109が固定され、印刷紙150に対し平行
方向かつ紙送り方向に対し垂直方向に駆動されるキャリ
ッジ103と、キャリッジ103を駆動するキャリッジ
モータ(以下、CRモータともいう。)104と、キャ
リッジモータ104を駆動するCRモータドライバ10
5と、CRモータドライバ105を制御するDCユニッ
ト106と、ヘッド109の目詰まり防止のためのイン
クの吸い出しを制御するポンプモータ107と、ポンプ
モータ107を駆動するポンプモータドライバ108
と、ヘッド109を駆動制御するヘッドドライバ110
と、キャリッジ103に固定されたリニア式エンコーダ
111と、所定の間隔にスリットが形成されたリニア式
エンコーダ111用符号板112と、PFモータ101
用のロータリ式エンコーダ113と、印刷処理されてい
る紙の終端位置を検出する紙検出センサ115と、プリ
ンタ全体の制御を行うCPU116と、CPU116に
対して周期的に割込み信号を発生するタイマIC117
と、ホストコンピュータ118との間でデータの送受信
を行うインタフェース部(以下、IFともいう。)11
9と、ホストコンピュータ118からIF119を介し
て送られてくる印字情報に基づいて印字解像度やヘッド
109の駆動波形等を制御するASIC120と、AS
IC120及びCPU116の作業領域やプログラム格
納領域として用いられるPROM121、RAM122
及びEEPROM123と、印刷紙150を支持するプ
ラテン125と、PFモータ101によって駆動されて
印刷紙150を搬送する搬送ローラ127と、CRモー
タ104の回転軸に取付けられたプーリ130と、プー
リ130によって駆動されるタイミングベルト131と
を備えている。
The ink jet printer shown in FIG.
A paper feed motor (hereinafter, also referred to as a PF motor) 101 that feeds paper, a paper feed motor driver 102 that drives the paper feed motor 101, and a head 109 that ejects ink to the printing paper 150 are fixed, and the printing paper 150. A carriage 103 that is driven in a direction parallel to and a direction that is perpendicular to the paper feed direction, a carriage motor (hereinafter, also referred to as a CR motor) 104 that drives the carriage 103, and a CR motor driver 10 that drives the carriage motor 104.
5, a DC unit 106 that controls the CR motor driver 105, a pump motor 107 that controls the suction of ink to prevent clogging of the head 109, and a pump motor driver 108 that drives the pump motor 107.
And a head driver 110 that drives and controls the head 109.
A linear encoder 111 fixed to the carriage 103, a code plate 112 for the linear encoder 111 having slits formed at predetermined intervals, and a PF motor 101.
Rotary encoder 113, a paper detection sensor 115 for detecting the end position of the paper being printed, a CPU 116 for controlling the entire printer, and a timer IC 117 for periodically generating an interrupt signal to the CPU 116.
And an interface unit (hereinafter, also referred to as an IF) 11 that transmits and receives data to and from the host computer 118.
9, an ASIC 120 that controls the print resolution, the drive waveform of the head 109, and the like based on the print information sent from the host computer 118 via the IF 119;
PROM 121, RAM 122 used as a work area or program storage area for the IC 120 and CPU 116
And an EEPROM 123, a platen 125 that supports the printing paper 150, a conveyance roller 127 that is driven by the PF motor 101 to convey the printing paper 150, a pulley 130 attached to the rotation shaft of the CR motor 104, and a pulley 130. And a timing belt 131 to be operated.

【0112】DCユニット106は、CPU116から
送られてくる制御指令、エンコーダ111、113の出
力に基づいて紙送りモータドライバ102及びCRモー
タドライバ105を駆動制御する。また、紙送りモータ
101及びCRモータ104はいずれもDCモータであ
る。
The DC unit 106 drives and controls the paper feed motor driver 102 and the CR motor driver 105 based on the control command sent from the CPU 116 and the outputs of the encoders 111 and 113. Further, both the paper feed motor 101 and the CR motor 104 are DC motors.

【0113】次に、キャリッジ103に取付けられたリ
ニア式エンコーダ111、及び、PFモータ101用の
ロータリ式エンコーダ113についてさらに詳細な説明
を加える。図10は、キャリッジ103に取付けられた
リニア式エンコーダ111の構成を模式的に示した説明
図である。
Next, the linear encoder 111 attached to the carriage 103 and the rotary encoder 113 for the PF motor 101 will be described in more detail. FIG. 10 is an explanatory view schematically showing the configuration of the linear encoder 111 attached to the carriage 103.

【0114】図10に示したエンコーダ111は、発光
ダイオード111aと、コリメータレンズ111bと、
検出処理部111cとを備えている。検出処理部111
cは、複数(例えば4個)のフォトダイオード111d
と、信号処理回路111eと、例えば2個のコンパレー
タ111fA、111fBとを有している。
The encoder 111 shown in FIG. 10 includes a light emitting diode 111a, a collimator lens 111b, and
The detection processing unit 111c is included. Detection processing unit 111
c is a plurality (for example, four) of photodiodes 111d
And a signal processing circuit 111e and, for example, two comparators 111fA and 111fB.

【0115】発光ダイオード111aの両端に抵抗を介
して電圧VCCが印加されると、発光ダイオード111
aから光が発せられる。この光はコリメータレンズ11
1bにより平行光に集光されて符号板112を通過す
る。符号板112には、所定の間隔(例えば1/180
インチ(1インチ=2.54cm))毎にスリットが設
けられている。
When the voltage VCC is applied to both ends of the light emitting diode 111a through a resistor, the light emitting diode 111a is
Light is emitted from a. This light is collimator lens 11
The parallel light is focused by 1b and passes through the code plate 112. The code plate 112 has a predetermined interval (for example, 1/180).
Slits are provided for each inch (1 inch = 2.54 cm).

【0116】符号板112を通過した平行光は、図示し
ない固定スリットを通って各フォトダイオード111d
に入射し、電気信号に変換される。4個のフォトダイオ
ード111dから出力される電気信号は信号処理回路1
11eにおいて信号処理され、信号処理回路111eか
ら出力される信号はコンパレータ111fA、111f
Bにおいて比較され、比較結果がパルスとして出力され
る。コンパレータ111fA、111fBから出力され
るパルスENC−A、ENC−Bがエンコーダ111の
出力となる。
The parallel light passing through the code plate 112 passes through a fixed slit (not shown) and each photodiode 111d.
And is converted into an electric signal. The electric signals output from the four photodiodes 111d are signal processing circuits 1
The signals processed in 11e and output from the signal processing circuit 111e are comparators 111fA and 111f.
B is compared, and the comparison result is output as a pulse. The pulses ENC-A and ENC-B output from the comparators 111fA and 111fB are output from the encoder 111.

【0117】図11は、CRモータ正転時及び逆転時に
おけるエンコーダ111の2つの出力信号の波形を示し
たタイミングチャートである。
FIG. 11 is a timing chart showing the waveforms of the two output signals of the encoder 111 when the CR motor rotates in the normal direction and in the reverse direction.

【0118】図11(a)、(b)に示すように、CR
モータ正転時及び逆転時のいずれの場合も、パルスEN
C−AとパルスENC−Bとは位相が90度だけ異なっ
ている。CRモータ104が正転しているとき、即ち、
キャリッジ103が主走査方向に移動しているときは、
図11(a)に示すように、パルスENC−Aはパルス
ENC−Bよりも90度だけ位相が進み、CRモータ1
04が逆転しているときは、図11(b)に示すよう
に、パルスENC−AはパルスENC−Bよりも90度
だけ位相が遅れる。そして、パルスENC−A及びパル
スENC−Bの1周期Tは、キャリッジ103が符号板
112のスリット間隔を移動する時間に等しい。
As shown in FIGS. 11A and 11B, CR
Pulse EN in both forward and reverse rotation of the motor
The phases of CA and pulse ENC-B differ by 90 degrees. When the CR motor 104 is rotating normally, that is,
When the carriage 103 is moving in the main scanning direction,
As shown in FIG. 11A, the phase of the pulse ENC-A leads the phase of the pulse ENC-B by 90 degrees, and the CR motor 1
When 04 is reversed, as shown in FIG. 11B, the phase of the pulse ENC-A lags the phase of the pulse ENC-B by 90 degrees. Then, one cycle T of the pulse ENC-A and the pulse ENC-B is equal to the time during which the carriage 103 moves in the slit interval of the code plate 112.

【0119】一方、PFモータ101用のロータリ式エ
ンコーダ113は図示しないロータリ式エンコーダ用符
号板がPFモータ101の回転に応じて回転する回転円
板である以外は、リニア式エンコーダ111と同様の構
成となっており、2つの出力パルスENC−A、ENC
−Bを出力する。インクジェットプリンタにおいては、
図示しないロータリ式エンコーダ用符号板に設けられて
いる複数のスリットのスリット間隔は1/180インチ
であり、PFモータ101が上記1スリット間隔だけ回
転すると、1/1440インチだけ紙送りされる。
On the other hand, the rotary encoder 113 for the PF motor 101 has the same configuration as the linear encoder 111 except that the rotary encoder code plate (not shown) is a rotary disk that rotates in accordance with the rotation of the PF motor 101. And two output pulses ENC-A, ENC
-B is output. In inkjet printers,
The slit interval of the plurality of slits provided on the rotary encoder code plate (not shown) is 1/180 inch, and when the PF motor 101 rotates by the one slit interval, the paper is fed by 1/1440 inch.

【0120】<<<プリンタに係る実施の形態(紙送り
モータのDCモータ制御)>>>次に、インクジェット
プリンタのPFモータ101を制御するDCモータ制御
装置であるDCユニット106について説明する。図1
2は、DCモータ制御装置であるDCユニット106の
制御ブロック図である。
<<< Embodiment of Printer (DC Motor Control of Paper Feed Motor) >>> Next, the DC unit 106 which is a DC motor control device for controlling the PF motor 101 of the ink jet printer will be described. Figure 1
2 is a control block diagram of the DC unit 106 which is a DC motor control device.

【0121】図12の制御ブロック図には、ドライバ1
02に対する指令信号を生成するための主要素として、
回転位置演算部106aと、減算器106bと、目標回
転速度演算部106cと、回転速度演算部106dと、
減算器106eと、比例手段としての比例要素106f
と、積分手段としての積分要素106gと、微分手段と
しての微分要素106hと、加算器106iと、PWM
回路106jが示されている。
Driver 1 is shown in the control block diagram of FIG.
As a main element for generating a command signal for 02,
A rotation position calculation unit 106a, a subtractor 106b, a target rotation speed calculation unit 106c, a rotation speed calculation unit 106d,
Subtractor 106e and proportional element 106f as proportional means
An integrating element 106g as an integrating means, a differentiating element 106h as a differentiating means, an adder 106i, a PWM
Circuit 106j is shown.

【0122】回転位置演算部106aは、ロータリ式エ
ンコーダ113の出力パルスENC−A、ENC−Bの
各々の立ち上がりエッジ、立ち上がりエッジを検出し、
検出されたエッジの個数を計数し、この計数値に基づい
て、PFモータ101の回転位置を演算する。この計数
はPFモータ101が正転しているときは1個のエッジ
が検出されると「+1」を加算し、逆転しているとき
は、1個のエッジか検出されると、「−1」を加算す
る。パルスENC−A及びENC−Bの各々の周期は、
図示しないロータリ式エンコーダ用符号板の、あるスリ
ットがロータリ式エンコーダ113を通過してから次の
スリットがロータリ式エンコーダ113を通過するまで
の時間に等しく、かつ、パルスENC−AとパルスEN
C−Bとは位相が90度だけ異なっている。このため、
上記計数のカウント値「1」は図示しないロータリ式エ
ンコーダ用符号板のスリット間隔の1/4に対応する。
これにより上記計数値にスリット間隔の1/4を乗算す
れば、その乗算値に基づいて、計数値が「0」に対応す
る回転位置からのPFモータ101の移動量を求めるこ
とができる。このときロータリ式エンコーダ113の解
像度は図示しないロータリ式エンコーダ用符号板のスリ
ットの間隔の1/4となる。
The rotational position calculation unit 106a detects the rising edges and rising edges of the output pulses ENC-A and ENC-B of the rotary encoder 113,
The number of detected edges is counted, and the rotational position of the PF motor 101 is calculated based on this counted value. This count adds "+1" when one edge is detected when the PF motor 101 is normally rotating, and "-1" when one edge is detected when the PF motor 101 is rotating normally. Is added. The period of each of the pulses ENC-A and ENC-B is
The rotary encoder code plate (not shown) is equal to the time from when one slit passes the rotary encoder 113 to when the next slit passes the rotary encoder 113, and the pulse ENC-A and the pulse EN
The phase differs from CB by 90 degrees. For this reason,
The count value "1" of the above count corresponds to 1/4 of the slit interval of the rotary type encoder code plate (not shown).
Thus, by multiplying the count value by 1/4 of the slit interval, the amount of movement of the PF motor 101 from the rotational position corresponding to the count value "0" can be obtained based on the multiplied value. At this time, the resolution of the rotary encoder 113 is ¼ of the slit interval of the rotary encoder code plate (not shown).

【0123】減算器106bは、CPU116から送ら
れてくる目標回転位置と、回転位置演算部106aによ
って求められたPFモータ101の実際の回転位置との
回転位置偏差を演算する。
The subtractor 106b calculates a rotational position deviation between the target rotational position sent from the CPU 116 and the actual rotational position of the PF motor 101 obtained by the rotational position calculation unit 106a.

【0124】目標回転速度演算部106cは、減算器1
06bの出力である回転位置偏差に基づいてPFモータ
101の目標回転速度を演算する。この演算は回転位置
偏差にゲインKPを乗算することにより行われる。この
ゲインKPは回転位置偏差に応じて決定される。尚、こ
のゲインKPの値は図示しないテーブルに格納されてい
てもよい。
The target rotation speed calculation unit 106c is provided with the subtractor 1
The target rotational speed of the PF motor 101 is calculated based on the rotational position deviation that is the output of 06b. This calculation is performed by multiplying the rotational position deviation by the gain KP. This gain KP is determined according to the rotational position deviation. The value of this gain KP may be stored in a table (not shown).

【0125】回転速度演算部106dは、ロータリ式エ
ンコーダ113の出力パルスENC−A、ENC−Bに
基づいてPFモータ101の回転速度を演算する。ま
ず、ロータリ式エンコーダ113の出力パルスENC−
A、ENC−Bの各々の立ち上がりエッジ、立ち下がり
エッジを検出し、図示しないロータリ式エンコーダ用符
号板のスリット間隔の1/4に対応するエッジ間の時間
間隔を、タイマカウンタによってカウントする。このカ
ウント値、図示しないロータリ式エンコーダ用符号板の
スリット間隔、及び、PFモータ101と図示しない紙
送りローラとの減速比に基づいて、PFモータ101の
回転速度が求められる。
The rotation speed calculation unit 106d calculates the rotation speed of the PF motor 101 based on the output pulses ENC-A and ENC-B of the rotary encoder 113. First, the output pulse ENC- of the rotary encoder 113
A rising edge and a falling edge of each of A and ENC-B are detected, and a time interval between edges corresponding to 1/4 of a slit interval of a rotary encoder code plate (not shown) is counted by a timer counter. The rotation speed of the PF motor 101 is obtained based on this count value, the slit spacing of the rotary encoder code plate (not shown), and the reduction ratio between the PF motor 101 and the paper feed roller (not shown).

【0126】減算器106eは、目標回転速度と、回転
速度演算部106dによって演算されたPFモータ10
1の実際の回転速度との偏差を演算する。比例要素10
6fは、上記偏差に定数Gpを乗算し、乗算結果を出力
する。積分要素106gは、偏差に定数Giを乗じたも
のを積算し、積算結果を出力する。微分要素106h
は、現在の偏差と、1つ前の偏差との差に定数Gdを乗
算し、乗算結果を出力する。比例要素106f、積分要
素106g及び微分要素106hの演算は、ロータリ式
エンコーダ113の出力パルスENC−Aの1周期毎
に、例えば出力パルスENC−Aの立ち上がりエッジ又
は立ち下がりエッジに基づいて行う。
The subtractor 106e includes a target rotation speed and the PF motor 10 calculated by the rotation speed calculation unit 106d.
The deviation from the actual rotation speed of 1 is calculated. Proportional element 10
6f multiplies the deviation by a constant Gp and outputs the multiplication result. The integration element 106g integrates the deviation multiplied by the constant Gi and outputs the integration result. Differentiation element 106h
Outputs the difference between the current deviation and the previous deviation by a constant Gd and outputs the multiplication result. The proportional element 106f, the integral element 106g, and the derivative element 106h are calculated for each cycle of the output pulse ENC-A of the rotary encoder 113, for example, based on the rising edge or falling edge of the output pulse ENC-A.

【0127】比例要素106f、積分要素106g及び
微分要素106hから出力される信号値は、それぞれの
演算結果に応じたデューティDXを示す。ここで、デュ
ーティDXは、例えば、デューティパーセントが(10
0×DX/2000)%であることを示す。この場合、
DX=2000であれば、デューティ100%を示し、
DX=1000であれば、デューティ50%を示すこと
になる。
The signal values output from the proportional element 106f, the integral element 106g and the derivative element 106h indicate the duty DX according to the respective calculation results. Here, the duty DX has a duty percentage of (10
0xDX / 2000)%. in this case,
If DX = 2000, the duty is 100%,
If DX = 1000, it means that the duty is 50%.

【0128】比例要素106f、積分要素106g及び
微分要素106hの出力は、加算器106iにおいて加
算される。この加算結果がデューティ信号としてPWM
回路106jに送られて、PWM回路106jにて加算
結果に応じた指令信号が生成される。この生成された指
令信号に基づいて、ドライバ102によりPFモータ1
01が駆動される。
The outputs of the proportional element 106f, the integral element 106g and the derivative element 106h are added in the adder 106i. This addition result is PWM as a duty signal
The signal is sent to the circuit 106j and the PWM circuit 106j generates a command signal according to the addition result. The PF motor 1 is driven by the driver 102 based on the generated command signal.
01 is driven.

【0129】なお、比例要素106f、積分要素106
g及び微分要素106hを使用するPID制御は、加速
制御後の定速制御及び減速制御に用いられる。
The proportional element 106f and the integral element 106
PID control using g and the differential element 106h is used for constant speed control and deceleration control after acceleration control.

【0130】ところで、比例要素106f、積分要素1
06g及び微分要素106hの演算が、ロータリ式エン
コーダ113の出力パルスENC−Aの1周期毎に成さ
れるのは記述の通りだが、これは、前述した割込みを用
いて行われる。すなわち、例えば、ロータリ式エンコー
ダ113の出力パルスENC−Aの立ち上がりエッジ又
は立ち下がりエッジに基づいて、1周期毎に定期的に割
込みを発生させ、かかる割込みの処理中に上記演算等が
行われ、望みのPID制御が達成される。なお、上記演
算等は、図9におけるCPU116により行われる。ま
た、上記においては、1周期毎に割込みを発生させるこ
ととしたが、これに限定されるものではなく、例えば、
複数周期毎に割込を発生させてもよい。
By the way, the proportional element 106f and the integral element 1
As described above, the calculation of 06g and the differential element 106h is performed for each cycle of the output pulse ENC-A of the rotary encoder 113, but this is performed using the interrupt described above. That is, for example, on the basis of the rising edge or the falling edge of the output pulse ENC-A of the rotary encoder 113, an interrupt is periodically generated for each cycle, and the above-mentioned calculation is performed during the processing of the interrupt. The desired PID control is achieved. The above calculation and the like are performed by the CPU 116 in FIG. Further, in the above, the interrupt is generated every cycle, but the invention is not limited to this, and for example,
The interrupt may be generated every plural cycles.

【0131】当然のことながら、上記演算等に要する時
間、すなわち、割込み処理に要する時間は、上記1周期
に相応する時間より短くなければならない。一方、プリ
ンタの効率的な制御を行うためには、上記1周期に相応
する時間を短くする必要がある。したがって、割込み処
理に要する時間に対する要求は厳しいものとなる。
As a matter of course, the time required for the above calculation, that is, the time required for interrupt processing must be shorter than the time corresponding to one cycle. On the other hand, in order to efficiently control the printer, it is necessary to shorten the time period corresponding to the one cycle. Therefore, the demand for the time required for interrupt processing becomes severe.

【0132】仮に、割込み処理に要する時間が、上記1
周期に相応する時間を超えてしまう場合には、周期オー
バーによりPID制御が乱れ、最悪プリンタがエラーメ
ッセージを発して停止してしまう。既述の実施の形態で
説明したマルチタスク管理方法によると、割込み処理に
要する時間を短縮化することにより、かかる不備を解消
することができる。
If the time required for interrupt processing is 1
If the time corresponding to the cycle is exceeded, the PID control is disturbed due to the cycle over, and the worst printer issues an error message and stops. According to the multi-task management method described in the above-mentioned embodiment, the deficiency can be eliminated by shortening the time required for interrupt processing.

【0133】なお、プリンタに係る実施の形態として、
上記においては、紙送りモータのDCモータ制御を例に
説明したが、当然のことながら、キャリッジモータのD
Cモータ制御についても同様のことが言える。また、モ
ータ制御以外の処理についても、割込みを用いた処理に
ついて同様のことが言える。例えば、ヘッドへのデータ
転送に係る処理等である。さらに、プリンタ以外の装置
についても、割込みを用いた処理について同様のことが
言える。なお、割込みを発生させる方式については、あ
る一定の条件が揃った場合に、割込みが発生するような
場合もあり得るし、タイマによるような場合もあり得
る。
As an embodiment of the printer,
In the above description, the DC motor control of the paper feed motor is taken as an example, but it goes without saying that the D of the carriage motor is controlled.
The same applies to C motor control. The same applies to processes other than motor control as to processes using interrupts. For example, it is processing related to data transfer to the head. Furthermore, the same can be said for the processing using the interrupt for devices other than the printer. As for the method of generating an interrupt, an interrupt may be generated when a certain condition is met, or a timer may be used.

【0134】[0134]

【発明の効果】本発明によれば、高速な処理を行うこと
が可能なマルチタスク管理方法、かかるマルチタスク管
理方法を装置において実行するためのコンピュータプロ
グラム、かかるプログラムを記録した記憶媒体、高速な
処理を行うことが可能なマルチタスク管理システム、か
かるマルチタスク管理システムを有する装置、かかるマ
ルチタスク管理システムを有するプリンタを実現するこ
とが可能となる。
According to the present invention, a multitask management method capable of performing high-speed processing, a computer program for executing the multitask management method in an apparatus, a storage medium recording the program, and a high-speed It is possible to realize a multi-task management system capable of performing processing, an apparatus having the multi-task management system, and a printer having the multi-task management system.

【0135】[0135]

【図面の簡単な説明】[Brief description of drawings]

【図1】システムコール実行時の実行されるタスクを切
り替える手順について説明した図である。
FIG. 1 is a diagram illustrating a procedure of switching a task to be executed when a system call is executed.

【図2】割込み発生時の実行されるタスクを切り替える
手順について説明した図である。
FIG. 2 is a diagram illustrating a procedure of switching a task to be executed when an interrupt occurs.

【図3】図2の変形例であり、割込み処理部を示したも
のである。
FIG. 3 is a modification of FIG. 2, showing an interrupt processing unit.

【図4】第一の実施の形態を示す流れ図である。FIG. 4 is a flow chart showing a first embodiment.

【図5】第二の実施の形態を示す流れ図である。FIG. 5 is a flowchart showing a second embodiment.

【図6】第三の実施の形態を示す流れ図である。FIG. 6 is a flowchart showing a third embodiment.

【図7】第四の実施の形態を示す流れ図である。FIG. 7 is a flowchart showing a fourth embodiment.

【図8】先入れ先出し方式によるメモリへの書きこみ及
びメモリからの読み込みについての概念図である。
FIG. 8 is a conceptual diagram of writing to and reading from a memory by a first-in first-out method.

【図9】インクジェットプリンタの概略構成を示したブ
ロック図である。
FIG. 9 is a block diagram showing a schematic configuration of an inkjet printer.

【図10】キャリッジ103に取付けられたリニア式エ
ンコーダ111の構成を模式的に示した説明図である。
FIG. 10 is an explanatory view schematically showing a configuration of a linear encoder 111 attached to a carriage 103.

【図11】CRモータ正転時及び逆転時におけるエンコ
ーダ111の2つの出力信号の波形を示したタイミング
チャートである。
FIG. 11 is a timing chart showing waveforms of two output signals of the encoder 111 at the time of forward rotation and reverse rotation of the CR motor.

【図12】DCモータ制御装置であるDCユニット10
6の制御ブロック図である。
FIG. 12 is a DC unit 10 which is a DC motor control device.
It is a control block diagram of No. 6.

【符号の説明】[Explanation of symbols]

16 割込み処理 28 別の割込み処理 36 第一割込み処理 38 第二割込み処理 40 第三割込み処理 84 メモリ 86 メモリ 88 メモリ 90 メモリ 92 メモリ 101 紙送りモータ(PFモータ) 102 紙送りドライバ 103 キャリッジ 104 キャリッジモータ(CRモータ) 105 キャリッジモータドライバ(CRモータドラ
イバ) 106 DCユニット 106a 位置演算部 106b 減算器 106c 目標速度演算手段 106d 速度演算部 106e 減算器 106f 比例要素 106g 積分要素 106h 微分要素 106j PWM回路 107 ポンプモータ 108 ポンプモータドライバ 109 ヘッド 110 ヘッドドライバ 111 リニア式エンコーダ 112 符号板 113 エンコーダ(ロータリ式エンコーダ) 115 紙検出センサ 116 CPU 117 タイマIC 118 ホストコンピュータ 119 インタフェース部 120 ASIC 121 PROM 122 RAM 123 EEPROM 125 プラテン 130 プーリ 131 タイミングベルト 150 記録紙
16 interrupt processing 28 another interrupt processing 36 first interrupt processing 38 second interrupt processing 40 third interrupt processing 84 memory 86 memory 88 memory 90 memory 92 memory 101 paper feed motor (PF motor) 102 paper feed driver 103 carriage 104 carriage motor (CR motor) 105 Carriage motor driver (CR motor driver) 106 DC unit 106a Position calculation unit 106b Subtractor 106c Target speed calculation unit 106d Speed calculation unit 106e Subtractor 106f Proportional element 106g Integral element 106h Differential element 106j PWM circuit 107 Pump motor 108 pump motor driver 109 head 110 head driver 111 linear encoder 112 code plate 113 encoder (rotary encoder) 115 paper detection sensor 116 PU 117 timer IC 118 host computer 119 interface unit 120 ASIC 121 PROM 122 RAM 123 EEPROM 125 platen 130 pulley 131 timing belt 150 paper

Claims (17)

【特許請求の範囲】[Claims] 【請求項1】 実行されるタスクの変更を生じさせるた
めの手順を有する割込み処理を用いて複数のタスクを管
理するマルチタスク管理方法において、 前記割込み処理が有する前記手順は、実行されるタスク
の変更を生じさせるためのシステムコールを実行する、
該割込み処理とは異なる他の割込み処理を実行可能状態
とすることを特徴とするマルチタスク管理方法。
1. A multi-task management method for managing a plurality of tasks using interrupt processing having a procedure for causing a change of a task to be executed, wherein the procedure included in the interrupt processing is Make a system call to make the change,
A multitask management method, characterized in that another interrupt process different from the interrupt process is set to an executable state.
【請求項2】 請求項1に記載のマルチタスク管理方法
において、 前記割込み処理の実行中に前記他の割込み処理が実行可
能とされ、該割込み処理が終了した後、該他の割込処理
が、前記システムコールを実行することを特徴とするマ
ルチタスク管理方法。
2. The multitask management method according to claim 1, wherein the other interrupt processing is enabled during execution of the interrupt processing, and after the interrupt processing is completed, the other interrupt processing is performed. A multitask management method, characterized in that the system call is executed.
【請求項3】 実行されるタスクの変更を生じさせるた
めの手順を有する割込み処理を用いて複数のタスクを管
理するマルチタスク管理方法において、 前記割込み処理が有する前記手順は、実行されるタスク
の変更を生じさせるためのシステムコールを特定する情
報を記憶させ、前記記憶させられた情報に基づいて前記
システムコールを実行する、該割込み処理とは異なる他
の割込み処理を実行可能状態とすることを特徴とするマ
ルチタスク管理方法。
3. A multitask management method for managing a plurality of tasks using interrupt processing having a procedure for causing a change of a task to be executed, wherein the procedure included in the interrupt processing is Information that specifies a system call for causing a change is stored, and another interrupt process that is different from the interrupt process that executes the system call based on the stored information is enabled. A characteristic multitask management method.
【請求項4】 請求項3に記載のマルチタスク管理方法
において、 前記割込み処理の実行中に、実行されるタスクの変更を
生じさせるためのシステムコールを特定する情報が記憶
され、かつ、前記他の割込み処理が実行可能とされ、該
割込み処理が終了した後、該他の割込処理が、前記記憶
させられた情報に基づいて前記システムコールを実行す
ることを特徴とするマルチタスク管理方法。
4. The multitask management method according to claim 3, wherein information specifying a system call for causing a change of a task to be executed is stored during execution of the interrupt processing, and the other information is stored. Interrupt processing is enabled, and after the interrupt processing is completed, the other interrupt processing executes the system call based on the stored information.
【請求項5】 請求項1乃至請求項4に記載のいずれか
のマルチタスク管理方法において、 複数回実行される前記割込み処理のうち一部の回数の前
記割込み処理において前記手順が実行されるときには、 前記手順が実行される割込み処理を開始する際に該割込
み処理のために使用されるレジスタを退避し、前記他の
割込み処理を開始する際に前記変更前に実行されるタス
クのために使用されるレジスタを退避し、前記手順が実
行される割込み処理を終了する際に該割込み処理のため
に使用されるレジスタを復帰し、かつ、前記他の割込み
処理を終了する際に前記変更後に実行されるタスクのた
めに使用されるレジスタを復帰することを特徴とするマ
ルチタスク管理方法。
5. The multitask management method according to claim 1, wherein when the procedure is executed in a part of the interrupt processes of the interrupt processes executed a plurality of times, , Save the register used for the interrupt processing when starting the interrupt processing in which the procedure is executed, and use it for the task executed before the change when starting the other interrupt processing The registers used for interrupt processing when the interrupt processing in which the procedure is executed is completed, and is executed after the modification when the other interrupt processing is completed. Multi-task management method characterized by restoring a register used for a specified task.
【請求項6】 請求項3乃至請求項5に記載のいずれか
のマルチタスク管理方法において、 前記システムコールを特定する前記情報は、先入れ先出
し方式で、メモリに書きこまれ、かつ、メモリから読み
込まれることを特徴とするマルチタスク管理方法。
6. The multitask management method according to claim 3, wherein the information identifying the system call is written in the memory and read from the memory in a first-in first-out system. A multi-task management method characterized by the above.
【請求項7】 請求項1乃至請求項6に記載のいずれか
のマルチタスク管理方法を装置において実行するための
コンピュータプログラム。
7. A computer program for executing the multitask management method according to claim 1 in an apparatus.
【請求項8】 請求項7に記載のコンピュータプログラ
ムを記録したコンピュータ読み取り可能な記録媒体。
8. A computer-readable recording medium in which the computer program according to claim 7 is recorded.
【請求項9】 実行されるタスクの変更を生じさせるた
めの手順を有する割込み処理を用いて複数のタスクを管
理するマルチタスク管理システムにおいて、 前記割込み処理が有する前記手順は、実行されるタスク
の変更を生じさせるためのシステムコールを実行する、
該割込み処理とは異なる他の割込み処理を実行可能状態
とすることを特徴とするマルチタスク管理システム。
9. In a multi-task management system for managing a plurality of tasks by using interrupt processing having a procedure for causing a change of a task to be executed, the procedure included in the interrupt processing is Make a system call to make the change,
A multitask management system characterized in that another interrupt process different from the interrupt process is set to an executable state.
【請求項10】 請求項9に記載のマルチタスク管理シ
ステムにおいて、 前記割込み処理の実行中に前記他の割込み処理が実行可
能とされ、該割込み処理が終了した後、該他の割込処理
が、前記システムコールを実行することを特徴とするマ
ルチタスク管理システム。
10. The multitask management system according to claim 9, wherein the other interrupt processing is enabled during execution of the interrupt processing, and after the interrupt processing is completed, the other interrupt processing is executed. And a multitask management system which executes the system call.
【請求項11】 実行されるタスクの変更を生じさせる
ための手順を有する割込み処理を用いて複数のタスクを
管理するマルチタスク管理システムにおいて、 前記割込み処理が有する前記手順は、実行されるタスク
の変更を生じさせるためのシステムコールを特定する情
報を記憶させ、前記記憶させられた情報に基づいて前記
システムコールを実行する、該割込み処理とは異なる他
の割込み処理を実行可能状態とすることを特徴とするマ
ルチタスク管理システム。
11. In a multi-task management system for managing a plurality of tasks using an interrupt process having a procedure for causing a change of a task to be executed, the procedure included in the interrupt process is Information that specifies a system call for causing a change is stored, and another interrupt process that is different from the interrupt process that executes the system call based on the stored information is enabled. A characteristic multi-task management system.
【請求項12】 請求項11に記載のマルチタスク管理
方法において、 前記割込み処理の実行中に、実行されるタスクの変更を
生じさせるためのシステムコールを特定する情報が記憶
され、かつ、前記他の割込み処理が実行可能とされ、該
割込み処理が終了した後、該他の割込処理が、前記記憶
させられた情報に基づいて前記システムコールを実行す
ることを特徴とするマルチタスク管理方法。
12. The multitask management method according to claim 11, wherein information specifying a system call for causing a change of a task to be executed is stored during execution of the interrupt processing, and the other information is stored. Interrupt processing is enabled, and after the interrupt processing is completed, the other interrupt processing executes the system call based on the stored information.
【請求項13】 請求項9乃至請求項12に記載のいず
れかのマルチタスク管理システムにおいて、 複数回実行される前記割込み処理のうち一部の回数の前
記割込み処理において前記手順が実行されるときには、 前記手順が実行される割込み処理を開始する際に該割込
み処理のために使用されるレジスタを退避し、前記他の
割込み処理を開始する際に前記変更前に実行されるタス
クのために使用されるレジスタを退避し、前記手順が実
行される割込み処理を終了する際に該割込み処理のため
に使用されるレジスタを復帰し、かつ、前記他の割込み
処理を終了する際に前記変更後に実行されるタスクのた
めに使用されるレジスタを復帰することを特徴とするマ
ルチタスク管理システム。
13. The multitask management system according to claim 9, wherein when the procedure is executed in a part of the interrupt processes of the interrupt processes executed a plurality of times, , Save the register used for the interrupt processing when starting the interrupt processing in which the procedure is executed, and use it for the task executed before the change when starting the other interrupt processing The registers used for interrupt processing when the interrupt processing in which the procedure is executed is completed, and is executed after the modification when the other interrupt processing is completed. A multitasking management system characterized by restoring a register used for a task to be performed.
【請求項14】 請求項11乃至請求項13に記載のい
ずれかのマルチタスク管理システムにおいて、 前記システムコールを特定する前記情報は、先入れ先出
し方式で、メモリに書き込まれ、かつ、メモリから読み
込まれることを特徴とするマルチタスク管理システム。
14. The multi-task management system according to claim 11, wherein the information identifying the system call is written in and read from the memory in a first-in first-out system. A multi-task management system featuring.
【請求項15】 請求項9乃至請求項14に記載のいず
れかのマルチタスク管理システムを有する装置。
15. An apparatus comprising the multitask management system according to claim 9. Description:
【請求項16】 実行されるタスクの変更を生じさせる
ための手順を有する割込み処理を用いて複数のタスクを
管理するマルチタスク管理システムを有するプリンタに
おいて、 前記割込み処理が有する前記手順は、実行されるタスク
の変更を生じさせるためのシステムコールを実行する、
該割込み処理とは異なる他の割込み処理を実行可能状態
とすることを特徴とするプリンタ。
16. In a printer having a multi-task management system that manages a plurality of tasks by using an interrupt process having a procedure for causing a change of a task to be executed, the procedure of the interrupt process is executed. A system call to cause a task change,
A printer, wherein another interrupt process different from the interrupt process is set to an executable state.
【請求項17】 請求項10乃至請求項14に記載のい
ずれかのマルチタスク管理システムを有するプリンタ。
17. A printer comprising the multitasking management system according to claim 10. Description:
JP2001322794A 2001-10-19 2001-10-19 Multiple task control method, computer program, recording medium, multiple task control system, device and printer Pending JP2003131891A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001322794A JP2003131891A (en) 2001-10-19 2001-10-19 Multiple task control method, computer program, recording medium, multiple task control system, device and printer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001322794A JP2003131891A (en) 2001-10-19 2001-10-19 Multiple task control method, computer program, recording medium, multiple task control system, device and printer

Publications (1)

Publication Number Publication Date
JP2003131891A true JP2003131891A (en) 2003-05-09

Family

ID=19139775

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001322794A Pending JP2003131891A (en) 2001-10-19 2001-10-19 Multiple task control method, computer program, recording medium, multiple task control system, device and printer

Country Status (1)

Country Link
JP (1) JP2003131891A (en)

Similar Documents

Publication Publication Date Title
US6823132B2 (en) Method and apparatus for controlling motor
JP2002345277A (en) Method and apparatus for controlling motor
JP4093191B2 (en) Motor control device and printer
JP3438612B2 (en) Stepping motor control device
US7121749B2 (en) Device and method for carriage drive control
JP2000134992A (en) Step motor control signal generation system
JP2003131891A (en) Multiple task control method, computer program, recording medium, multiple task control system, device and printer
JP2008299426A (en) Servo control unit, method and program, and ink jet recording device
JP4012013B2 (en) MOTOR CONTROL METHOD, MOTOR CONTROL DEVICE, ELECTRONIC DEVICE, AND RECORDING DEVICE
JP4453713B2 (en) Motor control device
JP4715397B2 (en) Motor control device, electronic device and printer device
JP2008201082A (en) Serial printer and printing control method of serial printer
JP4012012B2 (en) MOTOR CONTROL METHOD, MOTOR CONTROL DEVICE, ELECTRONIC DEVICE, AND RECORDING DEVICE
JPH02158367A (en) Printer control method
JP4697731B2 (en) PRINT MEDIUM CONTROL DEVICE, IMAGE FORMING DEVICE, PROGRAM, AND RECORDING MEDIUM
JP2018001490A (en) Recording device
JP4366066B2 (en) Recording apparatus control method and recording apparatus
JP2006330855A (en) Information processor, information processing method and program
JP4251982B2 (en) Velocity control device and image forming apparatus having the same
JP3768580B2 (en) Intertask synchronous communication method
Deshpande et al. Design and implementation of a dsp based inkjet printer motion control system for dynamic print mode control
JP2004230565A (en) Printer
KR100205750B1 (en) Automatic compensation method of both-direction printing position error for serial printer
JPH10225184A (en) Motor controller and memory medium
JP2006082410A (en) Inkjet recording device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040819

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060718

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060919

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20061219