Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JPH0534700B2 - - Google Patents
[go: Go Back, main page]

JPH0534700B2 - - Google Patents

Info

Publication number
JPH0534700B2
JPH0534700B2 JP58222822A JP22282283A JPH0534700B2 JP H0534700 B2 JPH0534700 B2 JP H0534700B2 JP 58222822 A JP58222822 A JP 58222822A JP 22282283 A JP22282283 A JP 22282283A JP H0534700 B2 JPH0534700 B2 JP H0534700B2
Authority
JP
Japan
Prior art keywords
program
task
flag
monitor
save
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.)
Expired - Lifetime
Application number
JP58222822A
Other languages
Japanese (ja)
Other versions
JPS60114939A (en
Inventor
Ryuzo Kato
Hisanobu Shinozuka
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.)
Juki Corp
Original Assignee
Juki 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 Juki Corp filed Critical Juki Corp
Priority to JP58222822A priority Critical patent/JPS60114939A/en
Publication of JPS60114939A publication Critical patent/JPS60114939A/en
Publication of JPH0534700B2 publication Critical patent/JPH0534700B2/ja
Granted legal-status Critical Current

Links

Description

【発明の詳細な説明】 この発明は、異なるタスクを行う複数のプログ
ラムをもち、それらのプログラムのうち一つを選
択して実行するための多重プログラムの制御方法
に関し、特にマイクロコンピユータ等の小型コン
ピユータにおける多重プログラムの制御方法に関
するものである。
DETAILED DESCRIPTION OF THE INVENTION The present invention relates to a method for controlling a multiple program that has a plurality of programs that perform different tasks and for selecting and executing one of the programs, and particularly for a small computer such as a microcomputer. The present invention relates to a method for controlling multiple programs in a computer.

従来、例えばマイクロコンピユータを内蔵した
シリアルプリンタにおいては、キーボートとのイ
ンターフエース、ホストコンピユータからのデー
タの読み込み等の異なるタスクを行うための複数
のプログラムがマイクロコンピユータ内に記憶さ
れており、これら複数のプログラムは第1図に示
すようなブロツク図のモニタープログラムに従い
制御される。すなわち、同図においてP1〜Pnは
上記異なるタスクを行うための複数のプログラ
ム、TCPはP1〜Pnの実行・一時停止・優先順位
を定めるタスク制御プログラム、TKCはP1〜Pn
からの命令を解読するとともにそれらの処理終了
をTCPに知らせるタスク命令処理プログラムで
ある。HTMは、マイクロコンピユータに内蔵さ
れたタイマーのスタート及びストツプ制御を行う
タイマー処理プログラム、IPは、外部割り込み
があつたときに、割り込み優先順位の決定、マイ
クロコンピユータの中央処理装置(CPU)のレ
ジスタ退避等を指令する割り込み処理プログラム
である。
Conventionally, for example, in a serial printer with a built-in microcomputer, multiple programs are stored in the microcomputer to perform different tasks such as interfacing with a keyboard and reading data from a host computer. The program is controlled according to the monitor program shown in the block diagram shown in FIG. That is, in the same figure, P 1 to Pn are multiple programs for performing the above-mentioned different tasks, TCP is a task control program that determines execution, suspension, and priority of P 1 to Pn, and TKC is P 1 to Pn.
This is a task instruction processing program that decodes instructions from and notifies TCP of the completion of their processing. HTM is a timer processing program that controls the start and stop of a timer built into a microcomputer, and IP is a timer processing program that determines interrupt priority when an external interrupt occurs, and saves registers in the microcomputer's central processing unit (CPU). This is an interrupt processing program that issues commands such as

第1図のモニタープログラムの動作タイミング
を第2図に示すと、T1〜T5はタイマーにより作
成した時分割タイミングであり、T1に至るまで
プログラムPnが実行され、T1でプログラムPnの
実行が中断されて、CPUによる演算が開始され
る。T1から△Tが経過すると、今度はプログラ
ムP1の実行に移り、T2でプログラムP1の実行が
中断されて再びCPUによる演算に戻る。
Figure 2 shows the operation timing of the monitor program in Figure 1. T1 to T5 are time division timings created by a timer, and program Pn is executed until T1 , and at T1 , program Pn is executed. Execution is suspended and the CPU begins computing. When ΔT has elapsed from T 1 , the program P 1 is executed, and at T 2 the execution of the program P 1 is interrupted and the CPU returns to calculation.

