JPH1124965A - Programmable controller - Google Patents

Programmable controller

Info

Publication number
JPH1124965A
JPH1124965A JP9187528A JP18752897A JPH1124965A JP H1124965 A JPH1124965 A JP H1124965A JP 9187528 A JP9187528 A JP 9187528A JP 18752897 A JP18752897 A JP 18752897A JP H1124965 A JPH1124965 A JP H1124965A
Authority
JP
Japan
Prior art keywords
address
measurement
application program
interrupt
program
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
JP9187528A
Other languages
Japanese (ja)
Inventor
Takashi Mishina
隆 三品
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.)
Toyo Electric Manufacturing Ltd
Original Assignee
Toyo Electric Manufacturing 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 Toyo Electric Manufacturing Ltd filed Critical Toyo Electric Manufacturing Ltd
Priority to JP9187528A priority Critical patent/JPH1124965A/en
Publication of JPH1124965A publication Critical patent/JPH1124965A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

(57)【要約】 【課題】PLC内にアプリケーションプログラムを変え
ることなく実行時間を測定するために技術的手段を講じ
たPLCを提供することにある。 【解決手段】アプリケーションプログラムの計測開始ア
ドレス、計測終了アドレス、アドレス比較手段、その結
果から得られる割込検出信号によりマイクロプロセッサ
に対し割込信号を発生させるための割込発生手段、実行
計測開始時の割込から計測終了時の割込までの時間を計
測するための基準クロック、リードオンリメモリ、ラン
ダムアクセスメモリ、プログラマブルコントローラが制
御する外部I/Oモジュールとアプリケーションプログ
ラムの開発を支援するコンソールとの接続を行なうため
の外部I/Fを具備したもの。
(57) [Problem] To provide a PLC in which technical measures are taken to measure an execution time without changing an application program in the PLC. A measurement start address, a measurement end address, an address comparison means of an application program, an interrupt generation means for generating an interrupt signal to a microprocessor based on an interrupt detection signal obtained from the result, and a start of execution measurement A reference clock for measuring the time from the interruption of the measurement to the interruption at the end of measurement, a read-only memory, a random access memory, an external I / O module controlled by a programmable controller, and a console for supporting the development of application programs. One with an external I / F for making connections.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明はプロセス制御に使用
されるプログラマブルコントローラ(以下PLCと称
す)に係わり、特にこの実行時間の解析を行うプログラ
マブルコントローラに関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a programmable controller (hereinafter referred to as "PLC") used for process control, and more particularly to a programmable controller for analyzing the execution time.

【0002】[0002]

【従来の技術】PLCのアプリケーションンプログラム
開発において、高速を要求されるプログラムの実行時間
を測定する場合、あらかじめ計測したい部分を別のプロ
グラムとして作成し、実行結果より算出し、測定してい
た。
2. Description of the Related Art In the development of PLC application programs, when measuring the execution time of a program that requires high speed, the part to be measured is created in advance as another program, calculated from the execution result, and measured.

【0003】[0003]

【発明が解決しようとする課題】しかしながら、前述し
たような手段では、実際に使用されるプログラムとは動
作条件が異なり、現実と違った結果が得られる場合が多
くあった。また、計測するプログラムを作成するための
操作や測定するための準備が必要であり、効率的なプロ
グラム開発の阻害要因となっていた。本発明は上述した
点に鑑みて創案されたもので、その目的とするところ
は、これらの欠点を解決すべくPLC内にアプリケーシ
ョンプログラムを変えることなく実行時間を測定するた
めに技術的手段を講じたPLCを提供することにある。
However, in the above-described means, operating conditions are different from those of an actually used program, and in many cases, results different from reality are obtained. In addition, an operation for creating a program to be measured and preparation for measurement are required, which has been a hindrance to efficient program development. SUMMARY OF THE INVENTION The present invention has been made in view of the above points, and has as its object to solve the drawbacks by taking technical measures to measure the execution time without changing an application program in a PLC. To provide a PLC.

【0004】[0004]

