Nothing Special   »   [go: up one dir, main page]

JPH1165623A - Programmable controller - Google Patents

Programmable controller

Info

Publication number
JPH1165623A
JPH1165623A JP22352597A JP22352597A JPH1165623A JP H1165623 A JPH1165623 A JP H1165623A JP 22352597 A JP22352597 A JP 22352597A JP 22352597 A JP22352597 A JP 22352597A JP H1165623 A JPH1165623 A JP H1165623A
Authority
JP
Japan
Prior art keywords
transmission
request
reception
task
processing
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
JP22352597A
Other languages
Japanese (ja)
Inventor
Koichi Masuda
晃一 増田
Hiroyoshi Takeuchi
弘好 竹内
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.)
Denso Corp
Original Assignee
Denso 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 Denso Corp filed Critical Denso Corp
Priority to JP22352597A priority Critical patent/JPH1165623A/en
Publication of JPH1165623A publication Critical patent/JPH1165623A/en
Pending legal-status Critical Current

Links

Landscapes

  • Programmable Controllers (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a programmable controller in which a data link request can be exactly processed, and the well-balanced processing of each interruption processing request can be attained. SOLUTION: When a data link request from an outside programmable controller(PC) is generated during the execution of a scan cycle by the PC, a reception handler successively sets the reception request in a reception queue, and when a data link request to the outside PC is requested from the PC, a transmission handler successively sets the transmission request in a transmission queue. Then, an OS(operating system) task controlling part executes a data link cycle for activating a responding task for processing the reception request set in the reception queue, and activating a transmitting task for processing the transmission request set in the transmission queue after the execution of the scan cycle.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、入力スキャン,プ
ログラムスキャン及び出力スキャンからなるスキャンサ
イクルをプロセッサに繰返し実行させることによって、
外部に接続された制御対象を制御するプログラマブルコ
ントローラに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method of causing a processor to repeatedly execute a scan cycle including an input scan, a program scan, and an output scan.
The present invention relates to a programmable controller that controls an externally connected control target.

【0002】[0002]

【発明が解決しようとする課題】プログラマブルコント
ローラ(以下、PCと称す)のプロセッサは、上記のス
キャンサイクルを繰返し実行している間に、一定時間毎
に発生する割込みプログラムの処理要求や、I/O割込
み要求、他のPCからのデータリンク要求、などの各種
割込み処理要求を受け付けるようになっている。
A processor of a programmable controller (hereinafter, referred to as a PC) requests a processing request of an interrupt program generated at regular time intervals during a repetitive execution of the above-described scan cycle, and a request for I / O. Various interrupt processing requests such as an O interrupt request and a data link request from another PC are received.

【0003】これら各種の割込み処理要求には、割込み
が競合した場合に対処できるように予め優先順位が設定
されている。そして、プロセッサは、割込み処理要求を
受け付けると、当該割込み処理要求の優先順位と現在行
っている処理タスクの優先順位とを比較して、前者の優
先順位が高ければ後者の処理タスクを中断し、前者の処
理タスクを優先的に実行するようになっている。
[0003] The priorities of these various interrupt processing requests are set in advance so as to cope with a conflict between interrupts. Then, when the processor receives the interrupt processing request, the processor compares the priority of the interrupt processing request with the priority of the currently performed processing task, and suspends the latter processing task if the former has a higher priority, The former processing task is executed preferentially.

【0004】しかし、この様な割込み処理方式では、優
先順位の高い割込み処理要求が連続的に多数発生した時
には、優先順位の低い割込み処理要求の処理が著しく遅
延することがある。そして、その処理要求が何らかの機
能を同時に作動させる目的を有するものである場合は、
当該目的の達成が保証されなくなるという問題があっ
た。
However, in such an interrupt processing method, when a large number of interrupt processing requests having a high priority are continuously generated, the processing of interrupt processing requests having a low priority may be significantly delayed. And if the processing request has the purpose of simultaneously operating some functions,
There has been a problem that the achievement of the purpose cannot be guaranteed.

【0005】斯様な問題を解決するため、例えば、特開
平3−282903号公報に開示されているように、デ
ータリンク要求を処理するタスクを優先して実行させ、
その実行中に発生した他の割込み処理要求を実行待ち状
態にして、データリンクタスクの実行後に、実行待ち状
態になっている割込み処理タスクを、割込みの種類毎に
各1個ずつ処理するようにしたものがある。
[0005] In order to solve such a problem, for example, as disclosed in Japanese Patent Laid-Open No. 3-282903, a task for processing a data link request is preferentially executed,
The other interrupt processing requests generated during the execution are put into an execution waiting state, and after the data link task is executed, the interrupt processing tasks in the execution waiting state are processed one by one for each type of interrupt. There is something.

【0006】しかしながら、上記の割込み処理方式にお
いては、データリンク要求が所定時間内に大量に発生し
た場合は、発生したデータリンク要求を全部処理しない
限り、その他の割込み処理要求は処理が開始されないこ
とになる。即ち、この方式では、データリンク要求が発
生する頻度よりもその他の処理要求が発生する頻度が高
いということを前提としており、その前提が維持されな
ければ、一部の処理要求は滞りを生じることになるとい
う問題がある。
However, in the above interrupt processing method, when a large number of data link requests are generated within a predetermined time, the processing of other interrupt processing requests is not started unless all generated data link requests are processed. become. In other words, this method assumes that the frequency of other processing requests is higher than the frequency of data link requests. If this assumption is not maintained, some processing requests may be delayed. Problem.

【0007】本発明は上記事情に鑑みてなされたもので
あり、その目的は、データリンク要求を確実に処理する
と共に、各割込み処理要求をもバランス良く処理するこ
とが可能なプログラマブルコントローラを提供すること
にある。
The present invention has been made in view of the above circumstances, and an object of the present invention is to provide a programmable controller capable of reliably processing a data link request and processing each interrupt processing request in a well-balanced manner. It is in.

【0008】[0008]

【課題を解決するための手段】請求項1記載のプログラ
マブルコントローラによれば、プロセッサによるスキャ
ンサイクルの実行中に外部装置からのデータリンク要求
が発生すると、受信キューセット手段は、当該受信要求
を受信キューに順次セットし、また、外部装置に対する
データリンク要求が発生すると、送信キューセット手段
は、当該送信要求を送信キューに順次セットする。そし
て、リンクサイクル実行手段は、プロセッサによるスキ
ャンサイクルの実行後に、受信キューにセットされてい
る受信要求を処理する応答タスクを起動すると共に、前
記送信キューにセットされている送信要求を処理する送
信タスクを起動するデータリンクサイクルをプロセッサ
に実行させる。
According to the programmable controller of the present invention, when a data link request from an external device occurs during the execution of a scan cycle by the processor, the reception queue setting means receives the reception request. When a data link request to an external device occurs, the transmission queue setting means sequentially sets the transmission request in the transmission queue. The link cycle execution means activates a response task for processing the reception request set in the reception queue after the processor executes the scan cycle, and also executes a transmission task for processing the transmission request set in the transmission queue. Causes the processor to execute a data link cycle that activates

【0009】従って、スキャンサイクルの実行中に発生
したデータリンク要求は、当該スキャンサイクルの実行
後に確実に処理されるので、従来とは異なり、データリ
ンク性能が大きく劣化することがなく、一定の応答性能
を維持することができる。逆に、スキャンサイクルの実
行中に発生する他の割込み処理も、データリンク要求の
処理によって妨げられることがないので、リアルタイム
で処理することが望ましい割込み処理に対する応答性を
も良好にし得て、各割込み処理要求をバランス良く処理
することができる。
Accordingly, a data link request generated during the execution of a scan cycle is reliably processed after the execution of the scan cycle. Performance can be maintained. Conversely, other interrupt processing that occurs during the execution of the scan cycle is not hindered by the processing of the data link request, so that it is possible to improve the responsiveness to the interrupt processing that is desirably performed in real time. Interrupt processing requests can be processed in a well-balanced manner.

【0010】請求項2記載のプログラマブルコントロー
ラによれば、リンクサイクル実行手段によって起動され
る応答タスク及び送信タスクは、1回の起動時にプロセ
ッサに処理させる受信要求及び送信要求の数に制限を設
けるので、データリンクサイクルの実行時間を制限する
ことによって、各割込み処理要求を一層バランス良く処
理することができる。
According to the second aspect of the present invention, the response task and the transmission task started by the link cycle execution means limit the number of reception requests and transmission requests to be processed by the processor at one start. By limiting the execution time of the data link cycle, each interrupt processing request can be processed in a more balanced manner.

【0011】[0011]

【発明の実施の形態】以下、本発明の一実施例について
図面を参照して説明する。図6は、ラックの各スロット
にセットされたプログラマブルコントローラ(以下、P
Cと称す)及びその他のユニットのI/O構成例を示す
ものである。ラック1の左端には、各ユニットに電源を
供給する電源ユニット2が配置されている。そして、そ
の隣のスロット0にはPC3が配置され、以降のスロッ
ト1,2及び3には、夫々入力ユニット4,出力ユニッ
ト5及び通信ユニット6が配置されている。
DESCRIPTION OF THE PREFERRED EMBODIMENTS One embodiment of the present invention will be described below with reference to the drawings. FIG. 6 shows a programmable controller (hereinafter referred to as P) set in each slot of the rack.
C) and I / O configuration examples of other units. At the left end of the rack 1, a power supply unit 2 for supplying power to each unit is arranged. The PC 3 is arranged in the slot 0 adjacent thereto, and the input unit 4, the output unit 5 and the communication unit 6 are arranged in the subsequent slots 1, 2, and 3, respectively.