以上のようなプログラムP1〜Pnの実行・中
断はすべて、第1図のモニタープログラム中に予
め設定され、すなわちモニタープログラムは遂時
プログラムP1〜Pnの管理を行つている。
The execution and interruption of the programs P1 to Pn as described above are all set in advance in the monitor program shown in FIG. 1, that is, the monitor program manages the programs P1 to Pn at the moment.

さて、上記のような、モニタープログラムによ
る多重プログラムの管理方式は、もともと高速の
演算速度をもつCPUと大容量のメモリをもつ
中・大型コンピユータに適合するプログラミング
技術により開発されたものである。ところが、シ
リアルプリンタ等の端末装置に内蔵したマイクロ
コンピユータは小型でメモリ容量が小さく、また
CPUの演算速度が遅いため、 (i) モニタープログラムが大きなメモリを占める
ので、メモリを増設せざるを得ず、コストが上
昇する。
The above-mentioned method of managing multiple programs using a monitor program was originally developed using programming techniques suitable for medium-sized and large-sized computers with high-speed CPUs and large-capacity memories. However, microcomputers built into terminal devices such as serial printers are small and have small memory capacity, and
Due to the slow calculation speed of the CPU, (i) the monitor program occupies a large amount of memory, necessitating the addition of more memory and increasing costs;

(ii) 複雑なモニタープログラムを演算速度の遅い
CPUで実行するので、処理時間が長くなつて
しまい、例えばシリアルプリンタにおいては、
印字速度の低下を招く。
(ii) Slow calculation speed for complex monitor programs
Since it is executed by the CPU, the processing time becomes long.For example, in a serial printer,
This results in a decrease in printing speed.

等の欠点が生じた。The following drawbacks arose.

この発明は、上記の欠点にかんがみなされたも
のであり、第1図の複雑なモニタープログラムの
代わりに、プログラムP1〜Pnに各別に対応する
フラグをもつ簡易なモニタープログラムを用意
し、これらのフラグセツト・リセツトによつて各
プログラムP1〜Pnを実行・中断する多重プログ
ラムの制御方法を提供することを目的とするもの
である。
This invention was made in consideration of the above-mentioned drawbacks, and instead of the complicated monitor program shown in FIG. 1, a simple monitor program having flags corresponding to each of the programs P1 to Pn is prepared, It is an object of the present invention to provide a method for controlling multiple programs in which each program P 1 to Pn is executed or interrupted by setting and resetting flags.

以下、デージーホイール型の活字体をもつシリ
アルプリンタに本発明を適用した実施例を第3図
以下の図面に基づき説明する。
Hereinafter, an embodiment in which the present invention is applied to a serial printer having a daisy wheel type typeface will be described based on the drawings from FIG. 3 onwards.

第3図は、シリアルプリンタの制御回路のブロ
ツク図であり、同図において、MCPUは演算・
入出力機能をもつマスターCPUであり、外部の
ホストコンピユータ(図示しない)から印字指令
PCを入力して、バスBを介して制御回路全体の
制御を行う。TMは、MCPUの動作タイミングを
設定するクロツクパルスを作成するためのタイ
マ、RAMはMCPUの演算データ等を一時格納す
るための読み取り、書き込み自在のランダムアク
セスメモリ、ROMは後述するプログラムP1
P3、及びメインモニタプログラムMMP等を予め
記憶したリードオンメモリである。
Figure 3 is a block diagram of the control circuit of a serial printer.
It is a master CPU with input/output functions and receives printing commands from an external host computer (not shown).
The PC is input and the entire control circuit is controlled via bus B. TM is a timer for creating clock pulses that set the operating timing of the MCPU, RAM is a readable and writable random access memory for temporarily storing MCPU calculation data, etc., and ROM is a program P 1 to be described later.
This is a read-on memory in which P 3 , main monitor program MMP, etc. are stored in advance.

SWは、シリアルプリンタの起動・停止スイツ
チ、紙送りスイツチ等を含むスイツチ群、I/O
はSWとMCPUとのインターフエースを行う入出
力装置である。また、M1,M2はそれぞれ活字選
択用及びキヤリジ移動用のステツピングモータ、
SCPU1,SCPU2は、MCPUからの指令に基づき
演算を行い、それぞれステツピングモータM1
M2の駆動データを出力するスレーブCPUであ
る。
SW is a group of switches including serial printer start/stop switch, paper feed switch, etc., I/O
is an input/output device that interfaces between SW and MCPU. In addition, M 1 and M 2 are stepping motors for type selection and carriage movement, respectively.
SCPU 1 and SCPU 2 perform calculations based on commands from the MCPU, and control the stepping motors M 1 and 2 , respectively.
This is a slave CPU that outputs M2 drive data.