【課題を解決するための手段】つまり、その目的を達成
するための手段は、プログラマブルコントローラにおい
て、アプリケーションプログラムの計測開始アドレスの
物理アドレスを設定するための第1のアドレス設定手段
と、計測終了アドレスの物理アドレスを設定するための
第2のアドレス設定手段と、マイクロプロセッサバスの
アドレスライン信号と前記第1のアドレス設定手段と比
較し、計測開始された事を検出するための第1のアドレ
ス比較手段と、マイクロプロセッサバスのアドレスライ
ン信号と前記第2のアドレス設定手段と比較し、計測終
了された事を検出するための第2のアドレス比較手段
と、その結果から得られる割込検出信号によりマイクロ
プロセッサに対し割込信号を発生させるための割込発生
手段と、前記アプリケーションプログラムの実行計測開
始時の割込から計測終了時の割込までの時間を計測する
ための基準クロックと、この基準クロックをカウントす
るためのカウンタと、アプリケーションプログラムの実
行を管理するためのシステムプログラムを格納したリー
ドオンリメモリと、アプリケーションプログラムとシス
テムプログラムの実行を管理するために必要なシステム
メモリを格納するためのランダムアクセスメモリと、プ
ログラマブルコントローラが制御する外部I/Oモジュ
ールとアプリケーションプログラムの開発を支援するコ
ンソールとの接続を行なうための外部I/Fを具備し、
プログラムコンソールにより任意に設定されるアプリケ
ーションプログラムの計測開始アドレスおよび計測終了
アドレス間のプログラム実行時間を実時間で計測するこ
とができるよう構成したことにある。
Means for achieving the object are a first address setting means for setting a physical address of a measurement start address of an application program in a programmable controller, and a measurement end address. Second address setting means for setting a physical address of the first address, a first address comparing means for comparing an address line signal of a microprocessor bus with the first address setting means, and detecting that measurement has started. Means, a second address comparing means for comparing the address line signal of the microprocessor bus with the second address setting means, and detecting that the measurement is completed, and an interrupt detection signal obtained from the result. Interrupt generating means for generating an interrupt signal to a microprocessor; A reference clock for measuring the time from the interrupt at the start of measurement to the interrupt at the end of measurement, a counter for counting this reference clock, and a counter for managing the execution of the application program A read-only memory that stores a system program, a random access memory that stores an application program and a system memory necessary for managing execution of the system program, an external I / O module controlled by a programmable controller, and an application program. Equipped with an external I / F for connecting to a console that supports development,
A program execution time between a measurement start address and a measurement end address of an application program arbitrarily set by a program console can be measured in real time.

【0005】以下その作用について説明する。本発明を
適用するPLCにおいて、図2(a)に示すアプリケー
ションプログラム例をもとに、1ライン目から5ライン
目までの実行時間を測定する場合について説明する。使
用者は、まず開発支援用コンソール、例えばパソコン
(以下PCと称す)をPLCに接続し、PCにおいてア
プリケーションプログラムの実行時間を測定する部分の
ライン番号1および5をキー入力する。これにより、P
Cの実行時間測定用プログラムはアプリケーションプロ
グラムの計測開始物理アドレスを算出し、PLCのアド
レス設定バッファ1に設定し、さらにアプリケーション
プログラムの計測終了物理アドレスを算出し、PLCの
アドレス設定バッファ2に設定する。いずれの設定バッ
ファともにランダムアクセスメモリ(以下RAMと称す
る)内におかれており、アプリケーションプログラム実
行中においても書き替え、変更は可能である。PLC内
のMPUはアプリケーションプログラムが1サイクルの
実行を終了した後、アドレス設定バッファ1およびアド
レス設定バッファ2の内容が変更されたか確認してお
り、変更があった場合、アドレス設定バッファ1の値を
第1のアドレス設定手段にアドレス設定バッファ2の値
を第2のアドレス設定手段にそれぞれ設定する。
The operation will be described below. In the PLC to which the present invention is applied, a case where the execution time from the first line to the fifth line is measured based on an example of an application program shown in FIG. First, a user connects a development support console, for example, a personal computer (hereinafter, referred to as a PC) to the PLC, and inputs the line numbers 1 and 5 of the portion of the PC for measuring the execution time of the application program by keying. This allows P
The C execution time measurement program calculates the measurement start physical address of the application program, sets it in the PLC address setting buffer 1, calculates the measurement end physical address of the application program, and sets it in the PLC address setting buffer 2. . Both setting buffers are stored in a random access memory (hereinafter, referred to as RAM), and can be rewritten and changed even during execution of an application program. The MPU in the PLC checks whether or not the contents of the address setting buffer 1 and the address setting buffer 2 have been changed after the application program has finished executing one cycle. The value of the address setting buffer 2 is set in the first address setting means, respectively, in the second address setting means.