【0012】入力ユニット4は、図示しないリレーから
PC3に対してデータを入力するためのユニットであ
り、出力ユニット5は、逆に、PC3からリレーに対し
てデータを出力するユニットである。また、通信ユニッ
ト6は、PC3とその他のPCとの通信を行うためのユ
ニットである。
The input unit 4 is a unit for inputting data from a relay (not shown) to the PC 3, and the output unit 5 is a unit for outputting data from the PC 3 to the relay. The communication unit 6 is a unit for performing communication between the PC 3 and another PC.

【0013】図7は、PC3の電気的構成を示す機能ブ
ロック図である。この図5において、汎用CPU(プロ
セッサ,以下、単にCPUと称す)7及びビット演算プ
ロセッサ(プロセッサ,以下、単に演算プロセッサと称
す)8は、ROM9,RAM10及びI/Oインターフ
ェイス11に、アドレス及びデータバス並びに制御信号
線などからなるバス12を介して接続されている。
FIG. 7 is a functional block diagram showing an electrical configuration of the PC 3. As shown in FIG. In FIG. 5, a general-purpose CPU (processor, hereinafter simply referred to as CPU) 7 and a bit operation processor (hereinafter, simply referred to as operation processor) 8 store addresses and data in ROM 9, RAM 10 and I / O interface 11. They are connected via a bus 12 including a bus and control signal lines.