第4図は、本実施例のモニタプログラムのブロ
ツク図であり、INTはSW等からの割り込み要求
指令、TIはタイマーTMの時分割による割り込
み要求指令である。
FIG. 4 is a block diagram of the monitor program of this embodiment, where INT is an interrupt request command from SW etc., and TI is an interrupt request command by time division of the timer TM.

ICPは、INTやTIの指令による割り込み処理
を行うための処理プログラムである。
ICP is a processing program for processing interrupts based on INT and TI commands.

P1,P2,P3はそれぞれ印字位置マージンオー
バー時の警報動作(ブザーまたは発光手段によ
る)、SWの操作の検知、ホストコンピユータか
らの指令の読み取り、という三つのタクスを各別
に担当するプログラムである。MMPは、活字体
の印字位置やキヤリジの移動量等を演算するため
のメインモニタープログラムであり、これらの演
算機能に加えて、プログラムP1,P2,P3に各別
に対応するモニターフラグF1,F2,F3及び退避
フラグSF1,SF2,SF3(第5図参照)が設けられ
ている。尚、TF1,TF2,TF3はP1,P2,P3に各
別に対応してICPに設けられたタスクフラグであ
り、これについては第6図で説明する。
P 1 , P 2 , and P 3 are programs each responsible for three tasks: alarm operation (by buzzer or light emitting means) when the print position margin is exceeded, detection of SW operation, and reading of commands from the host computer. It is. MMP is a main monitor program that calculates the printing position of the typeface, the amount of carriage movement, etc. In addition to these calculation functions, it also provides monitor flags F that correspond to programs P 1 , P 2 , and P 3 . 1 , F 2 , F 3 and save flags SF 1 , SF 2 , SF 3 (see FIG. 5). Note that TF 1 , TF 2 , and TF 3 are task flags provided in the ICP corresponding to P 1 , P 2 , and P 3 respectively, and these will be explained with reference to FIG.