【0006】PLC内のMPUはアプリケーションプロ
グラムの先頭アドレスからプログラムを実行するので、
前記第1のアドレス設定手段に設定された物理アドレス
からプログラムコードを読み込み、この時MPUはMP
Uバスのアドレスライン信号にアプリケーションプログ
ラムの計測開始物理アドレスを発生し、また制御ライン
信号には読込信号を発生し、第1のアドレ比較手段の出
力信号が活性化する。割込発生手段は前記信号を受けて
MPUに割込信号を伝達するが、この時の情報として計
測開始時の割込番号1番を付加し、この情報によりMP
Uはアプリケーションプログラムの実行を一時中断し、
システムプログラム内の割込プログラム1番へ処理を移
行する。
Since the MPU in the PLC executes the program from the start address of the application program,
The program code is read from the physical address set in the first address setting means.
A measurement start physical address of the application program is generated as a U bus address line signal, a read signal is generated as a control line signal, and an output signal of the first address comparing means is activated. The interrupt generation means receives the signal and transmits an interrupt signal to the MPU. At this time, an interrupt number at the start of measurement is added as information at this time, and the MP
U suspends execution of the application program,
The processing shifts to the first interrupt program in the system program.

【0007】割込プログラム1番に移行すると、MPU
は現在使用中のレジスタを一時退避した後、カウンタか
ら現在値を読み込み、その値をRAM内の計測開始カウ
ントバッファにストアし、退避したレジスタを元の値に
戻してから、割込プログラム1番を終了し、アプリケー
ションプログラムに復帰する。MPUは割込プログラム
1番から復帰すると、再びアプリケーションプログラム
を順次読み込み実行していき前記第2のアドレス設定手
段に設定された物理アドレスから図2の5ライン目のE
ND命令のプログラムコードを読み込み、この時、MP
UはMPUバスのアドレスライン信号にアプリケーショ
ンプログラムの計測終了物理アドレスを発生し、また制
御ライン信号には読み込み信号を発生し、第2のアドレ
ス比較手段の出力信号が活性化する。割込発生手段は前
記信号を受けてMPUに割込信号を伝達するが、この時
の情報として計測終了時の割込番号2番を付加し、この
情報によりMPUはアプリケーションプログラムの実行
を一時中断し、システムプログラム内の割込プログラム
2番へ処理を移行する。
When the program shifts to the first interrupt program, the MPU
After temporarily saving the register currently in use, read the current value from the counter, store the value in the measurement start count buffer in the RAM, return the saved register to the original value, And returns to the application program. When the MPU returns from the first interrupt program, the MPU sequentially reads and executes the application program again, and starts reading from the physical address set in the second address setting means on the fifth line in FIG.
Read the program code of the ND instruction,
U generates the measurement end physical address of the application program in the address line signal of the MPU bus, generates a read signal in the control line signal, and activates the output signal of the second address comparison means. The interrupt generation means receives the above signal and transmits an interrupt signal to the MPU. At this time, the interrupt number 2 at the end of the measurement is added, and the MPU suspends the execution of the application program based on this information. Then, the processing shifts to the interrupt program 2 in the system program.

【0008】割込プログラム2番に移行すると、MPU
は現在使用中のレジスタを一時退避した後、カウンタか
ら現在値を読み込み、その値をRAM内の計測終了カウ
ントバッファにストアし、退避したレジスタを元の値に
戻してから、割込プログラム2番を終了し、アプリケー
ションプログラムに復帰する。MPUは割込プログラム
2番から復帰すると、再びアプリケーションプログラム
を実行するので図2の5ライン目のEND命令を実行す
ることになる。END命令を実行すると、アプリケーシ
ョンプログラムの1サイクルの実行を終了し、アプリケ
ーションプログラムからシステムプログラムに制御が移
行され、システムプログラム内では通常のシステム管理
プログラムのほかに前記割込プログラム1番および割込
プログラム2番内にてストアされた計測開始カウントバ
ッファと計測終了カウントバッファとの差分演算を実行
する。
When the program shifts to the second interrupt program, the MPU
After temporarily saving the register currently in use, read the current value from the counter, store the value in the measurement end count buffer in the RAM, return the saved register to the original value, and then execute interrupt program number 2. And returns to the application program. When the MPU returns from the second interrupt program, the MPU executes the application program again, so that the END instruction on the fifth line in FIG. 2 is executed. When the END instruction is executed, execution of one cycle of the application program is completed, control is transferred from the application program to the system program, and in the system program, in addition to the normal system management program, the interrupt program No. 1 and the interrupt program The difference calculation is performed between the measurement start count buffer and the measurement end count buffer stored in No. 2.