【0014】ROM9には、後述する受信ハンドラ(受
信キューセット手段)9a,送信ハンドラ(送信キュー
セット手段)9b,応答タスク9c,送信タスク9d及
びタイムオーバ監視タスク(以下、監視タスクと称す)
9eなどの各タスクのプログラムや、それら各タスクを
制御するタスク制御部(スキャンサイクル実行手段,リ
ンクサイクル実行手段)9fのプログラムなどがオペレ
ーティングシステム(以下、OSと称す)として格納さ
れている(図8(b)参照)。
The ROM 9 has a reception handler (reception queue setting means) 9a, a transmission handler (transmission queue setting means) 9b, a response task 9c, a transmission task 9d, and a time-out monitoring task (hereinafter referred to as a monitoring task).
A program for each task such as 9e and a program for a task control unit (scan cycle execution means, link cycle execution means) 9f for controlling each task are stored as an operating system (hereinafter referred to as OS) (FIG. 8 (b)).

【0015】RAM10には、ユーザが作成したシーケ
ンスプログラム(ユーザプログラム)が格納されると共
に、後述する受信キュー10a及び送信キュー10bの
領域が確保されている(図8(a)参照)。また、I/
Oインターフェイス11は、ラック1の図示しないバッ
クプレーンに設けられているシステムバス13を介し
て、PC3と各ユニット4〜6とを接続するものであ
る。
The RAM 10 stores a sequence program (user program) created by a user, and secures areas for a reception queue 10a and a transmission queue 10b, which will be described later (see FIG. 8A). Also, I /
The O interface 11 connects the PC 3 and each of the units 4 to 6 via a system bus 13 provided on a back plane (not shown) of the rack 1.

【0016】演算プロセッサ8は、シーケンスプログラ
ム中の基本命令(ビット演算,ワード加減算,ワード論
理演算など)のみを実行するようになっている。CPU
7は、プログラムの実行前に後述するように前処理を行
うと共に、プログラム中の応用命令(ワード乗除算,分
岐,ロングワード四則演算及び論理演算などの、演算プ
ロセッサ8では実行できない命令)を実行するようにな
っている。また、CPU7は、入力,出力及び通信ユニ
ット4,5及び6からの割込みを受け付けて処理すると
共に、シーケンスプログラムの実行によって発生するソ
フトウエア割込みをも処理するようになっている。
The operation processor 8 executes only basic instructions (bit operation, word addition / subtraction, word logical operation, etc.) in the sequence program. CPU
Reference numeral 7 performs preprocessing as described later before executing the program, and executes application instructions (instructions such as word multiplication / division, branch, longword arithmetic operation, and logical operation, which cannot be executed by the arithmetic processor 8) in the program. It is supposed to. The CPU 7 receives and processes input, output, and interrupts from the communication units 4, 5, and 6, and also processes software interrupts generated by execution of the sequence program.

【0017】次に、本実施例の作用について図1乃至図
5をも参照して説明する。図1は、PC3のOSによっ
て制御されるソフトウエア処理の流れを概略的に示すも
のである。
Next, the operation of the present embodiment will be described with reference to FIGS. FIG. 1 schematically shows the flow of software processing controlled by the OS of the PC 3.

【0018】この図1に示すように、PC3のCPU7
及び演算プロセッサ8は、入力ユニット4からの入力情
報を得る入力スキャン,シーケンスプログラムのルーチ
ンを実行するプログラムスキャン及びそのシーケンスプ
ログラムの実行結果に応じた出力情報を出力ユニット5
に対して出力する出力スキャンからなるスキャンサイク
ルを、繰返し実行するようになっている。
As shown in FIG. 1, the CPU 7 of the PC 3
And an operation processor 8 for input scanning for obtaining input information from the input unit 4, program scanning for executing a routine of a sequence program, and output information according to the execution result of the sequence program for the output unit 5.
A scan cycle consisting of an output scan to be output is executed repeatedly.

【0019】スキャンサイクルの実行中において発生す
る、データリンク要求以外の割込みは、その割込みが発
生した時点で処理されるようになっている。そのような
割込みには、以下のようなものがある。 時限割込み1:一定時間毎に、シーケンスプログラム
の割込みプログラムを実行する。 時限割込み2:一定時間毎に、PC3の各部が正常状
態にあるか否かを検査する。 タイマリフレッシュ:シーケンスプログラム中で使用
されるタイマの値を更新する。 I/O割込み:入力,出力ユニット4,5からの割込
み。シーケンスプログラムの割込み処理プログラムを起
動する。 尚、これらの割込みを処理する時間についても、スキャ
ンサイクルの時間が著しく長くなることがないように、
処理数等に一定の制限が設けてある。
Interrupts other than the data link request that occur during the execution of the scan cycle are processed when the interrupt occurs. Such interrupts include: Timed interrupt 1: An interrupt program of a sequence program is executed at regular intervals. Timed interrupt 2: Checks at regular intervals whether each part of the PC 3 is in a normal state. Timer refresh: Updates the value of the timer used in the sequence program. I / O interrupt: An interrupt from the input and output units 4 and 5. Start the interrupt processing program of the sequence program. In addition, regarding the time for processing these interrupts, in order to prevent the scan cycle time from becoming extremely long,
There are certain restrictions on the number of processes and the like.