第5図は、メインモニタープログラムMMPの
フローチヤートであり、電源投入後先ずタイマ
TMがスタートし、このタイマTMにより発生す
るクロツクパルスによつて以下のプログラムに一
定周期毎に割り込みがかけられる。次に、演算・
制御処理を開始し、続いてモニターフラグF1
F2,F3をすべて「1」にセツトし、演算・制御
処理を続行する。尚、この演算・制御処理の中に
は、SCPU1,SCPU2に印字データを転送すると
いう動作も含まれる。一定時間が経過して演算・
制御処理が終了するとモニターフラグF1,F2
F3をすべて「0」にリセツトし、退避フラグ
SF1,SF2,SF3のセツト状態を判断する。退避
フラグSF1,SF2,SF3がリセツト状態であれば
演算・制御処理を続行し、退避フラグSF1,SF2
SF3がセツト状態にあると、退避フラグSF1
SF2,SF3をリセツトするとともに、プログラム
P1,P2,P3の処理に入る。尚、プログラムP1
P2,P3の処理開始とともにすべての割込みを不
能とする。プログラムP1,P2,P3の処理終了後
は割込み可能として、メインモニタープログラム
による演算・制御処理に戻る。続いてモニターフ
ラグF1,F2,F3すべて「1」にセツトし、演
算・制御処理を続行する。この処理の終了後、モ
ニターフラグF1,F2,F3をすべて「0」にリセ
ツトし、退避フラグSF1,SF2,SF3のセツト状
態を判断する。退避フラグSF1,SF2,SF3がリ
セツト状態にあれば演算・制御処理を続行し、ま
たセツト状態にあれば、プログラムP1,P2,P3
の処理に入る。このときも、プログラムP1,P2
P3の実行中は割り込み不能としている。プログ
ラムP1,P2,P3の処理終了後は、メインモニタ
ープログラムによる演算・制御処理に戻る。続い
てモニターフラグF1,F2,F3すべて「0」にリ
セツトし、退避フラグSF1,SF2,SF3のセツト
状態を判断する。退避フラグSF1,SF2,SF3
リセツト状態にあれば演算・制御処理を続行し、
またセツト状態にあれば、プログラムP1,P2
P3の処理に入る。上記したように、プログラム
P1,P2,P3の実行中は割り込みは不態としてあ
る。プログラムP1,P2,P3の実行が終了すると、
メインモニタープログラムによる演算・制御処理
に戻り、メインモニタープログラムは以上のルー
プを繰りかえす。
Figure 5 is a flowchart of the main monitor program MMP.
The TM starts, and the clock pulses generated by the timer TM interrupt the following program at regular intervals. Next, the calculation
Start control processing, then monitor flag F 1 ,
Set both F 2 and F 3 to "1" and continue calculation/control processing. Note that this calculation/control processing also includes the operation of transferring print data to SCPU 1 and SCPU 2 . Calculation after a certain period of time
When the control process is completed, the monitor flags F 1 , F 2 ,
Reset all F3 to "0" and save flag
Determine the set status of SF 1 , SF 2 , and SF 3 . If the save flags SF 1 , SF 2 , SF 3 are in the reset state, the calculation/control processing continues, and the save flags SF 1 , SF 2 ,
When SF 3 is in the set state, the save flag SF 1 ,
In addition to resetting SF 2 and SF 3 , the program
Processing of P 1 , P 2 , and P 3 begins. Furthermore, program P 1 ,
All interrupts are disabled at the start of P 2 and P 3 processing. After the processing of programs P 1 , P 2 , and P 3 is completed, interrupts are enabled and the processing returns to the calculation and control processing by the main monitor program. Subsequently, the monitor flags F 1 , F 2 , and F 3 are all set to "1" and the arithmetic/control processing is continued. After this process is completed, monitor flags F 1 , F 2 , and F 3 are all reset to "0", and the set states of save flags SF 1 , SF 2 , and SF 3 are determined. If the save flags SF 1 , SF 2 , SF 3 are in the reset state, the arithmetic/control processing continues, and if they are in the set state, the programs P 1 , P 2 , P 3 are restarted.
Start processing. At this time as well, programs P 1 , P 2 ,
Interrupts are disabled while P 3 is running. After the processing of programs P 1 , P 2 , and P 3 is completed, the process returns to the calculation and control processing by the main monitor program. Subsequently, the monitor flags F 1 , F 2 , and F 3 are all reset to "0", and the set states of the save flags SF 1 , SF 2 , and SF 3 are determined. If the save flags SF 1 , SF 2 , and SF 3 are in the reset state, the calculation/control processing continues,
Also, if it is in the set state, the programs P 1 , P 2 ,
Start processing P3 . As mentioned above, the program
Interrupts are disabled while P 1 , P 2 , and P 3 are being executed. When the execution of programs P 1 , P 2 , P 3 is finished,
Returning to the calculation/control processing by the main monitor program, the main monitor program repeats the above loop.