【0009】本差分演算値は、図2におけるアプリケー
ションプログラムの1ライン目実行開始前から5ライン
目実行開始前までに基準クロックを計数した値であり、
基準クロックの周期を乗ずることにより前記1ライン目
から5ライン目までの実行時間に変換することが可能で
ある。システムプログラム内での実行時間への変換演算
終了後、再びMPUはアプリケーションプログラムの1
ライン目からプログラムの実行を繰り返すのでアプリケ
ーションプログラムの1ライン目から5ライン目までの
実行時間をリアルタイムに計測することが可能となる。
以下、本発明の一実施例を図面に基づいて詳述する。
The difference calculation value is a value obtained by counting the reference clock from before the start of execution of the first line to before the start of execution of the fifth line of the application program in FIG.
By multiplying by the cycle of the reference clock, it is possible to convert to the execution time of the first to fifth lines. After the end of the conversion operation to the execution time in the system program, the MPU again executes
Since the execution of the program is repeated from the line, the execution time from the first line to the fifth line of the application program can be measured in real time.
Hereinafter, an embodiment of the present invention will be described in detail with reference to the drawings.

【0010】[0010]

【発明の実施の形態】図1は本発明の一実施例を示すプ
ログラマブルコントローラCPU内部の全体構成図、図
2(a),(b),(c)はアプリケーションプログラ
ムの一例を示し、図(a)は実行内容、(b)は演算内
容、(c)はシンボルの意味である。また図3はランダ
ムアクセスメモリ内メモリマップ図、図4は本発明の一
実施例を示すシステムプログラム及び割り込みプログラ
ムのフローチャート図、図5は本発明の一実施例を示す
タイミングチャート図である。図1において、MPUと
アプリケーションプログラムの計測開始アドレスの物理
アドレスを設定するための第1のアドレス設定手段11
と、MPUバスのアドレスライン信号と第1のアドレス
設定手段11を比較し、アプリケーションプログラムの
計測開始アドレスからプログラムコードを読み込み、計
測開始された事を検出するための第1のアドレス比較手
段12と、アプリケーションプログラムの計測終了アド
レスの物理アドレスを設定するための第2のアドレス設
定手段21と、MPUバスのアドレスライン信号と第2
のアドレス設定手段21を比較し、アプリケーションプ
ログラムの計測終了アドレスからプログラムコードを読
み込み、計測終了された事を検出するための第2のアド
レス比較手段22と、第1のアドレス比較手段の出力結
果、および第2のアドレス比較手段の出力結果によりM
PUに割込を発生させるための割込発生手段7と、基準
クロック8を逐次カウントし、前記MPUに割込が発生
した時に基準クロック8のカウント値をMPUが読み込
むことにより、アプリケーションプログラムの計測開始
物理アドレスから計測終了物理アドレスまでの実行時間
を測定するものである。なお、1はマイクロプロセッ
サ、2はリードオンリメモリ、3はランダムアクセスメ
モリ、4はカウンタ、5は外部I/F、6はマイクロプ
ロセッサバスである。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS FIG. 1 is an overall configuration diagram of a programmable controller CPU showing an embodiment of the present invention, and FIGS. 2A, 2B and 2C show an example of an application program. (a) shows the execution contents, (b) shows the operation contents, and (c) shows the meaning of the symbol. FIG. 3 is a memory map in a random access memory, FIG. 4 is a flowchart of a system program and an interrupt program showing one embodiment of the present invention, and FIG. 5 is a timing chart showing one embodiment of the present invention. In FIG. 1, a first address setting means 11 for setting a physical address of a measurement start address of an MPU and an application program
And the first address setting means 11 for comparing the address line signal of the MPU bus with the first address setting means 11, reading the program code from the measurement start address of the application program, and detecting the start of measurement. Address setting means 21 for setting the physical address of the measurement end address of the application program;
The second address comparing means 22 for reading the program code from the measurement end address of the application program and detecting the end of the measurement, the output result of the first address comparing means, And M from the output result of the second address comparing means.
The interrupt generation means 7 for generating an interrupt in the PU and the reference clock 8 are sequentially counted, and the MPU reads the count value of the reference clock 8 when an interrupt occurs in the MPU, thereby measuring the application program. It measures the execution time from the start physical address to the measurement end physical address. 1 is a microprocessor, 2 is a read-only memory, 3 is a random access memory, 4 is a counter, 5 is an external I / F, and 6 is a microprocessor bus.