【0020】また、タスク制御部9fは、時限割込み2
のように、比較的緊急性が低い割込みの処理タスクにつ
いては、1回の割込みによる処理タスクの実行時間に制
限を設ける。例えば、処理タスクのルーチンを一通り実
行するのに100msの時間を要する場合、1回の割込
みによる実行時間を20msなどに制限する。従って、
1回の割込みでは、PC3の各部の検査項目の内、制限
時間内で検査できる範囲のみが検査され、5回の割込み
によって全項目の検査が完了することになる。
Further, the task control unit 9f executes the timed interrupt 2
As described above, for an interrupt processing task having a relatively low urgency, a limit is imposed on the execution time of the processing task by one interrupt. For example, if it takes 100 ms to execute the routine of the processing task, the execution time by one interruption is limited to 20 ms. Therefore,
In one interruption, only the range that can be inspected within the time limit among the inspection items of each part of the PC 3 is inspected, and inspection of all items is completed by five interruptions.

【0021】図2及び図3に示すように、スキャンサイ
クルの実行中に、通信ユニット6を介したデータリンク
要求(受信1,2)、或いはPC3から通信ユニット6
へのデータリンク要求(リンク命令実行1,2)が発生
した場合は、夫々受信ハンドラ9a、或いは送信ハンド
ラ9bが起動される。
As shown in FIGS. 2 and 3, during the execution of the scan cycle, a data link request (reception 1, 2) via the communication unit 6 or a communication unit 6 from the PC 3 is received.
When a data link request (link command execution 1 and 2) is generated, the reception handler 9a or the transmission handler 9b is activated, respectively.

【0022】受信及び送信ハンドラ9a及び9bは、O
Sの割込み処理プログラムであり、データリンク要求が
発生すると同時に与えられる受信メッセージ(受信1,
2)や命令(命令1,2)をRAM10上の受信キュー
10a及び送信キュー10bに書込むと共に、受信フラ
グ及び送信フラグをRAM10上の所定領域にセットす
るようになっている。
The reception and transmission handlers 9a and 9b
S is an interrupt processing program for receiving a received message (received 1,
2) and instructions (instructions 1 and 2) are written into the reception queue 10a and the transmission queue 10b on the RAM 10, and the reception flag and the transmission flag are set in predetermined areas on the RAM 10.

【0023】そして、受信フラグ及び送信フラグがセッ
トされた場合は、スキャンサイクルの終了後に、OSの
応答タスク9c及び送信タスク9dが起動されて、受信
キュー10a及び送信キュー10bにセットされた受信
及び送信要求に応じた処理を実行するようになってい
る。この期間がデータリンクサイクル(以下、リンクサ
イクルと称す)に相当する。
When the reception flag and the transmission flag are set, the response task 9c and the transmission task 9d of the OS are activated after the end of the scan cycle, and the reception and the transmission set in the reception queue 10a and the transmission queue 10b are performed. Processing according to the transmission request is executed. This period corresponds to a data link cycle (hereinafter, referred to as a link cycle).

【0024】図4は、応答タスク9cの制御内容を示す
フローチャートである。この図2においては、先ず、
「受信数が規定以上?」の判断ステップR1において、
受信キュー10aにセットされている受信メッセージの
数が規定数以上か否かを判断する。ここで、規定数と
は、リンクサイクルの処理時間が長くなり過ぎないよう
に設定された制限であり、例えば“5”などに設定され
る。
FIG. 4 is a flowchart showing the control contents of the response task 9c. In FIG. 2, first,
In the determination step R1 of “is the number of receptions equal to or greater than a specified value?
It is determined whether or not the number of received messages set in the reception queue 10a is equal to or greater than a specified number. Here, the specified number is a limit set so that the processing time of the link cycle does not become too long, and is set to, for example, “5”.

【0025】判断ステップR1において、受信メッセー
ジ数が規定数未満であり「NO」と判断すると、「応答
処理実行」の処理ステップR2に移行する。処理ステッ
プR2においては、受信キュー10aにセットされた受
信メッセージに応じた処理をPC3側において実行し、
応答を割込みの発生元に対して返すようにする。そし
て、応答タスク9cの処理を終了する。
If the number of received messages is less than the specified number in the determination step R1 and the determination is "NO", the flow shifts to the processing step R2 of "execution of response processing". In the processing step R2, a process corresponding to the received message set in the reception queue 10a is executed on the PC3 side,
Return a response to the interrupt source. Then, the processing of the response task 9c ends.

【0026】一方、判断ステップR1において、受信メ
ッセージ数が規定数以上であり「YES」と判断する
と、「規定数分だけ応答処理実行」の処理ステップR3
に移行する。処理ステップR3においては、受信キュー
10aにセットされた受信メッセージの内、先頭から規
定数分“5”だけの受信メッセージに応じた処理をPC
3側において実行し、割込みの発生元に対して応答を返
すようにする。そして、「受信フラグセット」の処理ス
テップR4に移行する。
On the other hand, if the number of received messages is equal to or greater than the specified number and the determination is "YES" in the determination step R1, a processing step R3 of "execute response processing for the specified number" is performed.
Move to In the processing step R3, the processing corresponding to the specified number of "5" received messages from the head among the received messages set in the reception queue 10a is performed by the PC.
Execution is performed on the 3 side, and a response is returned to the interrupt source. Then, the processing shifts to the processing step R4 of “Reception flag setting”.