次に、タイマTMのクロツクまたはスイツチ
SW等のメインモニタープログラムMMP(第5
図)に対する割り込みのプログラムについて説明
する。
Next, the TimerTM clock or switch
Main monitor program MMP (5th
The interrupt program for FIG.

第6図において、割り込みを開始すると、先
ず、次の割込みが関与しないように割り込み不能
処理を行い、その割り込みが外部割り込みか否か
を判断する。外部割り込み、すなわちスイツチ
SWの操作等であると、それに対応する処理を行
い割り込みを可能としてメインモニタープログラ
ムMMPに戻る。また、外部割り込み以外、すな
わちタイマTMのクロツクによる周期的な割り込
みであると、タスクフラグTF1のセツト状態を判
断する。尚、タスクフラグTF1,TF2,TF3はメ
インモニタープログラムMMPの初期状態で1、
0、0(以下セツトを「1」、リセツトを「0」で
あらわす)に設定されている。さて、タスクフラ
グTF1がセツト状態にあると、モニターフラグF1
のセツト状態を判断し、モニターフラグF1がリ
セツト状態にあればプログラムP1の処理を行う。
また、それがセツト状態にあれば、プログラム
P1の演算パラメータを一時所定のレジスタに退
避させる。プログラムP1の処理または上記退避
動作が終了すると、退避フラグSF1をセツトする
とともにタスクフラグTF1をリセツトして、タス
クフラグTF2をセツトし、割り込み可能処理のの
ちメインモニタープログラムMMPに戻る。タス
クフラグTF2またはTF3がセツト状態にあれば、
モニターフラグF2またはモニターフラグF3の状
態に対応して、上記と同様の処理をプログラム
P2またはP3に対して行う。ただし、タスクフラ
グTF1,TF2,TF3のセツト・リセツトはサイク
リツクに行なわれる。すなわち、タスクフラグ
TF2がセツト状態のときは上記処理の終了後
(TF1,TF2,TF3)は(0、1、0)→(0、
0、1)にまた、タスクフラグTF3がセツト状
態のときは、上記処理の終了後(TF1,TF2
TF3)は(0、0、1)→(1、0、0)と切り
換えられる。
In FIG. 6, when an interrupt is started, first, interrupt disabling processing is performed so that the next interrupt will not be involved, and it is determined whether or not the interrupt is an external interrupt. External interrupts, i.e. switches
If it is a SW operation, etc., it performs the corresponding processing, enables interrupts, and returns to the main monitor program MMP. Furthermore, if it is a periodic interrupt other than an external interrupt, that is, a periodic interrupt caused by the clock of the timer TM, the set state of the task flag TF1 is determined. Note that task flags TF 1 , TF 2 , and TF 3 are 1 and 1 in the initial state of the main monitor program MMP.
0, 0 (hereinafter, set is expressed as ``1'' and reset is expressed as ``0''). Now, when task flag TF 1 is set, monitor flag F 1
If the monitor flag F1 is in the reset state, the program P1 is processed.
Also, if it is in the set state, the program
Temporarily save the calculation parameters of P1 to a predetermined register. When the processing of the program P1 or the above-mentioned save operation is completed, the save flag SF1 is set, the task flag TF1 is reset, the task flag TF2 is set, and after interrupt enable processing, the program returns to the main monitor program MMP. If task flag TF 2 or TF 3 is set,
Program the same process as above depending on the status of monitor flag F 2 or monitor flag F 3 .
Do this for P 2 or P 3 . However, task flags TF 1 , TF 2 , and TF 3 are set and reset cyclically. i.e. task flag
When TF 2 is in the set state, after the above processing (TF 1 , TF 2 , TF 3 ) is (0, 1, 0) → (0,
0, 1), and when the task flag TF3 is set, after the above processing is completed (TF 1 , TF 2 ,
TF 3 ) is switched from (0, 0, 1) to (1, 0, 0).

次に、第7図により、上記第5,6図のフロー
チヤートによるメインモニタプログラムMMC及
びプログラムP1〜P3の動作タイムチヤート、及
びそれに対応する各フラグF1〜F3、SF1〜SF3
TF1〜TF3のセツト・リセツト状態について説明
する。
Next, according to FIG. 7, the operation time charts of the main monitor program MMC and programs P 1 to P 3 according to the flowcharts of FIGS. 5 and 6 above, and the corresponding flags F 1 to F 3 and SF 1 to SF 3 ,
The set/reset states of TF 1 to TF 3 will be explained.

制御回路に電源を投入すると、タイマTMのク
ロツクパルスによりメインモニタープログラム
MMPに対し周期的な割り込みが開始されるとと
もに、メインモニタープログラムMMPの演算・
制御も開始される。先ず、メインモニタープログ
ラムMMPでフラグF1〜F3が「1」にセツトされ
ているときに、T1で上記割り込みが入ると、第
6図の割り込みプログラムに移行する。このとき
タスクフラグTF1がセツト状態であることから、
モニタフラグF1が判断され、モニタフラグF1
セツト状態であるので、プログラムP1のパラメ
ータをMCPUの所定レジスタに一時退避させて、
直ちにタスクフラグTF2のセツト、及び退避フラ
グSF1のセツトを行つたのちにメインモニタープ
ログラムMMPに戻る。すなわち、プログラムP1
は、そのパラメータを退避させるだけで実行はし
ないので、短い時間△tだけの中断をはさむだけ
でメインモニタープログラムMMPの演算・制御
を継続することができる。この演算が終了してそ
のデータが例えばキヤリジ移動用のSCPU1に転
送された後に、タイミングX1でモニターフラグ
F1〜F3が「0」にリセツトされると、退避フラ
グSF1が判断され、それが「1」にセツトされて
いるため、退避フラグSF1「0」にリセツトされ
た後にレジスタから退避していたパラメータが戻
されてプログラムP1が実行される。プログラム
P1のタイミングT2にタイマTMの割り込みが入
ろうとするが、この間はすべての割り込みが不可
能とされているので、プログラムP1はそのまま
実行される。プログラムP1の終了後は再びメイ
ンモニタープログラムMMPの演算・制御が開始
される。次にタイミングX2でモニターフラグ
F1,F2,F3がすべて「1」にセツトされる。
When power is applied to the control circuit, the main monitor program is started by the clock pulse of TimerTM.
Periodic interrupts are started for MMP, and the main monitor program MMP calculations and
Control is also started. First, when flags F 1 to F 3 are set to "1" in the main monitor program MMP, when the above-mentioned interrupt occurs at T1 , the program shifts to the interrupt program shown in FIG. Since task flag TF 1 is set at this time,
The monitor flag F1 has been determined, and since the monitor flag F1 is in the set state, the parameters of the program P1 are temporarily saved in a predetermined register of the MCPU.
After immediately setting the task flag TF2 and setting the save flag SF1 , the program returns to the main monitor program MMP. i.e. program P 1
Since it only saves its parameters and does not execute them, the calculation and control of the main monitor program MMP can be continued with only a short interruption of Δt. After this calculation is completed and the data is transferred to, for example, SCPU 1 for carriage movement, the monitor flag is set at timing X 1 .
When F 1 to F 3 are reset to "0", the save flag SF 1 is determined, and since it is set to "1", the save flag SF 1 is reset to "0" and then saved from the register. The previous parameters are returned and program P1 is executed. program
An interrupt from the timer TM is about to occur at timing T2 of P1 , but since all interrupts are disabled during this time, program P1 is executed as is. After the program P 1 ends, the calculation and control of the main monitor program MMP is started again. Next, monitor flag at timing X2
F 1 , F 2 , and F 3 are all set to "1".

こうして次にタイミングT3で割り込みが入る
と、第6図の割り込みプログラムに入るが、タス
クフラグTF2がセツト状態にあるため今度は、モ
ニターフラグF2のセツト状態に関連してプログ
ラムP2のパラメータ退避が行なわれる。また、
これより直ちに退避フラグSF2のセツト、タスク
フラグTF2のリセツト、タスクフラグTF2のセ
ツトが行なわれて再びメインモニタプログラム
MMPに戻る。
When an interrupt occurs next at timing T3 , the interrupt program shown in FIG. 6 is entered, but since task flag TF2 is in the set state, program P2 is programmed in relation to the set state of monitor flag F2 . Parameters are saved. Also,
Immediately after this, the save flag SF2 is set, the task flag TF2 is reset, the task flag TF2 is set, and the main monitor program is restarted.
Return to MMP.

続いてタイミングT4で割り込みが入ると、タ
スクフラグTF3のセツト状態に関連して、モニタ
ーフラグF3のセツト状態によりプログラムP3
パラメータ退避及び退避フラグSF3のセツト、タ
スクフラグTF3のリセツト、タスクフラグTF1
セツトが行なわれる。さらにまた、タイミング
T5で割り込みが入ると、タスクフラグTF1のセ
ツト状態に関連して、モニターフラグF1のセツ
ト状態によりプログラムP1のパラメータ退避及
び退避フラグSF1のセツト、タスクフラグTF1
リセツト、タスクフラグTF2のセツトが行なわれ
る。こうして、退避フラグSF1〜SF3がすべて
「1」にセツトされる。次にタイミングX3でモニ
タフラグF1〜F3が「0」にリセツトされる
と、退避フラグSF1,SF2,SF3が判断され、そ
れがセツト状態にあるため、退避フラグSF1
SF2,SF3がリセツトされるとともにプログラム
P1,P2,P3が実行される。プログラムP1,P2
P3の終了後、次に、タイミングT7で割り込みが
入ると、タスクフラグTF2がセツト状態にあるた
め、モニターフラグF2が判断され、モニターフ
ラグF2が「0」にリセツトされていることから、
プログラムP2が実行され、それの終了後タスク
フラグTF2のリセツト、タスクフラグTF3のセツ
トが行なわれる。
Subsequently, when an interrupt occurs at timing T4 , the parameters of program P3 are saved, the save flag SF3 is set, and the task flag TF3 is set due to the set state of monitor flag F3 . A reset and setting of the task flag TF1 is performed. Furthermore, the timing
When an interrupt occurs at T5 , in relation to the set state of task flag TF1 , the parameters of program P1 are saved, the save flag SF1 is set, the task flag TF1 is reset, and the task flag F1 is set. Flag TF 2 is set. In this way, all save flags SF 1 to SF3 are set to "1". Next, when the monitor flags F1 to F3 are reset to "0" at timing X3 , the save flags SF1 , SF2 , and SF3 are determined, and since they are in the set state, the save flags SF1 ,
SF 2 and SF 3 are reset and the program
P 1 , P 2 , and P 3 are executed. Programs P 1 , P 2 ,
After completion of P3 , when an interrupt occurs at timing T7 , the task flag TF2 is in the set state, so the monitor flag F2 is determined and the monitor flag F2 is reset to "0". Therefore,
Program P2 is executed, and after its completion task flag TF2 is reset and task flag TF3 is set.

以上のように、この発明によれば、 時分割して継時的にタスクを実行すべき複数の
プログラムをもつ制御装置において、演算を行う
メインプログラムの実行・待機を指令するモニタ
ーフラグと、タスクを実行すべき複数のプログラ
ムに各別に対応して実行・停止を指令するタスク
フラグとをもつ制御プログラムを設け、モニター
フラグの待機状態に関連して、実行指令状態にあ
るタスクフラグに対応するプログラムを自動的に
実行するようにしたので、従来のように、多重プ
ログラムの順序・時分割の設定などを遂一指令す
る複雑なモニタープログラムを要することなく、
自動的なフラグのセツト・リセツトだけで多重プ
ログラムを管理できるので、そのような管理プロ
グラムの格納に要していたメモリ容量を著しく減
少できるからコストを低減できるという効果があ
る。
As described above, according to the present invention, in a control device having a plurality of programs that should execute tasks sequentially in a time-divided manner, a monitor flag that instructs execution/standby of a main program that performs calculations, and a task A control program is provided that has task flags that issue commands to execute or stop a plurality of programs that are to be executed separately, and a program that corresponds to the task flag that is in the execution command state in relation to the standby state of the monitor flag. Because it is now executed automatically, there is no need for a complicated monitor program that commands the order and time division settings of multiple programs, etc., as in the past.
Since multiple programs can be managed simply by automatically setting and resetting flags, the memory capacity required to store such management programs can be significantly reduced, resulting in cost reduction.

また、管理プログラムの演算時間も減少するの
で、例えばシリアルプリンタのような端末装置に
本発明を適用することによつて、その印字速度を
上昇することができる。
Moreover, since the calculation time of the management program is also reduced, by applying the present invention to a terminal device such as a serial printer, the printing speed can be increased.

尚、上記実施例では、多重プログラムP1〜P3
を三本実行するようにしているが、この発明がそ
の数に限定されるものではないことは勿論であ
る。
In the above embodiment, multiple programs P 1 to P 3
Although three are executed, it goes without saying that the present invention is not limited to that number.

また、上記実施例におけるモニターフラグF1
〜F3は、一個に限定してその一つのモニターフ
ラグをセツト・リセツトするようにしてもよく、
あるいは各プログラムP1〜P3の実行に要する時
間によつて、各モニターフラグF1〜F3い非同期
としてもよい。
In addition, the monitor flag F 1 in the above embodiment
~ F3 may be limited to one and set/reset that one monitor flag,
Alternatively, the monitor flags F1 to F3 may be set asynchronously depending on the time required to execute each program P1 to P3 .

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は、従来の制御装置のモニタープログラ
ムのブロツク図、第2図は、第1図のモニタープ
ログラムの動作のタイムチヤート、第3図は本発
明実施例の制御回路のブロツク図、第4図は、本
発明のモニタープログラムのブロツク図、第5図
は、メインモニタープログラムのフローチヤー
ト、第6図は、割り込みプログラムのフローチヤ
ート、第7図は、本発明のモニタープログラムの
動作のタイムチヤートである。 ROM……記憶手段、MCPU……制御手段、
MMP……メインモニタープログラム、P1〜P3
…プログラム、F1〜F3……モニターフラグ、TF1
〜TF3……タスクフラグ、SF1〜SF3……退避フ
ラグ。
FIG. 1 is a block diagram of a monitor program of a conventional control device, FIG. 2 is a time chart of the operation of the monitor program of FIG. 1, FIG. 3 is a block diagram of a control circuit according to an embodiment of the present invention, and FIG. 5 is a flowchart of the main monitor program, FIG. 6 is a flowchart of the interrupt program, and FIG. 7 is a time chart of the operation of the monitor program of the present invention. It is. ROM...Storage means, MCPU...Control means,
MMP……Main monitor program, P 1 to P 3
...Program, F 1 to F 3 ...Monitor flag, TF 1
~TF 3 ...Task flag, SF1 ~ SF3 ...Evacuation flag.

Claims (1)

【特許請求の範囲】 1 演算を実行するためのメインプログラム及び
それぞれ異なるタスクを実行するための複数のタ
スクプロラムとを記憶した記憶手段と、。 メインプログラム及びタスクプログラムの実行
または停止を各別に制御可能とした制御手段、と
を備えた制御装置において、 タスクプログラムのデータをレジスタに格納す
る退避処理およびタスクプログラムを実行するプ
ログラム処理およびメインプログラムが演算実行
時期か演算停止時期かを判別するためのモニター
フラグF1〜F3およびタスクプログラムに各別に
対応してそれらのタスクプログラムのうち一つを
所定の順序で選択的に実行するためのタスクフラ
グTF1〜TF3ならびにレジスタにデータを退避し
たタスクプログラムを特定するための退避フラグ
SF1〜SF3とにより、タスクフラグの読み出しに
関連して、モニターフラグが演算実行時期を判別
するときはタスクフラグに対応するタスクプログ
ラムについての退避処理を実行してから退避処理
したタスクプログラムに対応する退避フラグをセ
ツトし、またモニターフラグが演算停止時期を判
別するときはタスクフラグに対応するタスクプロ
グラムのプログラム処理を実行したのち、タスク
フラグを更新する第一の制御と、 退避フラグのセツトに関連して第一の制御にお
いて退避フラグにより特定されたタスクプログラ
ムのデータをレジスタから読み出して該タスクプ
ログラムのプログラム処理を実行する第二の制
御、 とを行うことを特徴とした多重プログラムの制御
方法。
[Scope of Claims] 1. Storage means storing a main program for executing operations and a plurality of task programs for executing different tasks. A control device that is equipped with a control means capable of separately controlling the execution or stopping of a main program and a task program, which performs a save process for storing data of the task program in a register, a program process for executing the task program, and a main program. Monitor flags F 1 to F 3 for determining whether it is time to execute or stop calculations and tasks for selectively executing one of the task programs in a predetermined order in response to each task program. Flags TF 1 to TF 3 and save flags to identify the task program that saved data to the register.
According to SF 1 to SF 3 , in connection with reading a task flag, when the monitor flag determines when to execute an operation, it executes the save process for the task program corresponding to the task flag, and then executes the save process for the task program that has been saved. After setting the corresponding save flag and executing the program processing of the task program corresponding to the task flag when the monitor flag determines when to stop calculation, first control for updating the task flag and setting the save flag. a second control that reads data of the task program specified by the save flag in the first control from a register in relation to the first control and executes program processing of the task program. Method.
JP58222822A 1983-11-26 1983-11-26 Control method of multiplex program Granted JPS60114939A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP58222822A JPS60114939A (en) 1983-11-26 1983-11-26 Control method of multiplex program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP58222822A JPS60114939A (en) 1983-11-26 1983-11-26 Control method of multiplex program

Publications (2)

Publication Number Publication Date
JPS60114939A JPS60114939A (en) 1985-06-21
JPH0534700B2 true JPH0534700B2 (en) 1993-05-24

Family

ID=16788450

Family Applications (1)

Application Number Title Priority Date Filing Date
JP58222822A Granted JPS60114939A (en) 1983-11-26 1983-11-26 Control method of multiplex program

Country Status (1)

Country Link
JP (1) JPS60114939A (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6949682B2 (en) * 2017-11-27 2021-10-13 キヤノン株式会社 Image forming device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5031749A (en) * 1973-07-21 1975-03-28

Also Published As

Publication number Publication date
JPS60114939A (en) 1985-06-21

Similar Documents

Publication Publication Date Title
US6031973A (en) Robot and its controller method
US4907150A (en) Apparatus and method for suspending and resuming software applications on a computer
US5083266A (en) Microcomputer which enters sleep mode for a predetermined period of time on response to an activity of an input/output device
JP2982875B2 (en) Slave controller
JPH0376496B2 (en)
CN108241522B (en) Sleep state switching method, device and electronic device in virtualized environment
JP2005521937A (en) Context switching method and apparatus in computer operating system
JPH0534700B2 (en)
JPS60218152A (en) micro processor
JPS6347812A (en) Sleep mode controller
JPH1173330A5 (en)
JPS5965306A (en) Sequence control device
JP3302149B2 (en) Computer system
JPH0883133A (en) Computer system and clock control method thereof
JP2508026B2 (en) Timer control method
JPH0637470Y2 (en) Graphics controller
JP3143496B2 (en) Electronic device and control method for electronic device
JP3024719B2 (en) Arithmetic processing method of programmable controller
JPS6239776B2 (en)
JP4535663B2 (en) State machine control method and state machine
JPH06105439B2 (en) Program management method
JPH03111961A (en) Multi-CPU program loading method
WO2022180893A1 (en) Control device and control method
JPS58205258A (en) data processing equipment
JPH02236708A (en) Electronic computation processing system