【0011】図2(a),(b),(c)において、図
(a)に示す作成されたアプリケーションプログラムは
ライン番号1〜4に、図(b)に示すd=a*b+c,
h=e/f−gを求める演算内容を、図(c)に示す図
式表現して表した機能ブロック図言語で記述しており、
このアプリケーションプログラムはPLC内RAMの内
部に図3のメモリマップ図アプリケーションプログラム
領域にPCによりダウンロードされる。ダウンロードす
る個々の演算コードは、PLC内のMPUが実行可能な
機械語となっており、ダウンロード終了後、MPUは先
頭アドレスから機械語を順次読み込みそれぞれの命令を
実行していく。図3のアプリケーションプログラム領域
の命令コードに添付されたa〜hのコードは演算に使用
されるレジスタ名称である。本実施例はアプリケーショ
ンプログラムの先頭アドレスから終了命令のアドレスま
での実行時間を測定する場合について説明する。
2 (a), 2 (b) and 2 (c), the application programs created as shown in FIG. 2 (a) correspond to line numbers 1 to 4 and d = a * b + c, as shown in FIG. 2 (b).
The content of the operation for calculating h = e / f-g is described in a functional block diagram language expressed by the graphic expression shown in FIG.
This application program is downloaded by the PC to the memory map diagram application program area of FIG. 3 inside the RAM in the PLC. Each operation code to be downloaded is a machine language that can be executed by the MPU in the PLC. After the download is completed, the MPU sequentially reads the machine language from a head address and executes each instruction. The codes a to h attached to the instruction codes in the application program area of FIG. 3 are register names used for the operation. This embodiment describes a case where the execution time from the start address of an application program to the address of an end instruction is measured.

【0012】PCはPLCに接続されており、図2のア
プリケーションプログラムの実行時間を測定する場合、
PCの実行時間測定用プログラムを起動し、アプリケー
ションプログラムの実行時間測定範囲であるライン1お
よびライン5を設定する。これによりPCはアプリケー
ションプログラムのライン1の計測開始アドレスを図3
のアプリケーションプログラム領域から算出し、”12
000(H)”番地を得たものとする。次にライン5の
計測終了アドレスを求める場合はライン5のEND”命
令コードのアドレスを図3のアプリケーションプログラ
ム領域から算出し、”12076(H)”番地を得たも
のとする。PCは算出した計測開始アドレスと計測終了
アドレスの2つの物理アドレス値をPLC内RAMの”
START_ADR”31と”END_ADR”32に
書き込む。引き続いて設定変更フラグである”SET_
FLG”33に1を書き込む。
The PC is connected to the PLC, and when measuring the execution time of the application program of FIG.
The execution time measurement program of the PC is started, and lines 1 and 5 which are the execution time measurement range of the application program are set. As a result, the PC sets the measurement start address of line 1 of the application program in FIG.
Is calculated from the application program area of
It is assumed that the address 000 (H) ”has been obtained. Next, when the measurement end address of the line 5 is obtained, the address of the END” instruction code of the line 5 is calculated from the application program area of FIG. "It is assumed that the address has been obtained. The PC stores the two measured physical address values of the measurement start address and the measurement end address in the RAM in the PLC.
Start_ADR ”31 and“ END_ADR ”32. Subsequently, the setting change flag“ SET_ADR ”
Write 1 to FLG "33.

【0013】次に、図4及び5を参照して説明する。電
源投入後、初期化処理を実施し、第1のアドレス設定手
段11と第2のアドレス設定手段21を0クリアし、以
後アプリケーションプログラムを1サイクル実行する度
に前記”SET_FLG”33が1となったかチェック
しており、コンソールより1が書き込まれた場合は、前
記”START_ADR”31と”END_ADR”3
2の変更指令として認識される。
Next, a description will be given with reference to FIGS. After the power is turned on, an initialization process is performed, the first address setting means 11 and the second address setting means 21 are cleared to 0, and thereafter, each time the application program is executed for one cycle, the "SET_FLG" 33 becomes 1. If “1” is written from the console, the “START_ADR” 31 and “END_ADR” 3
2 is recognized as a change command.