【0027】応答タスク9cが起動されると、受信フラ
グは自動的にクリアされるが、この場合は、受信フラグ
に未処理の受信メッセージが残っているので、次回のリ
ンクサイクルにおいて応答タスク9cを起動するため、
処理ステップR4において、受信フラグをセットする。
そして、処理を終了する。尚、リンクサイクルとスキャ
ンサイクルとでは、スキャンサイクルの処理時間の方が
短いため、残った処理を次回のリンクサイクルに回して
も処理が遅延する影響は少ない。
When the response task 9c is activated, the reception flag is automatically cleared. In this case, since an unprocessed reception message remains in the reception flag, the response task 9c is reset in the next link cycle. To start,
In processing step R4, a reception flag is set.
Then, the process ends. Since the processing time of the scan cycle is shorter between the link cycle and the scan cycle, even if the remaining processing is transferred to the next link cycle, the effect of the processing being delayed is small.

【0028】また、図5は、送信タスク9dの制御内容
を示すフローチャートである。この図5においては、先
ず、「応答待ちパケット有り?」の判断ステップS1に
おいて、応答待ちパケットがリストアップされているか
否かを判断する。
FIG. 5 is a flowchart showing the control contents of the transmission task 9d. In FIG. 5, first, in a determination step S1 of “response waiting packet?”, It is determined whether a response waiting packet is listed.

【0029】ここで、応答待ちパケットとは、送信タス
ク9dにおいてPC3から他のPCなどに対して送信を
行った結果作成され、その送信先から応答が帰って来る
のを待っている間に、RAM10の所定領域にリストア
ップされているものである。応答待ちパケットの内容
は、通番や送信先を示すコード,送信を行った時間など
からなっている。
Here, the response waiting packet is created as a result of transmission from the PC 3 to another PC or the like in the transmission task 9d, and while waiting for a response from the transmission destination, These are listed in a predetermined area of the RAM 10. The contents of the response waiting packet include a serial number, a code indicating a transmission destination, a transmission time, and the like.

【0030】判断ステップS1において、応答待ちパケ
ットがリストアップされておらず「NO」と判断する
と、「送信要求規定数以下?」の判断ステップS2に移
行する。判断ステップS2においては、送信キュー10
bにセットされている送信要求(命令1,2,…)の数
が規定数以上か否かを判断する。ここでの規定数は、応
答タスク9cについて前述したものと同様の理由で設定
されている。
If the response waiting packet is not listed in the judgment step S1 and the judgment is "NO", the process proceeds to a judgment step S2 of "less than the specified number of transmission requests?" In the determination step S2, the transmission queue 10
It is determined whether or not the number of transmission requests (commands 1, 2,...) set in b is equal to or greater than a specified number. The prescribed number here is set for the same reason as described above for the response task 9c.

【0031】判断ステップS2において、送信要求数が
規定数以下であり「YES」と判断すると、次の「キュ
ーから1個取出し送信パケットを作成」の処理ステップ
S3に移行する。処理ステップS3において、送信キュ
ー10bにセットされている送信要求を先頭から1個取
出して、送信を行うための送信パケットを作成する。送
信パケットとは、送信メッセージ(命令)に、送信を行
うのに必要なデータ等を付加して所定のデータフォーマ
ットに構成したものである。
When the number of transmission requests is equal to or less than the specified number and the determination is "YES" in the determination step S2, the process proceeds to the next processing step S3 of "fetch one transmission packet from a queue". In processing step S3, one transmission request set in the transmission queue 10b is taken out from the head and a transmission packet for performing transmission is created. The transmission packet is a transmission message (command) added with data and the like necessary for transmission to form a predetermined data format.

【0032】送信パケットを1個作成すると、次の「送
信キューが空?」の判断ステップS4に移行する。判断
ステップS4においては、送信キュー10bにセットさ
れた送信要求を全て取出したか否かを判断する。送信要
求がまだ残っており「NO」と判断すると、ステップS
2に移行する。
When one transmission packet has been created, the process proceeds to the next step S4 for determining whether the transmission queue is empty. In determination step S4, it is determined whether or not all the transmission requests set in transmission queue 10b have been extracted. If the transmission request still remains and "NO" is determined, step S
Move to 2.

【0033】即ち、送信キュー10bにある送信要求数
が規定数以下の場合は、ステップS2〜S4のループを
回ることによって、その送信要求を送信キュー10bか
ら全て取出して判断ステップS4において「YES」と
判断するまで、1個ずつ送信要求が取出されて送信パケ
ットが作成される。
That is, when the number of transmission requests in the transmission queue 10b is equal to or smaller than the specified number, the process goes through a loop of steps S2 to S4, and all the transmission requests are taken out of the transmission queue 10b. Until it is determined, transmission requests are taken out one by one and transmission packets are created.

【0034】そして、判断ステップS4において「YE
S」と判断すると、「送信」の処理ステップS6に移行
して、作成した送信パケットを全て送信する。送信と同
時に、応答待ちパケットが作成されてリストアップされ
る。また、この時監視タスク9eが起動され(処理ステ
ップW3)、この時点で新規に送信されたものに対応す
る応答待ちパケットに、送信時刻を書込んで記憶する。
その後、送信タスク処理を終了する。
Then, in the judgment step S4, "YE
If it is determined to be "S", the process proceeds to the "transmission" processing step S6 to transmit all the created transmission packets. At the same time as the transmission, a response waiting packet is created and listed. At this time, the monitoring task 9e is activated (processing step W3), and the transmission time is written and stored in the response waiting packet corresponding to the one newly transmitted at this time.
Thereafter, the transmission task processing ends.

