JP2671517B2 - Processing method of timer and counter in sequence processing - Google Patents

Processing method of timer and counter in sequence processing

Info

Publication number
JP2671517B2
JP2671517B2 JP21776889A JP21776889A JP2671517B2 JP 2671517 B2 JP2671517 B2 JP 2671517B2 JP 21776889 A JP21776889 A JP 21776889A JP 21776889 A JP21776889 A JP 21776889A JP 2671517 B2 JP2671517 B2 JP 2671517B2
Authority
JP
Japan
Prior art keywords
counter
timer
processing
general
dedicated processor
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
JP21776889A
Other languages
Japanese (ja)
Other versions
JPH0380304A (en
Inventor
覚 尾崎
秀隆 柴田
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric Co Ltd
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 Fuji Electric Co Ltd filed Critical Fuji Electric Co Ltd
Priority to JP21776889A priority Critical patent/JP2671517B2/en
Publication of JPH0380304A publication Critical patent/JPH0380304A/en
Application granted granted Critical
Publication of JP2671517B2 publication Critical patent/JP2671517B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Programmable Controllers (AREA)

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION 【産業上の利用分野】[Industrial applications]

本発明はシーケンス制御プログラムとしてのラダー演
算を実行するプロセッサであって、タイマ,カウンタの
処理に必要な計時,計数機能を持たぬ専用プロセッサ、 外部の被制御機器と交信しつつ、前記専用プロセッサ
のためのタイマ,カウンタ処理等を行って、この専用プ
ロセッサに前記ラダー演算を行わせる汎用プロセッサ、 を備えたシーケンス制御装置としてのいわゆるプログラ
マブル・コントローラのシーケンス処理におけるタイ
マ,カウンタの処理方法に関するもので、 特に汎用プロセッサのタイマ,カウンタ処理のための
無駄時間を極力削減し得るようにしたシーケンス処理に
おけるタイマ,カウンタの処理方法に関する。 なお以下各図において同一の符号は同一もしくは相当
部分を示す。
The present invention is a processor that executes a ladder operation as a sequence control program, and includes a dedicated processor that does not have a timekeeping and counting function necessary for processing timers and counters, while communicating with an external controlled device, For a timer and a counter in a sequence processing of a so-called programmable controller as a sequence controller provided with a general-purpose processor for performing a ladder operation to the dedicated processor by performing a timer and counter processing for In particular, the present invention relates to a timer / counter processing method in sequence processing that can reduce the dead time for timer / counter processing of a general-purpose processor as much as possible. In the drawings, the same reference numerals indicate the same or corresponding parts.

【従来の技術】[Prior art]

いわゆるプログラマブル・コントローラは大きく分け
て、 コントローラの外界とのデータ・インタフェイス(通
信、マン−マシーン等)、 各種制御のための数値演算、 シーケンス制御のための論理演算、 の機能を有しており、これらの機能を実現するためにマ
イクロコンピュータが使用されている。このうち、シー
ケンス制御のための論理演算は演算の単位がビットであ
るために8ビット、16ビット、32ビットと高級化しつつ
あるマイクロプロセッサにとっては、極めて煩雑で処理
速度の点からも効率の悪い演算である。しかるに、この
種のシーケンス処理演算そのものは簡単な論理演算の組
合わせで実現できることから、近年はゲートアレイに代
表されるASIC(Application Specific IC)の普及とあ
いまって、プログラマブル・コントローラのメーカが独
自に開発した専用のプロセッサ(例えば後述の第25図の
2)に第26図に示すようなラダー図表現されたシーケン
ス処理を直接行わせる方式が採用されている。なおこの
ラダー図における記号の意味はつぎの通りである。 第25図はこのようなプログラマブル・コントローラの
システム構成例を示すブロック図である。同図で汎用マ
イクロコンピュータ(汎用プロセッサともいう)1は数
値演算処理に関しては入力インタフェイス4を介して入
力したデータに対してアプリケーション・プログラムに
従って各種数値演算を施して出力インタフェース5を介
して出力する。またシーケンス処理に関しては同じく入
力インタフェース4を介して入力したデータ及び数値演
算結果に基づいた論理データをコモンメモリ3にセット
し、起動信号Strにて論理演算用の専用プロセッサ2を
起動する。専用プロセッサ2は汎用プロセッサ1によっ
て起動されると汎用プロセッサ1がコモンメモリ3にセ
ットしたビット・データを参照・更新しながら、予めコ
モンメモリ3に格納されているシケンス処理のためのア
プリケーション・プログラムを実行する。専用プロセッ
サ2は一連のシーケンス処理が終了すると、汎用プロセ
ッサ1に対して、例えば割り込み要求信号Reqを使っ
て、処理が終了したことを通知する。汎用プロセッサ1
は専用プロセッサ2によるシーケンス処理の終了したこ
とで、コモンメモリ3からシーケンス処理の結果である
ビット情報を読出して出力インタフェース5を介して外
部に出力したり、数値演算に使用する。 一般にシーケンス処理では純粋なブール代数演算とも
いうべきビット単位の単離演算例えば論理演算、論理和
演算、論理の反転等と、これに伴うビットデータの参照
・更新とともに、論理演算結果による時限(タイマ)処
理及び計数(カウンタ)処理が要求される。このような
タイマの種別としては次のようなものがある。 遅延要素としてオン→オフの変化のみを遅延させるオ
ンディレイ・タイマ、 オンディレイ・タイマとは逆にオン→オフの変化のみ
を遅延させるオフディレイ・タイマ、 入力のオフ→オンの変化に対して出力を一定期間保持
するワンショット・タイマ(モノステーブル・タイマと
もいう)、 ワンショット・タイマの一種で連続的な入力のオフ→
オン変化に対しても出力を保持し続けるリトリガブル・
ワンショット・タイマ(以下、簡単のためのリトリガブ
ル・タイマと記す)。 これらのタイマの処理はいずれの場合も入力の論理値
或いはその変化に対し、周期的に起動されるプログラム
の実行回数を計数してもタイムベース(=実行周期)×
実行回数の形で時間管理を行う。 一方、カウンタの種別としては、次のようなものがあ
る。 入力のオフ→オン変化の回数を0から増加方向に計数
してあらかじめ設定してある設定値と大小比較し、その
比較結果の論理値をカウンタ出力とするアップ・カウン
タ、 ダウン・カウンタとは逆に設定値から順次減算してそ
の値が0か否かをカウンタ出力とするダウン・カウン
タ。 以上のような各種のタイマ処理,カウンタ処理いずれ
の場合も論理演算的な要素とともに数値演算の要素も含
まれるために前記のような論理演算専用のプロセッサ2
のみでその機能を実現することは困難である。そこで従
来は前記のような論理演算専用プロセッサ2を使用する
場合でも、タイマ,カウンタ処理は汎用のプロセッサ1
が行う方式を採用している。この場合、タイマ,カウン
タに相当する命令は他の論理演算命令と混在した形にな
っているために、タイマ,カウンタの起動・計数にかか
わる論理演算結果に応じて直ちにタイマ,カウンタの演
算処理を行う必要があるばかりでなく、タイマ,カウン
タ処理の結果をその後の論理演算に直ちに反映される必
要がある。このため、シーケンス処理に含まれる一般の
論理演算(専用のプロセッサ2で処理する)タイマ,カ
ウンタ処理(通常の汎用プロセッサ1が処理する)を分
離することができずに、この2種類の処理が入り乱れて
実行されることになる。具体的な動作例を第27図のタイ
ミング・チャートに示す。同図(3),(1)のように
シーケンス処理を実行させるべく汎用プロセッサ1によ
り時点τ1において、起動された論理演算専用のプロセ
ッサ2がその実行過程の時点τ2でタイマ,カウンタ処
理に相当する命令を見つけると論理演算を中断して汎用
プロセッサ1に対して割込みを発生してその旨(処理要
求)を通知し、汎用プロセッサ1は同図(2)の割込処
理の中で専用プロセッサ2が演算を中断したプログラム
位置から具体的なタイマ,カウンタの種別及びタイマ,
カウンタの計数値及び出力のビットメモリ・アドレスを
識別するための番号を解析するとともにタイマ,カウン
タの入力に相当するビット情報に応じてタイマ,カウン
タ処理を行い、その結果に基づいてタイマ,カウンタの
論理出力に対応するコモンメモリ3のビットデータを更
新する。その後、時点τ3において、汎用プロセッサ1
はタイマ,カウンタ命令の直後の命令から再度、専用プ
ロセッサ2を起動して専用プロセッサ2がラダー図のシ
ーケンス処理をすべて終了するまで上記の手順を繰返
す。そして専用プロセッサ2によるラダー図の一通りの
シーケンス処理(第27図(1))は汎用プロセッサ1に
よって所定の(例えば10msの)起動周期(タイムベース
ともいう)Δtごとに繰返される。
So-called programmable controllers are roughly divided into data interfaces (communication, man-machine, etc.) with the outside of the controller, numerical operations for various controls, and logical operations for sequence control. , A microcomputer is used to realize these functions. Of these, the logical operation for sequence control is extremely complicated and inefficient in terms of processing speed for a microprocessor that is becoming high-grade such as 8-bit, 16-bit, and 32-bit because the operation unit is a bit. It is an operation. However, since this kind of sequence processing operation itself can be realized by a combination of simple logical operations, in recent years, along with the widespread use of ASIC (Application Specific IC) represented by gate arrays, programmable controller manufacturers have independently A system is adopted in which the developed dedicated processor (for example, 2 in FIG. 25, which will be described later) directly performs the sequence processing represented in the ladder diagram as shown in FIG. The symbols used in this ladder diagram have the following meanings. FIG. 25 is a block diagram showing a system configuration example of such a programmable controller. In the figure, a general-purpose microcomputer (also referred to as a general-purpose processor) 1 performs various numerical operations on data input via an input interface 4 according to an application program and outputs it via an output interface 5 in regard to numerical operation processing. . Regarding the sequence processing, similarly, the data input via the input interface 4 and the logical data based on the numerical calculation result are set in the common memory 3, and the dedicated processor 2 for logical calculation is activated by the activation signal Str. When the general-purpose processor 1 is activated by the general-purpose processor 1, the special-purpose processor 2 refers to and updates the bit data set by the general-purpose processor 1 in the common memory 3 while executing an application program for sequence processing stored in the common memory 3 in advance. Run. When the series of sequence processing is completed, the dedicated processor 2 notifies the general-purpose processor 1 that the processing is completed by using, for example, the interrupt request signal Req. General-purpose processor 1
After the sequence processing by the dedicated processor 2 is completed, the bit information which is the result of the sequence processing is read from the common memory 3 and output to the outside through the output interface 5 or used for numerical calculation. Generally, in sequence processing, bit-unit isolation operations that should be called pure Boolean algebra operations, such as logical operations, logical sum operations, and logical inversions, and accompanying bit data reference / updating, and timed operations (timer ) Processing and counting processing is required. The types of such timers are as follows. As a delay element, an on-delay timer that delays only changes from on to off, an off-delay timer that delays only changes from on to off, as opposed to an on-delay timer, output for changes from input to off One-shot timer (also called monostable timer) that keeps the input for a certain period, a type of one-shot timer that continuously turns off input →
Retriggerable that keeps the output even when it changes
One-shot timer (hereinafter referred to as retriggerable timer for simplicity). In any of these timer processes, the time base (= execution cycle) ×
Time management is performed in the form of the number of executions. On the other hand, there are the following types of counters. It is the opposite of an up counter or down counter that counts the number of input off-to-on changes in an increasing direction from 0, compares it with a preset value, and uses the logical value of the comparison result as the counter output. A down counter that sequentially subtracts from the set value and outputs as a counter whether the value is 0 or not. In any of the various timer processing and counter processing as described above, since the elements of the numerical operation are included in addition to the elements of the logical operation, the processor 2 dedicated to the logical operation as described above.
It is difficult to realize that function by itself. Therefore, conventionally, even when the above-described logical operation dedicated processor 2 is used, the timer / counter processing is performed by the general-purpose processor 1.
Has adopted the method. In this case, since the instructions corresponding to the timer and the counter are mixed with other logical operation instructions, the operation processing of the timer and the counter is immediately performed according to the logical operation result related to the start and counting of the timer and the counter. Not only does this have to be done, but the results of the timer and counter processing need to be immediately reflected in the subsequent logical operations. Therefore, the general logical operation (processed by the dedicated processor 2) timer and the counter process (processed by the general-purpose processor 1) included in the sequence processing cannot be separated, and these two types of processing are performed. It will be executed in disorder. A concrete operation example is shown in the timing chart of FIG. At the time τ1 by the general-purpose processor 1 to execute the sequence processing as shown in (3) and (1) of the same figure, the processor 2 dedicated to the logical operation started corresponds to the timer / counter processing at the time τ2 in the execution process. When the instruction is found, the logical operation is interrupted, an interrupt is generated to the general-purpose processor 1 to notify it (processing request), and the general-purpose processor 1 executes the special-purpose processor 2 in the interrupt processing of FIG. From the program position where the operation was interrupted, the specific timer, counter type and timer,
The count value of the counter and the number for identifying the bit memory address of the output are analyzed, and the timer and the counter process are performed according to the bit information corresponding to the input of the timer and the counter. The bit data of the common memory 3 corresponding to the logic output is updated. Then, at time τ3, the general-purpose processor 1
Starts the dedicated processor 2 again from the instruction immediately after the timer / counter instruction and repeats the above procedure until the dedicated processor 2 finishes all the sequence processing of the ladder diagram. The general-purpose processor 1 repeats a sequence of the ladder diagram (FIG. 27 (1)) by the dedicated processor 2 at every predetermined (for example, 10 ms) activation period (also referred to as time base) Δt.

【発明が解決しようとする課題】[Problems to be solved by the invention]

このように割込みを介して専用プロセッサ2と汎用プ
ロセッサ1が入り乱れて処理を行う方式では第28図の汎
用マイクロプロセッサ1の動作フローチャートで示すよ
うにタイマ,カウンタ1命令ごとに、 割込み処理プログラムの起動に伴う汎用プロセッサの
内部レジスタ群の退避(ステップ101)、 割込み処理発生要因の解析(タイマ,カウンタの区
別,個別番号の解析)(ステップ102〜107)、 前項の解析結果及び専用プロセッサの途中演算結果
(タイマ,カウンタの入力)に基づいたタイマ処理或い
はカウンタの処理演算(ステップ102A〜107A)、 専用プロセッサ再起動のためのデータ設定処理(ステ
ップ108)、 割込み発生時点のプログラムに復帰するための処理
(レジスタ群の復帰、割込み制御回路のリセット等)
(ステップ110)、 が発生するが、このうち実質的なタイマ,カウンタ処理
は項の処理のみで他はこの処理の起動要因に割込みを
使用したために生じたいわゆるオーバヘッドであり、そ
れが汎用プロセッサの負担となり他の数値演算処理の演
算時間を圧迫して処理全体のスループットを低下させる
という問題点を有していた。 そこで本発明は前記のオーバヘッドを極力減じ得るよ
うなシーケンス処理におけるタイマ,カウンタの処理方
法を提供し、前記の問題を解消することを課題とする。
In the system in which the dedicated processor 2 and the general-purpose processor 1 are disorderly processed through the interrupt in this way, the interrupt processing program is started for each instruction of the timer and counter 1 as shown in the operation flowchart of the general-purpose microprocessor 1 in FIG. Saving internal register group of general-purpose processor (step 101), analysis of interrupt processing cause (timer / counter distinction, individual number analysis) (steps 102-107), analysis result of the previous section and intermediate calculation of dedicated processor Timer processing or counter processing calculation based on the result (input of timer and counter) (steps 102A to 107A), data setting processing for restarting the dedicated processor (step 108), for returning to the program at the time of the interrupt occurrence Processing (restore of registers, reset of interrupt control circuit, etc.)
(Step 110) occurs, but of these, the substantial timer and counter processing is only the processing of the term, and the other is so-called overhead caused by using the interrupt for the activation factor of this processing, which is the so-called overhead of the general-purpose processor. There is a problem that it becomes a burden and puts pressure on the calculation time of other numerical calculation processing to reduce the throughput of the whole processing. Therefore, an object of the present invention is to provide a processing method of a timer and a counter in sequence processing that can reduce the overhead as much as possible, and solve the above problem.

【課題を解決するための手段】[Means for Solving the Problems]

このような課題を解決するために、本発明は、コモン
メモリを読み書きしつつシーケンス制御プログラムとし
てのラダー演算を実行し、タイマ,カウンタの処理に必
要な計時,計数機能を持たない専用プロセッサと、外部
の被制御機器と交信しつつコモンメモリを介して専用プ
ロセッサとデータを授受して専用プロセッサにラダー演
算を行わせる汎用プロセッサと備え、 専用プロセッサが実行するラダー演算中における各種
のタイマ又はカウンタの処理命令を、それぞれこの処理
命令に対応した論理変数を含んだ部分的なラダー演算に
置換え、 専用プロセッサは、この論理変数を読み書きしつつ、
汎用プロセッサに対して少なくともタイマ又はカウンタ
の処理命令に関する割込処理を要求することなく、汎用
プロセッサの起動に基づくラダー演算をその終了まで実
行し、 汎用プロセッサは、少なくとも専用プロセッサのラダ
ー演算の終了から次回の専用プロセッサの起動までの間
に、タイマ又はカウンタの処理命令に対応して、それぞ
れ当該の前記論理変数を用いて、計時又は計数を含む処
理(以下タイマ・カウンタ処理という)を行い、そして 汎用プロセッサは、当該の前記論理変数を計時又は計
数条件を満たすタイマ・カウンタ処理ごとに1つづつ計
時又は計数を行い、この計時値又は計数値が当該タイマ
・カウンタ処理に対して予め設定された計時値又は計数
値に到達したら、その直後における専用プロセッサの起
動時に、当該論理変数を介して計時満了又は計数満了の
旨を専用プロセッサに伝えることを特徴とする。
In order to solve such a problem, the present invention executes a ladder operation as a sequence control program while reading and writing a common memory, and a dedicated processor that does not have a timekeeping and counting function required for timer and counter processing, It is equipped with a general-purpose processor that exchanges data with a dedicated processor via a common memory while communicating with an external controlled device and causes the dedicated processor to perform ladder calculations. The processing instruction is replaced with a partial ladder operation including a logical variable corresponding to the processing instruction, and the dedicated processor reads and writes this logical variable,
The ladder operation based on the start-up of the general-purpose processor is executed until the end without requesting the general-purpose processor at least for the interrupt processing related to the processing instruction of the timer or the counter. Until the next dedicated processor is activated, in response to a processing instruction of a timer or a counter, a process including a time count or a count (hereinafter referred to as a timer / counter process) is performed by using the corresponding logical variable, and The general-purpose processor measures or counts the logical variable by one for each timer / counter process that satisfies the timekeeping or counting condition, and the measured value or count value is preset for the timer / counter process. When the timed value or the counted value is reached, immediately after that, when the dedicated processor is started, Through the physical variable, characterized in that convey the purport of the time expiration or counting expire dedicated processor.

【作用】[Action]

従来のタイマ,カウンタ処理では専用のプロセッサ2
がシーケンスの論理演算処理を行う過程でタイマ,カウ
ンタ命令を見つけるごとに汎用プロセッサ1のタイマ,
カウンタ処理を起動し、専用プロセッサ2の処理と汎用
プロセッサ1の処理が第27図のタイミングチャートのよ
うに入り混じった形で処理されていたのに対して、本発
明では第1図のタイミングチャートに示すように専用プ
ロセッサ2の実行するシーケンス処理とは独立に、かつ
専用プロセッサ2からの割込み要求によらずに、汎用プ
ロセッサ1がタイマ,カウンタ処理をまとめて実行し、
その結果を反映したビットデータに基づいて専用プロセ
ッサ2の論理演算を実行させる。 これにともなって、論理演算とタイマ,カウンタ演算
相互の情報伝達及び本来連続して処理すべき論理演算と
タイマ,カウンタ演算を分離して実行することによって
発生する無駄時間を補償するための補助的な論理変数
(ラダー図上の補助接点)を設け、従来のタイマ,カウ
ンタ命令に代えて専用プロセッサだけで処理できる論理
演算にこの論理変数を組合わせるようにする。
Dedicated processor 2 for conventional timer and counter processing
, A timer of the general-purpose processor 1 every time a counter instruction is found in the process of performing sequence logical operation processing,
The counter processing is started, and the processing of the dedicated processor 2 and the processing of the general-purpose processor 1 are processed in a mixed manner as shown in the timing chart of FIG. 27, whereas in the present invention, the timing chart of FIG. As shown in, the general-purpose processor 1 collectively executes the timer and counter processing independently of the sequence processing executed by the special-purpose processor 2 and independently of the interrupt request from the special-purpose processor 2,
The logical operation of the dedicated processor 2 is executed based on the bit data reflecting the result. Along with this, information is mutually transmitted between the logical operation and the timer / counter operation, and an auxiliary for compensating the dead time generated by separately executing the logical operation and the timer / counter operation that should be continuously processed. A logical variable (auxiliary contact on the ladder diagram) is provided, and this logical variable is combined with a logical operation that can be processed only by a dedicated processor instead of the conventional timer and counter instructions.

【実施例】【Example】

以下第1図ないし第26図に基づいて本発明の実施例を
説明する。本発明のハードウェア上の構成は第25図に示
した従来技術における構成例と同じである。汎用プロセ
ッサ1は制御動作に先立つ前処理として、制御電源投入
直後の初期化処理時、或いはストアード・プログラム方
式のシーケンス処理に対するプログラムのローディング
時に、第26図のようなラダー図で表現されたシーケンス
処理を個々の論理演算命令に対応した専用プロセッサ2
のマシン・コードに翻訳しながらコモンメモリ3へ格納
する。このとき第3図ないし第8図の(A)にそれぞれ
示したオンディレイ・タイマ、オフディレイ・タイマ、
ワンショット・タイマ、リトリガブル・タイマ、アップ
・カウンタおよびダウン・カウンタ(の処理命令)をみ
つけると、この命令部分をそれぞれこの第3図〜第8図
の(B)に点線ブロックで囲んで示した部分ラダー11〜
16に示したような単純な論理演算の組合わせに置換えて
そのマシン・コードをコモンメモリ3へ格納するととも
に、後で汎用プロセッサ1がタイマ,カウンタ処理を専
用プロセッサ2からの割込要求なしでも実行できないよ
うに前記部分ラダー11〜16にそれぞれ対応するタイマ命
令或いはカウンタ命令が使用されていることをメモリ等
に登録する。 次に具体的なカイマ,カウンタの種別ごとにその部分
ラダーの構成とこれに対応する汎用プロセッサの処理を
説明する。 (1)オンディレイ・タイマ: 単一のオンディレイ・タイマ命令に代わって実際に専
用のプロセッサ2が実行する論理演算を第3図の部分ラ
ダー11のような論理演算の組合せに置換えるとともに汎
用プロセッサ1が実行するオンディレイ・タイマ処理を
第9図のフローチャートのように変更する。なお、第3
図および第9図中の符号の意味は次の通りである。 tsn:当該のタイマ(この場合オンディレイ・タイマ)
の設定時限で、当該の部分ラダー(この場合11)の命令
コードに対応して予めコモンメモリ3に設定される値で
ある。 tn:汎用プロセッサ1のタイマ演算中、タイマ演算周
期(タイマベースともいう)Δtごとに更新(この場合
インクリメント)される変数としての計数値である。 Δt:前記のタイマ演算用タイムベースである。 Txn:第3図ではリレーコイルの記号が用いられている
が、ここでは慣習上補助接点と呼ばれる論理変数の1つ
である。この接点データ(論理値)Txnは専用プロセッ
サ2によってコモンメモリ3に書込まれるもので、第9
図の処理では、この論理値Txnが汎用プロセッサ1によ
って参照される。この例ではTxnが“1"(オン)か“0"
(オフ)かに応じて汎用プロセッサ1がタイマ演算を行
うか否かの条件が定められる。 TQn:補助接点と呼ばれる論理変数である。この接点デー
タ(論理値)は汎用プロセッサ1により、当該のタイマ
処理(この例では第9図の処理)の結果としてコモンメ
モリ3に書込まれ、専用プロセッサ2によって参照され
る。なおこの例ではTQnが“0"(オフ)であれば、非計
時または計時満了状態を意味し、TQnが“1"(オン)で
あれば計時満了状態を意味する。 Tn:タイマ出力(接点)と呼ばれる論理変数である。こ
の接点データ(論理値)は専用プロセッサ2により当該
タイマの部分ラダーの演算結果としてコモンメモリ3に
書込まれる。 なお上記の各符号中の添字内のnは当該タイマの番号
を示す。 さて第9図の処理は第1図で示すように周期Δtごと
に起動される専用プロセッサ2のラダー論理演算(第1
図(1))の1回毎に、該ラダー論理演算の起動タイミ
ングτ11とは独立に時点τ10から開始される第1図
(2)の処理内で起動される。第9図においてこのオン
ディレイタイマへの入力に相当する補助接点Txnのオン
→オフの変化に対応して指定された遅延時間tsn後に補
助接点TQnをオンし、補助接点Txnがオフの場合は直ちに
補助接点TQnをオフする。 第15図はこの部分ラダー11の処理を実行させるための
簡単なラダー図を示し、第20図は第15図の動作のタイミ
ングを示す。第20図に示すように、第15図のラダーでは
オンディレイ・タイマの入力接点Aがオンしても補助接
点TQnがオンするまではタイマ出力接点Tnはオフのまま
であって、補助接点TQnのオンで始めてタイマ出力接点T
nがオンする。逆に、タイマ入力接点Aがオフすると補
助接点TQnの状態に関係なくタイマ出力接点Tnはオフす
る。このように汎用プロセッサ1のオンディレイ・タイ
マ処理でオン/オフする補助接点TQnを介在させること
によりオンディレイ・タイマの動作を実現することがで
きる。 オンディレイ・タイマのタイマ時限設定値tsnが0の
ときは補助接点TQnを常にオンさせておくことでタイマ
入力のオン/オフに対して汎用プロセッサ1のソフトウ
ェア処理の介在なしで直ちに追従する。 (2)オフディレイ・タイマ: 単一のオフディレイ・タイマ命令に代わって実際に専
用のプロセッサ2が実行する論理演算を第4図の部分ラ
ダー12のような論理演算の組合せに置換えるとともに汎
用プロセッサ1が実行するオフディレイ・タイマ処理を
第10図のフローチャートのように変更する。なお、第4
図および第10図中の符号の意味は第3図および第9図と
同様である。 この第10図の処理は第9図と同様に専用プロセッサ2
のラダー論理演算の1回毎に、ラダー論理演算の起動タ
イミングとは独立に第1図(2)の処理内で起動され
る。この第10図において、このオフディレイ・タイマ入
力の反転に相当する補助接点Txnのオフ→オンの変化に
対応して指定された遅延時間tsn後に補助接点TQnをオ
ンし、補助接点Txnがオフの場合は直ちに補助接点TQnを
オフする。 第16図はこの部分ラダー12の処理を実行させるための
簡単なラダー図を示し、第21図は第16図の動作のタイミ
ングを示す。第21図に示すように第16図のラダー図では
オフディレイ・タイマの入力接点Aがオンすると補助接
点TQnの状態に関係なくタイマ出力接点Tnはオンにす
る。逆に、入力接点Aがオフしても補助接点TQnがオン
するまではタイマ出力接点Tnはオンのままであって、補
助接点TQnのオンではじめてタイマ出力接点Tnがオフす
る。このように汎用プロセッサ1のオフディレイ・タイ
マ処理でオン/オフする補助接点TQnを介在させること
によりオフディレイ・タイマの動作を実現することがで
きる。 オフディレイ・タイマの時限設定値tsnが0のときは
補助接点TQnを常にオンさせておくことでタイマ入力の
オン/オフに対して汎用プロセッサ1のソフトウェア処
理の介在なしで直ちに追従する。 (3)ワンショット・タイマ(モノステーブル・タイ
マ): 単一のワンショット・タイマ命令に代わって実際に専
用プロセッサ2が実行する論理演算を第5図の部分ラダ
ー13のような論理演算の組合せに置換えるとともに汎用
プロセッサ1が実行するワンショット・タイマ処理を第
11図のフローチャートのように変更する。なお第5図お
よび第11図中の新たな符号の意味は次の通りである。 Tyn:補助接点と呼ばれる論理変数である。この接点デー
タ(論理値)は、この場合、汎用プロセッサ1によって
コモンメモリ3に書込まれるデータであり、このワンシ
ョット・タイマを有効化するか否かの初期条件の設定に
用いられている。 この第11図の処理も、第9図,第10図と同様に第1図
(2)の処理内で起動される。第11図において、このワ
ンショットタイマ出力Tnがオン状態の場合、設定時間t
snの間補助接点TQnをオンする。 第17図はこの部分ラダー13の処理を実行させるための
簡単なラダー図を示し、第22図は第17図の動作のタイミ
ングを示す。第22図に示すように、第17図のラダー図で
はワンショット・タイマの入力接点Aがワンショット・
タイマの起動条件であるオフ→オンの変化を生ずると、
その時の入力Aのオンとその前回値を表す補助接点Txn
(前回値はオフ)の反転xnとの論理積が成立して補助
接点TQnのオン/オフに無関係にタイマ出力接点Tnはオ
ンする。その後は、入力のオフ→オンの変化がない限り
前記の論理積は成立しないが、その反転(オフの反転す
なわちオン)と汎用プロセッサ1のソフトウェアで更新
する補助接点TQnとの論理積によりワンショット・タイ
マのタイマ出力接点Tnのオン/オフが決定される。従っ
て、この状態では補助接点TQnがオンであり続ける限り
出力接点Tnもオンし続ける。 ワンショット・タイマのタイマ時限設定値tsn=0の
場合は補助接点Tynを常にオフとすることで入力のオン
/オフに関係なく出力をオフに保つ。設定時限tsn≠0
の場合は逆に補助接点Tynを常にオンとすることでラダ
ー図後段の論理演算及びソフトウェアによる処理が有効
になるようにする。 (4)リトリガブル・ワンショット・タイマ: 単一のリトリガブル・ワンショット・タイマ命令に代
わって実際に専用プロセッサ2が実行する論理演算を第
6図の部分ラダー14のような論理演算の組合せに置換え
るとともに、汎用プロセッサ1が実行するリトリガブル
・ワンショット・タイマ処理を第12図のフローチャート
のように変更する。なお第6図,第12図中の新たな符号
の意味は次の通りである。 Tyn:補助接点と呼ばれる論理変数である。この接点デー
タ(論理値)は、この場合、専用プロセッサ2によって
書込まれる。 Tzn:補助接点と呼ばれる論理変数であるこの接点データ
(論理値)はこの場合、汎用プロセッサ1によって書込
まれ、このタイマを有効化するか否かの初期条件の設定
に用いられている。 第12図の処理も第1図(2)の処理内で起動される。
この第12図においてタイマ出力Tn及び補助接点Txnのオ
ン/オフに応じて補助接点TQnをオン/オフする。 第18図はこの部分ラダー14の処理を実行させるための
簡単なラダー図を示し、第23図は第18図の動作のタイミ
ングを示す。第23図に示すように、第18図のラダー図で
はリトリガブル・タイマの入力接点Aがリトリガブル・
ショット・タイマの起動条件であるオフ→オンの変化を
生ずると、そのときの入力Aのオンとその前回値を表す
補助接点Tyn(前回値はオフ)の反転ynとの論理積が
成立して補助接点Txnのオンするとともに補助接点TQnの
オン/オフに無関係に出力接点Tnはオンする。その後、
入力のオフ→オンの変化がない限り前記の論理積は成立
しないが汎用プロセッサ1のプログラムで制御する補助
接点TQnがオンし続ける限り、補助接点Tynに相当する論
理値の反転(オフの反転すなわちオン)と補助接点TQn
との論理積により出力接点Tnもオンし続ける。 第12図のフローチャートで示される汎用プロセッサ1
のプログラムではタイマ入力のオフ→オンの変化時のみ
オンとなる補助接点Txnの値に基づいてタイマ入力のオ
フ→オンの変化時にソフトウェアによるタイマ値tnを
0から起算しなおすことでリトリガブル動作を実現す
る。 リトリガブル・タイマのタイマ時限設定値tsn=0の
場合は補助接点Tznを常にオフとすることで入力のオン
/オフに関係なく出力をオフに保つ。設定時限tsn≠0
の場合は逆に補助接点Tznを常にオンとすることでラダ
ー図後段の論理演算およびソフトウェアによる処理が有
効になるようにする。 (5)アップ・カウンタ: 単一のアップ・カウンタ命令に代わって実際に専用プ
ログラム2が実行する論理演算を第7図の部分ラダー15
のような論理演算の組合せに置換えるとともに、汎用プ
ロセッサ1が実行するアップ・カウンタ処理を第13図の
フローチャートのように変更する。 なお第13図中の符号の意味は次の通りである。 CNTsn:カウンタ設定値で、当該の部分ラダー(この場合
15)の命令コードに対応して予め、コモンメモリ3内に
設定される値である。 CNTn:汎用プロセッサ1によるカウンタ計数値(変数)
である。 Cxn,Cyn:補助接点と呼ばれる論理変数で、このデータ
(論理値)は専用プロセッサ2によってコモンメモリ3
に書込まれる。 CQn:補助接点と呼ばれる論理変数で、このデータ(論理
値)は汎用プロセッサ1によってコモンメモリ3に書込
まれる。 Cn:カウンタ出力(接点)と呼ばれる論理変数で、この
接点データ(論理値)は専用プロセッサ2により当該カ
ウンタのラダー論理演算の結果としてコモンメモリ3に
書込まれる。 なおこれらの符号の添字中のnは当該カウンタの番号
を示す。 第13図の処理も第1図(2)の処理内で起動される。
この第13図において、カウンタ入力に相当する補助Cxn
及びリセット入力に相当する補助接点Cnyのオン/オフ
に応じて、補助接点CQnをオン/オフする。 第19図はこの部分ラダー15、および次に述べるダウン
カウンタの部分ラダー16の処理を実行させるための簡単
なラダー図を示し、第24図は第19図の動作のタイミング
を示す。 第24図に示すように、第19図のラダー図ではアップ・
カウンタの入力接点Aがオンで、かつリセット入力点B
がオフであれば、補助接点CQnがオンのときカウンタ出
力接点Cnはオンとなり、一度Cnがオンになると、リセッ
ト入力接点Bがオンにならなり限りカウンタ入力接点A
の状態に関係なくカウンタ出力接点Cnはオン状態を保持
し続ける。カウンタのリセット入力接点Bがオンになる
と、入力接点A及び他の補助接点の状態に関係なくカウ
ンタ出力接点Cnはオフとなる。 第13図のフローチャートで示されるプログラムはカウ
ンタ入力に相当する補助接点Cxnの前回値と今回値とを
比較してカウンタの動作条件である次のオフ→オンの変
化が生ずると、その計数値CNTnを1だけ増加させる。カ
ウンタの計数値CNTnと設定値CNTsnとの比較演算はカウ
ンタ入力A,従って補助接点Cxnがオフの状態で実施し、
カウンタ計数値CNTnが(設定値CNTsn−1)以上の値に
なっていれば補助接点CQnをオンする。その結果、次に
カウンタ入力A,従って補助接点Cxnがオンになったとき
(従って、その直前にカウンタの動作条件であるオフ→
オンの変化が生じている)カウンタのリセット入力B、
従って補助接点Cynがオフである限り、カウンタ入力A
と補助接点CQnとの論理積が成立してカウンタ出力Cnが
オンする。 またカウンタのリセット入力接点Bがオンし、補助接
点Cynがオンすると、第14図のフローチャートで示され
るプログラムはそれまでのカウンタの計数値CNTnを0に
リセットするとともに、補助接点出力CQnをオフする。
このソフトウェア処理は専用プロセッサ2による実際の
論理演算より遅れて実行されるために、このままではシ
ーケンス演算上のリセット条件が成立してから、それが
汎用プロセッサ1のソフトウェアで処理されて補助接点
CQnがオフされ、さらに専用プロセッサ2の論理演算が
行われるまでの無駄時間が生ずるが、第19図のラダー図
においてカウンタ出力接点Cnの論理にリセット入力Bが
含まれていることでソフトウェア処理を待つまでもなく
カウンタ出力Cnは直ちにオフする。 (6)ダウン・カウンタ: 単一のダウン・カウンタ命令に代わって実際に専用プ
ロセッサ2が実行する論理演算を第8図の部分ラダー16
のような論理演算の組合せに置換えるとともに、汎用プ
ロセッサ1が実行するダウン・カウンタ処理を第14図の
フローチャートのように変更する。なお第14図中の符号
の意味は第13図と同様である。タイマ及びカウンタ要素
にかかわる処理を以上のように変更した上で第1図
(2)および(1)に示すようなタイミングでそれぞれ
汎用プロセッサ1によるタイマ・カウンタ処理及び専用
プロセッサ2によるシーケンス論理演算を行う。即ち第
1図(2)の処理内で起動される第14図のプログラムに
おいてカウンタ入力に相当する補助接点Cxn及びリセッ
ト入力に相当する補助接点Cynのオン/オフに応じて、
補助接点CQnをオン/オフする。 前述のように第8図の部分ラダー16の処理を第19図の
ようなラダー図に組込んで実行させた時の動作タイミン
グも第24図で示される。即ち第24図に示すように第19図
のラダー図ではダウン・カウンタの入力接点Aがオンで
かつリセット入力接点Bがオフであれば、補助接点CQn
がオンのときカウンタ出力接点Cnはオンとなり、一度Cn
がオンになると、リセット入力接点Bがオンにならない
限りカウンタ入力接点Aの状態に関係なく、カウンタ出
力接点Cnはオン状態を保持し続ける。カウンタのリセッ
ト入力接点Bがオンになると、入力接点A及び他の補助
接点の状態に関係なくカウンタ出力接点Cnはオフとな
る。 第14図のフローチャートで示されるプログラムはカウ
ンタ入力に相当する補助接点Cxnの前回値と今回値とを
比較してカウンタの動作条件であるオフ→オンの変化が
生ずると、その計数値を1だけ減少させる。カウンタの
計数値CNTnと設定値CNTsnとの比較演算はカウンタ入力
A,従って補助接点Cxnがオフの状態で実施し、カウンタ
計数値CNTnが1以下になっていれば補助接点出力CQnを
オンする。その結果、次にカウンタ入力A,従って補助接
点Cxnがオンになったとき(従って、その間にカウンタ
の動作条件である次のオフ→オンの変化が生じている)
カウンタのリセット入力B、従って補助接点Cynがオフ
である限り、カウンタ入力Aと補助接点CQnとの論理積
が成立してカウンタ出力Cnがオンする。 またカウンタのリセット入力接点Bがオンし、補助接
点Cynがオンすると、第14図のフローチャートで示され
るプログラムはカウンタの計数値CNTnに初期設定値CNTs
nをセットするとともに、補助接点出力CQnをオフする。
このソフトウェア処理は専用プロセッサ2による実際の
論理演算より遅れて実行されるために、このままではシ
ーケンス演算上のリセット条件が成立してから、それが
汎用プロセッサ1のソフトウェアで処理されて補助接点
CQnがオフされ、さらに専用プロセッサ2の論理演算が
行われるまでの無駄時間が生れるが、第19図のラダー図
においてカウンタ出力接点Cnの論理にリセット入力Bが
含まれていることで、ソフトウェア処理を待つまでもな
くカウンタ出力Cnは直ちにオフする。 ところで第1図は第25図のシステムの本発明に基づく
シーケンス処理のタイミングを示している。即ち汎用プ
ロセッサ1はここでタイマ機能を実現するために定周期
Δtで第1図の時点τ10において起動される第1図
(2)のプログラムにおいて、前述の前処理で登録され
ているソフトウェアのタイマ,カウンタ処理、即ち第9
図〜第14図のフローチャートで示した処理を、第2図の
フローチャートに基づいて実施する。 即ち第2図において汎用プロセッサ1は、専用プロセ
ッサ2のラダー演算内に表われる第3図〜第8図の命令
(従って部分ラダー11〜16)の処理に対応して、コモン
メモリ3内の所定領域から第9図〜第14図のプログラム
の実行に必要な設定値としてのタイマ設定値tsn,カウ
ンタ設定値CNTsnを読取ると共に、同じくコモンメモリ
3内における専用プロセッサ2の使用するデータ領域か
ら、第9図〜第14図のプログラムの実行に必要な接点Tx
n,Tn,Cxn,Cynの(入力)データ(論理値)を読取ると
(ステップ201)、この読取られた接点データに関わる
命令に対応して(ステップ202〜207)、この接点データ
を用い、それぞれ第9図〜第14図の演算処理を行い(ス
テップ202A〜207A)、この演算処理の結果としての接点
TQn,Tyn,Tzn,CQnの(出力)データ(論理値)をコモン
メモリ3における専用プロセッサ2の使用データ領域に
書込み(ステップ208),前記のように第1図時点τ11
に専用プロセッサ2に起動信号Strを与えることによ
り、この専用プロセッサ2を起動して、専用プロセッサ
2に第1図(1)のラダー演算を行わせる(ステップ20
9)。 専用プロセッサ2はコモンメモリ3内のマシン・コー
ドに基づいて論理演算を実行するが、このマシン・コー
ドにはタイマ,カウンタ処理に相当する命令が含まれて
いない(つまり該命令コードの代りに部分ラダー11〜16
を表わすマシンコードに置換えられている)ために従来
のような汎用プロセッサ1へのタイマ,カウンタ処理要
求割込みは発生しない。専用プロセッサ2はコモンメモ
リ3内のマシン・コードを全て実行すると第1図時点τ
12において終了割込みを発生して処理が終了した旨を汎
用プロセッサ1へ通知する。 汎用プロセッサ1は前記終了割込みにより第1図
(3)の処理でラダー演算結果に基づいた他の制御演
算、或いは外部への信号出力等を行う。
An embodiment of the present invention will be described below with reference to FIGS. 1 to 26. The hardware configuration of the present invention is the same as the configuration example in the prior art shown in FIG. The general-purpose processor 1 performs the sequence process represented by the ladder diagram as shown in FIG. 26 at the time of initialization process immediately after the control power is turned on or at the time of loading the program for the sequence process of the stored program system as a pre-process prior to the control operation. Dedicated processor 2 for each logical operation instruction
It is stored in the common memory 3 while being translated into the machine code of. At this time, the on-delay timer, the off-delay timer shown in (A) of FIG. 3 to FIG.
When a one-shot timer, a retriggerable timer, an up counter and a down counter (the processing instructions thereof) are found, these instruction parts are shown by enclosing them in dotted lines in FIGS. 3 to 8B. Partial ladder 11 ~
The machine code is stored in the common memory 3 by replacing it with a combination of simple logical operations as shown in 16, and later the general-purpose processor 1 performs timer and counter processing even without an interrupt request from the dedicated processor 2. It is registered in a memory or the like that a timer instruction or a counter instruction corresponding to each of the partial ladders 11 to 16 is used so that it cannot be executed. Next, the configuration of the partial ladder and the processing of the general-purpose processor corresponding thereto will be described for each specific type of counter and counter. (1) On-delay timer: Instead of a single on-delay timer instruction, the logical operation actually executed by the dedicated processor 2 is replaced with a combination of logical operations such as the partial ladder 11 in FIG. The on-delay timer processing executed by the processor 1 is changed as shown in the flowchart of FIG. The third
The meanings of the symbols in the drawings and FIG. 9 are as follows. tsn: Timer concerned (on-delay timer in this case)
Is a value preset in the common memory 3 in correspondence with the instruction code of the partial ladder (11 in this case) in the setting time limit. tn: A count value as a variable that is updated (in this case, incremented) every timer calculation period (also referred to as a timer base) Δt during the timer calculation of the general-purpose processor 1. Δt: Time base for the above-mentioned timer calculation. Txn: Although the symbol of the relay coil is used in FIG. 3, it is one of the logical variables conventionally called auxiliary contact here. This contact data (logical value) Txn is written in the common memory 3 by the dedicated processor 2,
In the process shown in the figure, the logical value Txn is referred to by the general-purpose processor 1. In this example, Txn is "1" (on) or "0"
The condition of whether or not the general-purpose processor 1 performs the timer calculation is determined depending on whether it is off. TQn: A logical variable called auxiliary contact. The contact data (logical value) is written in the common memory 3 by the general-purpose processor 1 as a result of the timer processing (in this example, the processing of FIG. 9), and is referred to by the dedicated processor 2. In this example, when TQn is “0” (off), it means a non-timed state or timed state, and when TQn is “1” (on), it means a timed state. Tn: Logical variable called timer output (contact). The contact data (logical value) is written in the common memory 3 by the dedicated processor 2 as the calculation result of the partial ladder of the timer. It should be noted that n in the subscript in each of the above-mentioned symbols indicates the number of the timer. Now, as shown in FIG. 1, the processing shown in FIG. 9 is performed by the ladder logic operation (first
Each time (1) in FIG. 1 is started within the processing of (2) in FIG. 1 which is started from time τ10 independently of the start timing τ11 of the ladder logic operation. In FIG. 9, the auxiliary contact TQn is turned on after a delay time tsn designated corresponding to the on-off change of the auxiliary contact Txn corresponding to the input to the on-delay timer, and immediately when the auxiliary contact Txn is off. Turns off auxiliary contact TQn. FIG. 15 shows a simple ladder diagram for executing the processing of this partial ladder 11, and FIG. 20 shows the timing of the operation of FIG. As shown in Fig. 20, in the ladder of Fig. 15, even if the input contact A of the on-delay timer is turned on, the timer output contact Tn remains off until the auxiliary contact TQn is turned on, and the auxiliary contact TQn Turn on to start the timer output contact T
n turns on. Conversely, when the timer input contact A turns off, the timer output contact Tn turns off regardless of the state of the auxiliary contact TQn. In this way, the operation of the on-delay timer can be realized by interposing the auxiliary contact TQn which is turned on / off in the on-delay timer processing of the general-purpose processor 1. When the timer time limit setting value tsn of the on-delay timer is 0, the auxiliary contact TQn is always turned on so that the on / off of the timer input is immediately followed without the intervention of software processing of the general-purpose processor 1. (2) Off-delay timer: Instead of a single off-delay timer instruction, the logical operation actually executed by the dedicated processor 2 is replaced with a combination of logical operations such as the partial ladder 12 of FIG. The off-delay timer processing executed by the processor 1 is changed as shown in the flowchart of FIG. The fourth
The meanings of the reference numerals in FIGS. And 10 are the same as those in FIGS. 3 and 9. The processing of FIG. 10 is similar to that of FIG.
Each time the ladder logic operation is performed, the ladder logic operation is activated within the process of FIG. 1 (2) independently of the activation timing of the ladder logic operation. In FIG. 10, the auxiliary contact TQn is turned on after the delay time tsn designated corresponding to the change of the auxiliary contact Txn from OFF to ON corresponding to the inversion of the off-delay timer input, and the auxiliary contact Txn is turned OFF. In that case, the auxiliary contact TQn is turned off immediately. FIG. 16 shows a simple ladder diagram for executing the processing of this partial ladder 12, and FIG. 21 shows the timing of the operation of FIG. As shown in FIG. 21, in the ladder diagram of FIG. 16, when the input contact A of the off-delay timer is turned on, the timer output contact Tn is turned on regardless of the state of the auxiliary contact TQn. On the contrary, even if the input contact A turns off, the timer output contact Tn remains on until the auxiliary contact TQn turns on, and the timer output contact Tn turns off only when the auxiliary contact TQn turns on. In this way, the operation of the off-delay timer can be realized by interposing the auxiliary contact TQn which is turned on / off in the off-delay timer processing of the general-purpose processor 1. When the time set value tsn of the off-delay timer is 0, the auxiliary contact TQn is always turned on so that the on / off of the timer input is immediately followed without the software processing of the general-purpose processor 1. (3) One-shot timer (monostable timer): A combination of logical operations actually executed by the dedicated processor 2 instead of a single one-shot timer instruction, such as the partial ladder 13 in FIG. The one-shot timer processing executed by the general-purpose processor 1
Change as shown in the flowchart in Figure 11. The meanings of the new symbols in FIGS. 5 and 11 are as follows. Tyn: A logical variable called auxiliary contact. In this case, the contact data (logical value) is data written in the common memory 3 by the general-purpose processor 1 and is used to set an initial condition for activating the one-shot timer. The process shown in FIG. 11 is also started in the process shown in FIG. 1 (2) as in FIGS. 9 and 10. In FIG. 11, when the one-shot timer output Tn is in the ON state, the set time t
Auxiliary contact TQn is turned on during sn. FIG. 17 shows a simple ladder diagram for executing the processing of this partial ladder 13, and FIG. 22 shows the timing of the operation of FIG. As shown in FIG. 22, in the ladder diagram of FIG. 17, the input contact A of the one-shot timer is
When a change from off to on, which is the start condition of the timer, occurs,
Auxiliary contact Txn that shows the ON value of input A at that time and its previous value
(The previous value is off) The logical product with the inverted xn is established and the timer output contact Tn turns on regardless of whether the auxiliary contact TQn is on or off. After that, the above logical product is not established unless the input is changed from off to on, but the one-shot is made by the logical product of its inversion (inversion of off, that is, on) and the auxiliary contact TQn updated by the software of the general-purpose processor 1. -ON / OFF of the timer output contact Tn of the timer is determined. Therefore, in this state, as long as the auxiliary contact TQn remains on, the output contact Tn also keeps on. When the timer time limit setting value tsn = 0 of the one-shot timer, the auxiliary contact Tyn is always turned off to keep the output off regardless of the input on / off. Setting time tsn ≠ 0
On the contrary, in the case of 1, the auxiliary contact Tyn is always turned on so that the logical operation in the latter stage of the ladder diagram and the processing by software become effective. (4) Retriggerable one-shot timer: Instead of a single retriggerable one-shot timer instruction, replace the logical operation actually executed by the dedicated processor 2 with a combination of logical operations such as the partial ladder 14 in FIG. In addition, the retriggerable one-shot timer processing executed by the general-purpose processor 1 is changed as shown in the flowchart of FIG. The meanings of the new symbols in FIGS. 6 and 12 are as follows. Tyn: A logical variable called auxiliary contact. This contact data (logical value) is written by the dedicated processor 2 in this case. In this case, this contact data (logical value), which is a logical variable called Tzn: auxiliary contact, is written by the general-purpose processor 1 and is used for setting an initial condition for activating this timer. The process of FIG. 12 is also activated within the process of FIG. 1 (2).
In FIG. 12, the auxiliary contact TQn is turned on / off according to ON / OFF of the timer output Tn and the auxiliary contact Txn. FIG. 18 shows a simple ladder diagram for executing the processing of this partial ladder 14, and FIG. 23 shows the timing of the operation of FIG. As shown in FIG. 23, in the ladder diagram of FIG. 18, the input contact A of the retriggerable timer is retriggerable.
When there is a change from off to on, which is the shot timer activation condition, the logical product of the on of the input A at that time and the inversion yn of the auxiliary contact Tyn (the previous value is off) representing the previous value is established. When the auxiliary contact Txn is turned on, the output contact Tn is turned on regardless of whether the auxiliary contact TQn is turned on or off. afterwards,
The above logical product does not hold unless the input changes from OFF to ON, but as long as the auxiliary contact TQn controlled by the program of the general-purpose processor 1 continues to be ON, the inversion of the logical value corresponding to the auxiliary contact Tyn (inversion of OFF, that is, ON) and auxiliary contact TQn
The output contact Tn also keeps on due to the logical product of and. General-purpose processor 1 shown in the flowchart of FIG.
In this program, the retriggerable operation is realized by restarting the timer value tn from 0 when the timer input turns off → on, based on the value of the auxiliary contact Txn that turns on only when the timer input turns off → on To do. When the timer time limit setting value tsn = 0 of the retriggerable timer, the auxiliary contact Tzn is always turned off to keep the output off regardless of the input on / off. Setting time tsn ≠ 0
In the case of 1, on the contrary, the auxiliary contact Tzn is always turned on so that the logical operation in the latter stage of the ladder diagram and the processing by software become effective. (5) Up counter: The partial ladder 15 of FIG. 7 is used to execute the logical operation actually executed by the dedicated program 2 in place of a single up counter instruction.
In addition to replacing the combination of logical operations as shown in (1), the up-counter processing executed by the general-purpose processor 1 is changed as shown in the flowchart of FIG. The meanings of the symbols in FIG. 13 are as follows. CNTsn: Counter setting value, corresponding partial ladder (in this case,
It is a value preset in the common memory 3 corresponding to the instruction code of 15). CNTn: Counter count value (variable) by general-purpose processor 1
It is. Cxn, Cyn: Logical variable called auxiliary contact, and this data (logical value) is shared by common processor 3 by dedicated processor 2.
Is written to. CQn: A logical variable called auxiliary contact, and this data (logical value) is written in the common memory 3 by the general-purpose processor 1. Cn is a logical variable called a counter output (contact), and this contact data (logical value) is written in the common memory 3 by the dedicated processor 2 as a result of the ladder logical operation of the counter. Note that n in the subscripts of these symbols indicates the number of the counter. The process of FIG. 13 is also activated within the process of FIG. 1 (2).
In FIG. 13, the auxiliary Cxn corresponding to the counter input
Also, the auxiliary contact CQn is turned on / off according to on / off of the auxiliary contact Cny corresponding to the reset input. FIG. 19 shows a simple ladder diagram for executing the processing of this partial ladder 15 and the partial ladder 16 of the down counter described below, and FIG. 24 shows the timing of the operation of FIG. As shown in Figure 24, the ladder diagram in Figure 19 shows
Counter input contact A is on and reset input point B
If is off, the counter output contact Cn is turned on when the auxiliary contact CQn is turned on, and once Cn is turned on, the reset input contact B is turned on as long as the counter input contact A is turned on.
The counter output contact Cn keeps the ON state regardless of the state of. When the reset input contact B of the counter is turned on, the counter output contact Cn is turned off regardless of the states of the input contact A and other auxiliary contacts. The program shown in the flowchart of FIG. 13 compares the previous value and the current value of the auxiliary contact Cxn corresponding to the counter input, and when the next change from OFF to ON, which is the operating condition of the counter, occurs, the count value CNTn Is incremented by 1. The comparison calculation of the count value CNTn of the counter and the set value CNTsn is performed with the counter input A, and therefore the auxiliary contact Cxn turned off,
If the counter count value CNTn is greater than or equal to the (set value CNTsn-1), the auxiliary contact CQn is turned on. As a result, the next time the counter input A, and hence the auxiliary contact Cxn, turns on (therefore, immediately before that, the counter operating condition of OFF →
The reset input B of the counter is being changed,
Therefore, as long as auxiliary contact Cyn is off, counter input A
And the auxiliary contact CQn are ANDed, and the counter output Cn turns on. When the reset input contact B of the counter is turned on and the auxiliary contact Cyn is turned on, the program shown in the flowchart of FIG. 14 resets the count value CNTn of the counter up to that point to 0 and turns off the auxiliary contact output CQn. .
Since this software processing is executed later than the actual logical operation by the dedicated processor 2, if the reset condition in the sequence operation is satisfied as it is, it is processed by the software of the general-purpose processor 1 and the auxiliary contact is performed.
Although there is a dead time until CQn is turned off and the logical operation of the dedicated processor 2 is performed, software processing is performed because the logic of the counter output contact Cn in the ladder diagram of FIG. 19 includes the reset input B. The counter output Cn turns off immediately without waiting. (6) Down counter: Instead of a single down counter instruction, the logical operation actually executed by the dedicated processor 2 is executed by the partial ladder 16 in FIG.
In addition to replacing the combination of logical operations as described above, the down counter processing executed by the general-purpose processor 1 is changed as shown in the flowchart of FIG. The meanings of the reference numerals in FIG. 14 are the same as in FIG. After changing the processes related to the timer and counter elements as described above, the timer / counter process by the general-purpose processor 1 and the sequence logical operation by the dedicated processor 2 are performed at the timings shown in FIGS. 1 (2) and (1), respectively. To do. That is, in the program of FIG. 14 started in the process of FIG. 1 (2), depending on ON / OFF of the auxiliary contact Cxn corresponding to the counter input and the auxiliary contact Cyn corresponding to the reset input.
Turns auxiliary contact CQn on / off. FIG. 24 also shows the operation timing when the processing of the partial ladder 16 of FIG. 8 is incorporated into the ladder diagram of FIG. 19 and executed as described above. That is, as shown in FIG. 24, in the ladder diagram of FIG. 19, if the input contact A of the down counter is on and the reset input contact B is off, the auxiliary contact CQn
Is ON, the counter output contact Cn turns ON and once Cn
When the reset input contact B is turned on, the counter output contact Cn continues to hold the on state regardless of the state of the counter input contact A. When the reset input contact B of the counter is turned on, the counter output contact Cn is turned off regardless of the states of the input contact A and other auxiliary contacts. The program shown in the flowchart of FIG. 14 compares the previous value of the auxiliary contact Cxn corresponding to the counter input with the current value, and when the counter operating condition changes from OFF to ON, the count value is incremented by 1 Reduce. Counter input is used for comparison calculation of the count value CNTn of the counter and the set value CNTsn
A, therefore, the auxiliary contact Cxn is turned off, and if the counter count value CNTn is 1 or less, the auxiliary contact output CQn is turned on. As a result, when the counter input A, and thus the auxiliary contact Cxn, is turned on next time (therefore, the next change from OFF to ON, which is the operating condition of the counter, occurs during that time)
As long as the reset input B of the counter, and thus the auxiliary contact Cyn, is off, the logical product of the counter input A and the auxiliary contact CQn is established and the counter output Cn is turned on. When the reset input contact B of the counter is turned on and the auxiliary contact Cyn is turned on, the program shown in the flowchart of FIG. 14 sets the count value CNTn of the counter to the initial setting value CNTs.
Set n and turn off auxiliary contact output CQn.
Since this software processing is executed later than the actual logical operation by the dedicated processor 2, if the reset condition in the sequence operation is satisfied as it is, it is processed by the software of the general-purpose processor 1 and the auxiliary contact is performed.
Although a dead time is generated until CQn is turned off and the logical operation of the dedicated processor 2 is performed, the reset input B is included in the logic of the counter output contact Cn in the ladder diagram of FIG. The counter output Cn is immediately turned off without waiting for processing. By the way, FIG. 1 shows the timing of the sequence processing according to the present invention in the system of FIG. That is, the general-purpose processor 1 executes the timer of the software registered in the above-mentioned preprocessing in the program of FIG. 1 (2) which is started at the time τ10 of FIG. 1 at the constant period Δt to realize the timer function. , Counter processing, ie 9th
The processing shown in the flowcharts of FIGS. 1 to 14 is executed based on the flowchart of FIG. That is, in FIG. 2, the general-purpose processor 1 corresponds to the processing of the instructions of FIGS. 3 to 8 (hence the partial ladders 11 to 16) appearing in the ladder operation of the dedicated processor 2 in accordance with the predetermined processing in the common memory 3. The timer set value tsn and the counter set value CNTsn as the set values necessary for executing the programs of FIGS. 9 to 14 are read from the area, and the data is used from the data area used by the dedicated processor 2 in the common memory 3 as well. Contact point Tx required to execute the programs in Figures 9 to 14
When the (input) data (logical value) of n, Tn, Cxn, Cyn is read (step 201), the contact data is used in correspondence with the command related to the read contact data (steps 202 to 207), The calculation processing of FIG. 9 to FIG. 14 is performed (steps 202A to 207A), respectively, and the contact point as a result of this calculation processing.
The (output) data (logical value) of TQn, Tyn, Tzn, and CQn is written in the used data area of the dedicated processor 2 in the common memory 3 (step 208).
The start signal Str is given to the dedicated processor 2 to start the dedicated processor 2 and cause the dedicated processor 2 to perform the ladder operation of FIG. 1 (1) (step 20).
9). The dedicated processor 2 executes a logical operation based on the machine code in the common memory 3, but this machine code does not include an instruction corresponding to the timer and counter processing (that is, a partial code is used instead of the instruction code). Ladder 11-16
Since it has been replaced with a machine code representing the above), a timer and counter processing request interrupt to the general-purpose processor 1 as in the prior art does not occur. When the dedicated processor 2 executes all the machine code in the common memory 3, the time point τ in FIG.
At 12, an end interrupt is generated to notify the general-purpose processor 1 that the processing has ended. The general-purpose processor 1 performs another control calculation based on the result of the ladder calculation or a signal output to the outside by the processing of FIG.

【発明の効果】【The invention's effect】

本発明によれば、 専用プロセッサ2が実行するラダー演算中における各
種のタイマまたはカウンタの処理命令を、それぞれこの
処理命令に対応した所定の論理変数Txn〜Tzn,TQn,Tn,Cx
n,Cyn,CQn,Cnを含んだ部分ラダー11〜16に基づく部分的
なラダー演算に置換え、専用プロセッサ2が、この論理
変数を読み書きしつつ、汎用プロセッサ1に対し少なく
とも前記タイマまたはカウンタの処理命令に関わる割込
処理を要求することなく、汎用プロセッサ1の起動に基
づくラダー演算をその終了まで実行するようにし、 汎用プロセッサ1は少なくとも専用プロセッサ2のラ
ダー演算の終了後から次回の専用プロセッサ2の起動ま
での間に、前記タイマまたはカウンタの処理命令に対応
し、それぞれ当該の前記論理変数を用い、計時または計
数を含む所定のタイマ・カウンタ処理を行うようにした
ので、 従来、タイマ,カウンタ命令の1命令実行毎に専用プ
ロセッサから汎用プロセッサへ処理を移動するための割
込処理にともなって発生していたオーバヘッドがなくな
る。 ただし単一のタイマ,カウンタ命令を複数の論理演算
の組合わせとすることで専用プロセッサの演算処理は増
加するが、専用プロセッサの稼動中も汎用プロセッサは
他のプログラム処理を行えることや、専用プロセッサと
汎用プロセッサとの間の処理の移動による無駄時間が無
くなることを考えれば無視できる増加である。加えて、
実際に汎用プロセッサがソフトウェアで実行するタイ
マ,カウンタ処理は従来のものと殆んど変わらないか
ら、全体として汎用プロセッサの負荷は大きく軽減さ
れ、処理のスループットも大幅に向上する。さらに従来
のシステムに対して本発明を実施する場合は汎用プロセ
ッサのソフトウェア処理を変更するだけでよく専用プロ
セッサ機能をはじめとしてハードウェア上の変更は一切
生じないことから容易かつ安価に実現できる。
According to the present invention, the processing instructions of various timers or counters during the ladder operation executed by the dedicated processor 2 are respectively assigned to the predetermined logical variables Txn to Tzn, TQn, Tn, Cx corresponding to the processing instructions.
Substituting partial ladder operations based on partial ladders 11 to 16 including n, Cyn, CQn, and Cn, the dedicated processor 2 reads and writes this logical variable, and at least processes the timer or counter with respect to the general-purpose processor 1. The ladder operation based on the activation of the general-purpose processor 1 is executed until the end thereof without requesting the interrupt processing related to the instruction, and the general-purpose processor 1 at least after the completion of the ladder operation of the special-purpose processor 2 Before the activation of the timer or counter, the corresponding logical variable is used to perform predetermined timer / counter processing including time counting or counting. Occurs with interrupt processing for moving the processing from the dedicated processor to the general-purpose processor each time one instruction is executed. Which it was overhead is eliminated. However, by combining a single timer or counter instruction with multiple logical operations, the arithmetic processing of the dedicated processor increases, but the general-purpose processor can perform other program processing while the dedicated processor is operating, and This is a negligible increase considering that there is no dead time due to movement of processing between the general-purpose processor and the general-purpose processor. in addition,
Actually, the timer and counter processing executed by software by the general-purpose processor is almost the same as the conventional one, so that the load on the general-purpose processor is greatly reduced as a whole, and the processing throughput is also greatly improved. Further, when the present invention is applied to the conventional system, it is only necessary to change the software processing of the general-purpose processor, and no hardware change such as the dedicated processor function occurs.

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

第1図は本発明の一実施例としての、専用プロセッサの
ラダー演算と,汎用プロセッサのタイマ,カウンタ処理
との相互のタイミング関係を示すタイムチャート、 第2図は同じく汎用プロセッサのタイマ,カウンタ処理
の手順を示すフローチャート、 第3図ないし第8図は同じく各種のタイマ,カウンタ命
令に置換わる部分ラダーを示す図、 第9図ないし第14図は同じくそれぞれ第3図ないし第8
図の部分ラダーに対応して汎用プロセッサが実行するタ
イマ,カウンタ処理の手順を示すフローチャート、 第15図ないし第19図は第3図ないし第8図の部分ラダー
の処理を行わせるためのラダー図、 第20図ないし第24図はそれぞれ第15図ないし第19図の動
作を示すタイムチャート、 第25図は本発明および従来のシステム構成例を示す図、 第26図はラダー図の一例を示す図、 第27図は第1図に対応する従来のタイムチャート、 第28図は第2図に対応する従来のフローチャートであ
る。 1:汎用プロセッサ、2:専用プロセッサ、3:コモンメモ
リ、4:入力インタフェイス、5:出力インタフェース、6:
データ・アドレスバス、Str:起動記号、11〜16:部分ラ
ダー、Txn〜Tzn,TQn,Tn,Cxn,Cyn,CQn,Cn:接点(論理変
数)。
FIG. 1 is a time chart showing a mutual timing relationship between a ladder operation of a dedicated processor and a timer / counter processing of a general-purpose processor as an embodiment of the present invention, and FIG. 2 is a timer / counter processing of the same general-purpose processor. FIG. 3 to FIG. 8 are diagrams showing partial ladders to be replaced with various timer and counter instructions, and FIG. 9 to FIG. 14 are also FIG. 3 to FIG. 8 respectively.
A flowchart showing the procedure of the timer and counter processing executed by the general-purpose processor corresponding to the partial ladder in the figure, and FIGS. 15 to 19 are ladder diagrams for causing the processing of the partial ladder in FIGS. 3 to 8 to be performed. 20 to 24 are time charts showing the operations of FIGS. 15 to 19, respectively, FIG. 25 is a diagram showing an example of the system configuration of the present invention and the conventional system, and FIG. 26 is an example of a ladder diagram. FIG. 27 is a conventional time chart corresponding to FIG. 1, and FIG. 28 is a conventional flow chart corresponding to FIG. 1: General-purpose processor, 2: Dedicated processor, 3: Common memory, 4: Input interface, 5: Output interface, 6:
Data / address bus, Str: start symbol, 11 to 16: partial ladder, Txn to Tzn, TQn, Tn, Cxn, Cyn, CQn, Cn: contact (logical variable).

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】コモンメモリを読み書きしつつシーケンス
制御プログラムとしてのラダー演算を実行し、タイマ,
カウンタの処理に必要な計時,計数機能を持たない専用
プロセッサと、外部の被制御機器と交信しつつコモンメ
モリを介して専用プロセッサとデータを授受して専用プ
ロセッサにラダー演算を行わせる汎用プロセッサと備
え、 専用プロセッサが実行するラダー演算中における各種の
タイマ又はカウンタの処理命令を、それぞれこの処理命
令に対応した論理変数を含んだ部分的なラダー演算に置
換え、 専用プロセッサは、この論理変数を読み書きしつつ、汎
用プロセッサに対して少なくともタイマ又はカウンタの
処理命令に関する割込処理を要求することなく、汎用プ
ロセッサの起動に基づくラダー演算をその終了まで実行
し、 汎用プロセッサは、少なくとも専用プロセッサのラダー
演算の終了から次回の専用プロセッサの起動までの間
に、タイマ又はカウンタの処理命令に対応して、それぞ
れ当該の前記論理変数を用いて、計時又は計数を含む処
理(以下タイマ・カウンタ処理という)を行い、そして 汎用プロセッサは、当該の前記論理変数を計時又は計数
条件を満たすタイマ・カウンタ処理ごとに1つづつ計時
又は計数を行い、この計時値又は計数値が当該タイマ・
カウンタ処理に対して予め設定された計時値又は計数値
に到達したら、その直後における専用プロセッサの起動
時に、当該論理変数を介して計時満了又は計数満了の旨
を専用プロセッサに伝えることを特徴とするシーケンス
処理におけるタイマ,カウンタの処理方法。
1. A ladder operation as a sequence control program is executed while reading and writing a common memory, a timer,
A dedicated processor that does not have the timekeeping and counting functions required for counter processing, and a general-purpose processor that communicates with external controlled devices and exchanges data with the dedicated processor via a common memory to allow the dedicated processor to perform ladder operations. The dedicated processor replaces the processing instructions of various timers or counters during the ladder operation executed by the dedicated processor with a partial ladder operation including the logical variable corresponding to the processing instruction, and the dedicated processor reads and writes this logical variable. At the same time, the ladder operation based on the start-up of the general-purpose processor is executed until the end without requesting the general-purpose processor at least for the interrupt processing related to the processing instruction of the timer or the counter. Between the end of and the next startup of the dedicated processor, Corresponding to the processing instruction of the imager or the counter, the corresponding logical variable is used to perform a process including time counting or counting (hereinafter referred to as a timer / counter process), and the general-purpose processor measures the logical variable. Alternatively, each timer / counter processing that satisfies the counting condition measures or counts one by one, and this measured value or count value
When reaching a preset time value or count value for the counter processing, when the dedicated processor is started immediately after that, the fact that the time has expired or the count has expired is transmitted to the special processor via the logical variable. How to process timers and counters in sequence processing.
JP21776889A 1989-08-24 1989-08-24 Processing method of timer and counter in sequence processing Expired - Lifetime JP2671517B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP21776889A JP2671517B2 (en) 1989-08-24 1989-08-24 Processing method of timer and counter in sequence processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP21776889A JP2671517B2 (en) 1989-08-24 1989-08-24 Processing method of timer and counter in sequence processing

Publications (2)

Publication Number Publication Date
JPH0380304A JPH0380304A (en) 1991-04-05
JP2671517B2 true JP2671517B2 (en) 1997-10-29

Family

ID=16709430

Family Applications (1)

Application Number Title Priority Date Filing Date
JP21776889A Expired - Lifetime JP2671517B2 (en) 1989-08-24 1989-08-24 Processing method of timer and counter in sequence processing

Country Status (1)

Country Link
JP (1) JP2671517B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7024495B2 (en) 2001-03-30 2006-04-04 Omron Corporation Programmable controller

Also Published As

Publication number Publication date
JPH0380304A (en) 1991-04-05

Similar Documents

Publication Publication Date Title
JPH0454255B2 (en)
JPH02156334A (en) Information processor
JP2671517B2 (en) Processing method of timer and counter in sequence processing
CA1323703C (en) Programmable logic controller including a function block processor and a bit processor
US20030172215A1 (en) Interrupt- controller
JP3715328B2 (en) Data processing device
US5124620A (en) Control method for robots
JPH03288906A (en) Instruction executing system for pc
JPS6349941A (en) Arithmetic processing unit
JPH10326199A (en) Interruption synchronizing device in dual system
JP2522401B2 (en) Programmable controller
JP2844624B2 (en) Data processing device
JP2508026B2 (en) Timer control method
JPH02250122A (en) Cpu simulator
JPS6128144A (en) Executing device of tracing
JPS6120139A (en) Interruption control system
JPH0392904A (en) Programmable controller
JPH0553831A (en) Computer unit with interrupting function
JPS63104145A (en) Timer interruption processing method
JP2517943B2 (en) Timer device
JPH0462093B2 (en)
JPS6230452B2 (en)
JPH03182945A (en) Transfer system for data in main storage
JPH04167042A (en) Asynchronous input/output system
JPS6349942A (en) Arithmetic processing unit