【0014】本指令が認識された場合、RAM内 ”S
TART_ADR”31と”END_ADR”32の妥
当性をチェックし、異常が無ければ”START_AD
R”31の内容を第1のアドレス設定手段11へ、”E
ND_ADR”32の内容を第2のアドレス設定手段2
1へそれぞれ設定し、”SET_FLG”33を0クリ
アする。”START_ADR”31の値12000
(H)および ”END_ADR”32の値12076
(H)は妥当であると判断された場合、第1のアドレス
設定手段11への設定値は12000(H)となり、第
2の設定手段21への設定値は12076(H)とな
る。MPUが12000(H)番地の命令を実行するた
めにRAMの”LOAD a”34命令を読み込む場
合、MPUバスのアドレスライン信号は12000
(H)となり、制御ライン信号には読込信号を発生し、
第1のアドレス比較手段12の出力が活性化し、MPU
に割込発生手段7より割込1が発生する。
If this command is recognized, "S"
Check the validity of TART_ADR "31" and "END_ADR" 32, and if there is no abnormality, "START_AD"
R "31 to the first address setting means 11," E
ND_ADR ”32 is stored in the second address setting means 2
Each is set to 1 and “SET_FLG” 33 is cleared to 0. "START_ADR" 31 value of 12000
(H) and the value of “END_ADR” 32 12076
When (H) is determined to be appropriate, the set value for the first address setting means 11 is 12000 (H), and the set value for the second setting means 21 is 12076 (H). When the MPU reads the "LOAD a" 34 instruction of the RAM in order to execute the instruction at the address 12000 (H), the address line signal of the MPU bus becomes 12000 (H).
(H), a read signal is generated as the control line signal,
The output of the first address comparison means 12 is activated and the MPU
, An interrupt 1 is generated by the interrupt generating means 7.

【0015】割込1が発生すると、割込プログラム内に
おいてレジスタ退避の後、カウンタから現在の積算カウ
ント値を読込みRAM内 ”CNT1”36に書き込
み、”INT_FLG”38に1を書き込んだ後、レジ
スタを元の値に復帰し割込プログラムを終了する。割込
1のプログラムを終了すると、RAMの ”LOAD
a”34命令の実行を開始し、以後アプリケーションプ
ログラムを順次実行して行くが、最後の命令である”E
ND”35命令を実行する時点においてMPUバスから
12076(H)番地の読込信号を発生するためアドレ
ス比較手段2の出力が活性化し、MPUに割込発生手段
7より割込2が発生する。
When an interrupt 1 occurs, after the register is saved in the interrupt program, the current integrated count value is read from the counter and written into "CNT1" 36 in the RAM, and 1 is written into "INT_FLG" 38, and then the register is written. Is returned to the original value and the interrupt program ends. When the program of interrupt 1 is completed, “LOAD”
a) The execution of the 34 instructions is started, and thereafter the application program is sequentially executed.
At the time when the ND "35 instruction is executed, the output of the address comparison means 2 is activated to generate a read signal at address 1076 (H) from the MPU bus, and the interrupt generation means 7 generates an interrupt 2 in the MPU.

【0016】割込2が発生すると、割込プログラム内に
おいてレジスタ退避の後、カウンタから現在の積算カウ
ント値を読込みRAM内 ”CNT2”37に書き込
み”INT_FLG”38が1であれば2を書き込んだ
後、レジスタを元の値に復帰し割込プログラムを終了す
る。割込2のプログラムを終了するとRAM内の ”E
ND”35命令を実行するが、これはアプリケーション
プログラムの1サイクルを終了することであり、PLC
のシステムプログラムへの戻りを意味する。システムプ
ログラム内ではアプリケーションプログラムの1サイク
ルを終了する度にRAM内の ”INT_FLG”38
が2になっているかを確認しており、2になっている場
合は割込プログラム1,2において書き込みが行われ
た”CNT1”36および”CNT2”37の値の差分
値CNT2−CNT1を演算することにより、割込1〜
割込2間の基準クロックのパルス数が求まり、これは割
込1〜割込2間の実時間、つまり求める”LOAD
a”34命令から”END”35命令までの実行時間と
なる。
When interrupt 2 occurs, after the register is saved in the interrupt program, the current integrated count value is read from the counter, written into "CNT2" 37 in the RAM, and 2 is written if "INT_FLG" 38 is 1. Thereafter, the register is returned to the original value, and the interrupt program ends. When the program of interrupt 2 is completed, "E"
ND "35 instruction is executed, which ends one cycle of the application program.
Means return to the system program. In the system program, each time one cycle of the application program is completed, "INT_FLG" 38 in the RAM
Is checked to be 2, and if it is 2, the difference value CNT2-CNT1 of the values of "CNT1" 36 and "CNT2" 37 written in the interrupt programs 1 and 2 is calculated. By doing, interrupt 1
The number of pulses of the reference clock between the interrupts 2 is obtained.
a It is the execution time from the "34" instruction to the "END" 35 instruction.