【0035】一方、判断ステップS2において、送信キ
ュー10bにある送信要求数が規定数を超えており「N
O」と判断すると、「規定数の送信パケットを作成」の
処理ステップS5に移行する。処理ステップS5におい
ては、送信キュー10bにある送信要求の内、先頭から
規定数分だけを取出して送信パケットを作成する。
On the other hand, in the judgment step S2, the number of transmission requests in the transmission queue 10b exceeds the specified number and "N
If it is determined to be "O", the process proceeds to the processing step S5 of "creating a specified number of transmission packets". In the processing step S5, a specified number of transmission requests from the transmission request in the transmission queue 10b are taken out from the head to create a transmission packet.

【0036】そして、次の「送信フラグセット」の処理
ステップS5aに移行して、次回のリンクサイクルにお
いて送信タスク9dが起動されるように送信フラグをセ
ットする。すると、ステップS6に移行して、規定数分
の送信パケットを送信する。
Then, the processing shifts to the processing step S5a of the next "transmission flag setting", where the transmission flag is set so that the transmission task 9d is activated in the next link cycle. Then, the process proceeds to step S6 to transmit the specified number of transmission packets.

【0037】また、ステップS1において、既に応答待
ちパケットがリストアップされており「YES」と判断
すると、監視タスク9eが起動される(判断ステップW
1)。その「タイムオーバー?」の判断ステップW1に
おいて、監視タスク9eは、応答待ちパケットに書込ま
れている送信時間を参照して、規定されている応答待ち
時間をオーバーしたか否かを判断する。待ち時間をオー
バーした応答待ちパケットがなければ「NO」と判断し
てステップS2に移行する。
In step S1, if a response waiting packet has already been listed and the judgment is "YES", the monitoring task 9e is started (judgment step W).
1). In the determination step W1 of “time over?”, The monitoring task 9e refers to the transmission time written in the response waiting packet and determines whether or not the specified response waiting time has been exceeded. If there is no response waiting packet exceeding the waiting time, “NO” is determined, and the process shifts to step S2.

【0038】判断ステップW1において、待ち時間をオ
ーバーした応答待ちパケットがある場合は、監視タスク
9eは「YES」と判断して、「エラーフラグをセット
し、該当パケットを削除」の処理ステップW2に移行す
る。処理ステップW2においては、送信先から規定時間
内に応答がなかったことを示すエラーフラグをRAM1
0の所定領域にセットすると、リストからタイムオーバ
ーとなった応答待ちパケットを削除する。そして、ステ
ップS2に移行する。
In the determination step W1, if there is a response waiting packet exceeding the waiting time, the monitoring task 9e determines "YES", and proceeds to the processing step W2 of "setting an error flag and deleting the packet". Transition. In processing step W2, an error flag indicating that there was no response from the transmission destination within a specified time is stored in RAM1.
When the packet is set to a predetermined area of 0, the response waiting packet whose time has expired is deleted from the list. Then, control goes to a step S2.

【0039】以上のように本実施例によれば、PC3の
CPU7及び演算プロセッサ8によるスキャンサイクル
の実行中に外部のPCからのデータリンク要求が発生す
ると、受信ハンドラ9aは、当該受信要求を受信キュー
10aに順次セットし、また、外部のPCに対するデー
タリンク要求がPC3側から発生すると、送信ハンドラ
9bは、当該送信要求を送信キュー10bに順次セット
する。そして、OSのタスク制御部9fは、スキャンサ
イクルの実行後に、受信キュー10aにセットされてい
る受信要求を処理する応答タスク9cを起動すると共
に、送信キュー10bにセットされている送信要求を処
理する送信タスク9dを起動するデータリンクサイクル
をCPU7または演算プロセッサ8に実行させるように
した。
As described above, according to this embodiment, when a data link request is issued from an external PC during the execution of a scan cycle by the CPU 7 and the arithmetic processor 8 of the PC 3, the reception handler 9a receives the reception request. When the data link request for the external PC is generated from the PC 3 side, the transmission handler 9b sequentially sets the transmission request in the transmission queue 10b. Then, after executing the scan cycle, the task control unit 9f of the OS activates the response task 9c for processing the reception request set in the reception queue 10a and processes the transmission request set in the transmission queue 10b. The data link cycle for activating the transmission task 9d is executed by the CPU 7 or the arithmetic processor 8.

【0040】従って、スキャンサイクルの実行中に発生
したデータリンク要求は、当該スキャンサイクルの実行
後に確実に処理されるので、従来とは異なり、データリ
ンク性能が大きく劣化することがなく、一定の応答性能
を維持することができる。逆に、スキャンサイクルの実
行中に発生する他の割込み処理も、データリンク要求の
処理によって妨げられることがないので、リアルタイム
で処理することが望ましいI/O割込みなどの処理に対
する応答性をも良好にし得て、各割込み処理要求をバラ
ンス良く処理することができる。
Therefore, the data link request generated during the execution of the scan cycle is reliably processed after the execution of the scan cycle. Performance can be maintained. Conversely, other interrupt processing that occurs during the execution of the scan cycle is not hindered by the processing of the data link request, so that responsiveness to processing such as an I / O interrupt that is preferably processed in real time is also good. Thus, each interrupt processing request can be processed in a well-balanced manner.

【0041】また、本実施例によれば、タスク制御部9
fによって起動される応答タスク及び送信タスクに、1
回の起動時にCPU7または演算プロセッサ8に処理さ
せる受信要求及び送信要求の数に制限を設けたので、デ
ータリンクサイクルの実行時間を制限することによっ
て、各割込み処理要求を一層バランス良く処理すること
ができる。
According to the present embodiment, the task control unit 9
f, the response task and the transmission task
Since the number of reception requests and transmission requests to be processed by the CPU 7 or the arithmetic processor 8 at the time of starting each time is limited, the execution time of the data link cycle is limited so that each interrupt processing request can be processed in a more balanced manner. it can.

【0042】本発明は上記し且つ図面に記載した実施例
にのみ限定されるものではなく、次のような変形または
拡張が可能である。システムの仕様によって、データリ
ンク要求が一定時間内において大量に発生する可能性が
低い場合には、1回の起動時に処理される受信要求及び
送信要求の数に、特に制限を設ける必要はない。また、
システムの仕様に応じてユーザが制限数を設定できるよ
うにしても良い。
The present invention is not limited to the embodiment described above and shown in the drawings, and the following modifications or extensions are possible. If it is unlikely that a large number of data link requests will occur within a certain period of time due to the specifications of the system, it is not necessary to particularly limit the number of reception requests and transmission requests that are processed during one activation. Also,
The user may be allowed to set the limit number according to the specifications of the system.

【0043】プロセッサは、必ずしもCPU7及び演算
プロセッサ8の両方を用いる必要はなく、1個のCPU
で基本命令及び応用命令を処理するものであっても良
い。図1では、受信要求と送信要求とが異なるスキャン
サイクルにおいて発生した例を示したが、両者が同じス
キャンサイクルにおいて同時に発生した場合であって
も、その次のリンクサイクルにおいて応答タスク9c,
送信タスク9dをシリアルに起動して処理すれば良い。
受信及び送信タスク9c及び9dを起動するのに受信及
び送信フラグをセットするのに代えて、タスク制御部9
fが受信及び送信キュー10a及び10bを直接参照す
ることにより、受信及び送信要求がセットされていれば
各タスクを起動するようにしても良い。
The processor does not necessarily need to use both the CPU 7 and the arithmetic processor 8, and one CPU
May process basic instructions and application instructions. FIG. 1 shows an example in which a reception request and a transmission request occur in different scan cycles. However, even when both requests occur simultaneously in the same scan cycle, the response task 9c,
The transmission task 9d may be serially activated and processed.
Instead of setting the reception and transmission flags to activate the reception and transmission tasks 9c and 9d, the task control unit 9
By directly referring to the reception and transmission queues 10a and 10b by f, each task may be activated if a reception and transmission request is set.

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

【図1】本発明の一実施例におけるスキャンサイクル及
びリンクサイクルの処理の流れを概念的に示す図
FIG. 1 is a diagram conceptually showing a processing flow of a scan cycle and a link cycle in one embodiment of the present invention.

【図2】図1において、発生した受信要求に対応する部
分を詳細に示す図
FIG. 2 is a diagram showing in detail a portion corresponding to the generated reception request in FIG.

【図3】図1において、発生した送信要求に対応する部
分を詳細に示す図
FIG. 3 is a diagram showing in detail a portion corresponding to the generated transmission request in FIG. 1;

【図4】応答タスクの処理内容を示すフローチャートFIG. 4 is a flowchart showing processing contents of a response task.

【図5】送信タスクの処理内容を示すフローチャートFIG. 5 is a flowchart showing processing contents of a transmission task.

【図6】プログラマブルコントローラを含むラック全体
のI/O構成を示す図
FIG. 6 is a diagram showing an I / O configuration of an entire rack including a programmable controller;

【図7】プログラマブルコントローラの要部の電気的構
成を示す図
FIG. 7 is a diagram showing an electrical configuration of a main part of the programmable controller;

【図8】(a)はプログラマブルコントローラのRAM
の内容を概念的に示す図、(b)は同プログラマブルコ
ントローラのROMの内容を概念的に示す図
FIG. 8A is a RAM of a programmable controller.
(B) is a diagram conceptually showing the contents of the ROM of the programmable controller.

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