【0017】本演算処理後、”INT FLG”38を
クリアすることにより繰り返し実行時間の測定が可能と
なる。またCNT2−CNT1の演算結果は”CNT”
39に書き込むことにより、PC側から任意の時間に参
照することが可能となり、PC側の画面に繰り返し実時
間表示することが可能である。なお、図5において、C
NT11,CNT12,CNT13は割込1における積
算カウント値、CNT21,CNT22,CNT23は
割込2における積算カウント値であり、それぞれの積算
カウント値の差分値から計測時間T1,T2,T3が算
出される。
After this calculation processing, by clearing "INT FLG" 38, it becomes possible to repeatedly measure the execution time. The calculation result of CNT2-CNT1 is "CNT"
By writing the information in 39, the PC can refer to the screen at an arbitrary time, and the real-time display can be repeatedly performed on the screen of the PC. In FIG. 5, C
NT11, CNT12, and CNT13 are integrated count values in the interrupt 1; CNT21, CNT22, and CNT23 are integrated count values in the interrupt 2; .

【0018】[0018]

【発明の効果】以上説明したように本発明によれば、ア
プリケーションプログラムの任意の部分の実行時間をア
プリケーションプログラムを全く変更することなくリア
ルタイムに計測することが可能であり、高速のPLCプ
ログラム開発において有力な手段を提供することが可能
であり、実用上、極めて有用性の高いものである。
As described above, according to the present invention, the execution time of an arbitrary part of an application program can be measured in real time without changing the application program at all. It is possible to provide a powerful means, and is extremely useful in practical use.

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

【図1】本発明の一実施例のプログラマブルコントロー
ラCPU内部を示す全体構成図である。
FIG. 1 is an overall configuration diagram showing the inside of a programmable controller CPU according to an embodiment of the present invention.

【図2】アプリケーションプログラムの一例を示す図で
ある。
FIG. 2 is a diagram illustrating an example of an application program.

【図3】ランダムアクセスメモリ内メモリマップ図であ
る。
FIG. 3 is a memory map diagram in a random access memory.

【図4】本発明の一実施例を示すシステムプログラムお
よび割込プログラムのフローチャート図である。
FIG. 4 is a flowchart of a system program and an interrupt program showing one embodiment of the present invention.

【図5】本発明の一実施例のタイミングチャート図であ
る。
FIG. 5 is a timing chart of an embodiment of the present invention.

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