3はプログラマブルコントローラ、4は入力ユニット、
5は出力ユニット、7は汎用CPU(プロセッサ)、8
はビット演算プロセッサ(プロセッサ)、9aは受信ハ
ンドラ(受信キューセット手段)、9bは送信ハンドラ
(送信キューセット手段)、9cは応答タスク、9dは
送信タスク、9fはタスク制御部(スキャンサイクル実
行手段,リンクサイクル実行手段)、10aは受信キュ
ー、10bは送信キューを示す。
3 is a programmable controller, 4 is an input unit,
5 is an output unit, 7 is a general-purpose CPU (processor), 8
Is a bit operation processor (processor), 9a is a reception handler (reception queue setting means), 9b is a transmission handler (transmission queue setting means), 9c is a response task, 9d is a transmission task, and 9f is a task control unit (scan cycle execution means). , Link cycle executing means), 10a indicates a reception queue, and 10b indicates a transmission queue.

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 入力ユニットからの入力情報を得る入力
スキャン,ユーザプログラムのルーチンを実行するプロ
グラムスキャン及び前記ユーザプログラムの実行結果に
応じた出力情報を出力ユニットに対して出力する出力ス
キャンからなるスキャンサイクルをプロセッサに繰返し
実行させるスキャンサイクル実行手段と、 前記プロセッサによる前記スキャンサイクルの実行中に
おいて、外部装置からのデータリンク要求が発生すると
当該受信要求を受信キューに順次セットする受信キュー
セット手段と、 前記プロセッサによる前記スキャンサイクルの実行中に
おいて、外部装置に対するデータリンク要求が発生する
と当該送信要求を送信キューに順次セットする送信キュ
ーセット手段と、 前記プロセッサによる前記スキャンサイクルの実行後
に、前記受信キューにセットされている受信要求を処理
する応答タスクを起動すると共に、前記送信キューにセ
ットされている送信要求を処理する送信タスクを起動す
るデータリンクサイクルを前記プロセッサに実行させる
リンクサイクル実行手段とを具備したことを特徴とする
プログラマブルコントローラ。
1. A scan comprising an input scan for obtaining input information from an input unit, a program scan for executing a routine of a user program, and an output scan for outputting output information corresponding to an execution result of the user program to an output unit. Scan cycle execution means for causing a processor to repeatedly execute a cycle, and during execution of the scan cycle by the processor, when a data link request from an external device occurs, reception queue setting means for sequentially setting the reception request in a reception queue, Transmission queue setting means for sequentially setting the transmission request in a transmission queue when a data link request to an external device occurs during the execution of the scan cycle by the processor; and after the execution of the scan cycle by the processor. A link that activates a response task that processes a reception request set in the reception queue and causes the processor to execute a data link cycle that activates a transmission task that processes a transmission request set in the transmission queue. A programmable controller comprising: a cycle execution unit.
【請求項2】 前記リンクサイクル実行手段によって起
動される前記応答タスク及び送信タスクは、1回の起動
時に前記プロセッサに処理させる受信要求及び送信要求
の数に制限を設けていることを特徴とする請求項1記載
のプログラマブルコントローラ。
2. The response task and the transmission task started by the link cycle execution means have a limit on the number of reception requests and transmission requests to be processed by the processor at one start. The programmable controller according to claim 1.
JP22352597A 1997-08-20 1997-08-20 Programmable controller Pending JPH1165623A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP22352597A JPH1165623A (en) 1997-08-20 1997-08-20 Programmable controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP22352597A JPH1165623A (en) 1997-08-20 1997-08-20 Programmable controller

Publications (1)

Publication Number Publication Date
JPH1165623A true JPH1165623A (en) 1999-03-09

Family

ID=16799520

Family Applications (1)

Application Number Title Priority Date Filing Date
JP22352597A Pending JPH1165623A (en) 1997-08-20 1997-08-20 Programmable controller

Country Status (1)

Country Link
JP (1) JPH1165623A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007233847A (en) * 2006-03-02 2007-09-13 Hitachi Ltd Storage system and scheduling method
US7461380B2 (en) 2003-02-18 2008-12-02 Denso Corporation Inter-task communications method, program, recording medium, and electronic device
JP2011039643A (en) * 2009-08-07 2011-02-24 Keyence Corp Programmable controller
US8170694B2 (en) 2005-11-14 2012-05-01 Mitsubishi Electric Corporation Network unit and programmable controller using the same
JP5866082B1 (en) * 2015-06-22 2016-02-17 三菱電機株式会社 Programmable controller and control method of programmable controller

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7461380B2 (en) 2003-02-18 2008-12-02 Denso Corporation Inter-task communications method, program, recording medium, and electronic device
US8170694B2 (en) 2005-11-14 2012-05-01 Mitsubishi Electric Corporation Network unit and programmable controller using the same
DE112006002841B4 (en) * 2005-11-14 2016-12-22 Mitsubishi Electric Corp. Network unit and programmable controller using the same
JP2007233847A (en) * 2006-03-02 2007-09-13 Hitachi Ltd Storage system and scheduling method
US7950013B2 (en) 2006-03-02 2011-05-24 Hitachi, Ltd. System for monitoring time proportion for interrupt or task processing with restriction placed in subsequent monitoring time period when allowable time proportion is exceed
JP2011039643A (en) * 2009-08-07 2011-02-24 Keyence Corp Programmable controller
JP5866082B1 (en) * 2015-06-22 2016-02-17 三菱電機株式会社 Programmable controller and control method of programmable controller
WO2016207937A1 (en) * 2015-06-22 2016-12-29 三菱電機株式会社 Programmable controller and control method for programmable controller

Similar Documents

Publication Publication Date Title
JP2664662B2 (en) Method of operating simultaneous processes in computer system and microcomputer
EP1503292B1 (en) DMA controller with bus occupation time limitation and sets of DMA parameters for a plurality of logical processors
KR970016979A (en) Queuing system and method of tasks in a multiprocessing system
US20100299472A1 (en) Multiprocessor system and computer program product
JPH1165623A (en) Programmable controller
EP0578496B1 (en) Job execution method in multi-CPU system
JPH08202566A (en) Inter-processor communication system
JP3576437B2 (en) Multiprocessor task control method and task control device
JP2001092676A (en) Task management system in integrated program
JP3611166B2 (en) Data processing method and apparatus
JP3350699B2 (en) Programmable controller
JPH1196108A (en) Computer system and bus control device
EP0614148A1 (en) Data processing apparatus
JPH0588933A (en) Parallel processing system with debugging function
JP2508038B2 (en) Programmable controller
JP2001265610A (en) Device control method
JP2000047881A (en) Real-time system
JPH11249909A (en) Method for process reactivation on multitask os
JP2000029719A (en) Interrupt controller
JPH05233525A (en) Input/otuput processor
JP6138482B2 (en) Embedded system
JPH0240723A (en) Message transmission/reception control system
JPS62190544A (en) Higher link unit for programmable controller
JP2000029850A (en) Task controlling method using inter-processor communication of operating system
JPH08339210A (en) Programmable controller