1 マイクロプロセッサ 2 リードオンリメモリ 3 ランダムアクセスメモリ 4 カウンタ 5 外部I/F 6 マイクロプロセッサバス 7 割込発生手段 8 基準クロック 11 第1のアドレス設定手段 12 第1のアドレス比較手段 21 第2のアドレス設定手段 22 第2のアドレス比較手段 31 アドレス設定バッファ1 32 アドレス設定バッファ2 33 設定変更フラグ 34 ”LOAD a”命令コード 35 ”END”命令コード 36 計測開始時カウンタ読込値 37 計測終了時カウンタ読込値 38 割込フラグ 39 アプリケーションプログラム実行クロ
ックカウント値
DESCRIPTION OF SYMBOLS 1 Microprocessor 2 Read-only memory 3 Random access memory 4 Counter 5 External I / F 6 Microprocessor bus 7 Interrupt generating means 8 Reference clock 11 First address setting means 12 First address comparing means 21 Second address setting Means 22 Second address comparing means 31 Address setting buffer 1 32 Address setting buffer 2 33 Setting change flag 34 "LOAD a" instruction code 35 "END" instruction code 36 Counter reading value at measurement start 37 Counter reading value at measurement end 38 Interrupt flag 39 Application program execution clock count value

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 プログラマブルコントローラにおいて、
アプリケーションプログラムの計測開始アドレスの物理
アドレスを設定するための第1のアドレス設定手段と、
計測終了アドレスの物理アドレスを設定するための第2
のアドレス設定手段と、マイクロプロセッサバスのアド
レスライン信号と前記第1のアドレス設定手段と比較
し、計測開始された事を検出するための第1のアドレス
比較手段と、マイクロプロセッサバスのアドレスライン
信号と前記第2のアドレス設定手段と比較し、計測終了
された事を検出するための第2のアドレス比較手段と、
その結果から得られる割込検出信号によりマイクロプロ
セッサに対し割込信号を発生させるための割込発生手段
と、前記アプリケーションプログラムの実行計測開始時
の割込から計測終了時の割込までの時間を計測するため
の基準クロックと、この基準クロックをカウントするた
めのカウンタと、アプリケーションプログラムの実行を
管理するためのシステムプログラムを格納したリードオ
ンリメモリと、アプリケーションプログラムとシステム
プログラムの実行を管理するために必要なシステムメモ
リを格納するためのランダムアクセスメモリと、プログ
ラマブルコントローラが制御する外部I/Oモジュール
とアプリケーションプログラムの開発を支援するコンソ
ールとの接続を行なうための外部I/Fを具備し、プロ
グラムコンソールにより任意に設定されるアプリケーシ
ョンプログラムの計測開始アドレスおよび計測終了アド
レス間のプログラム実行時間を実時間で計測することが
できるよう構成したプログラマブルコントローラ。
1. A programmable controller, comprising:
First address setting means for setting a physical address of a measurement start address of the application program;
Second for setting the physical address of the measurement end address
Address setting means, a first address comparing means for comparing the address line signal of the microprocessor bus with the first address setting means, and detecting that the measurement has started, and an address line signal of the microprocessor bus. A second address comparing means for comparing the second address setting means with the second address setting means and detecting that the measurement has been completed;
Interrupt generating means for generating an interrupt signal to the microprocessor based on the interrupt detection signal obtained from the result, and the time from the interrupt at the start of the execution measurement of the application program to the interrupt at the end of the measurement. A reference clock for measuring, a counter for counting this reference clock, a read-only memory storing a system program for managing the execution of the application program, and a management for executing the application program and the system program A program console comprising: a random access memory for storing a required system memory; and an external I / F for connecting an external I / O module controlled by a programmable controller and a console for supporting the development of an application program. Programmable controller configured to program execution time between measurement start address and the measurement end address of the application program can be measured in real time to be more freely set.
JP9187528A 1997-06-27 1997-06-27 Programmable controller Pending JPH1124965A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9187528A JPH1124965A (en) 1997-06-27 1997-06-27 Programmable controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP9187528A JPH1124965A (en) 1997-06-27 1997-06-27 Programmable controller

Publications (1)

Publication Number Publication Date
JPH1124965A true JPH1124965A (en) 1999-01-29

Family

ID=16207673

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9187528A Pending JPH1124965A (en) 1997-06-27 1997-06-27 Programmable controller

Country Status (1)

Country Link
JP (1) JPH1124965A (en)

Similar Documents

Publication Publication Date Title
JP3116901B2 (en) Program inspection method, program inspection device, and recording medium recording program inspection program
JP2806524B2 (en) Vector operation instruction issue control method
US5692163A (en) Process system which generates sets of output data from sets of predetermined input data with duplicate data
JPH1124965A (en) Programmable controller
JP2542392B2 (en) Character drawing device
JPH10143398A (en) Program execution time signal generation circuit
JP2789648B2 (en) Data buffering device
JP2761306B2 (en) Test method of interval timer
JP2674873B2 (en) Step execution operation method of program development support device
JP4058197B2 (en) Drawing apparatus, drawing method, and storage medium
JP3216325B2 (en) Microprocessor
JP2000250779A (en) Programmable controller
JPH0991177A (en) Semiconductor integrated circuit device
JP3693873B2 (en) Mask bit number arithmetic unit, vector processing unit, information processing unit
JPH0831110B2 (en) Logic simulation system
JPS63195781A (en) Digital input device
JPH02202646A (en) Micro program controller
JPH10187133A (en) Data development processor and image processor
JP2007328775A (en) Simulation device, simulation method, and simulation program
JPS6361341A (en) Program debugging device
JPH0242587A (en) Picture processor
JPH0685163B2 (en) Graph display device
JPH07295863A (en) Measurement system for software processing time of numerical controller
JPH11194956A (en) Debugging method for arithmetic processing device and arithmetic processing device
JPH08123956A (en) Image processing device