JPH0630004B2 - Counter preset method in programmable controller - Google Patents
Counter preset method in programmable controllerInfo
- Publication number
- JPH0630004B2 JPH0630004B2 JP57090994A JP9099482A JPH0630004B2 JP H0630004 B2 JPH0630004 B2 JP H0630004B2 JP 57090994 A JP57090994 A JP 57090994A JP 9099482 A JP9099482 A JP 9099482A JP H0630004 B2 JPH0630004 B2 JP H0630004B2
- Authority
- JP
- Japan
- Prior art keywords
- counter
- preset
- memory
- user program
- flag
- 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
Links
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B19/00—Program-control systems
- G05B19/02—Program-control systems electric
- G05B19/04—Program control other than numerical control, i.e. in sequence controllers or logic controllers
- G05B19/042—Program control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Automation & Control Theory (AREA)
- Programmable Controllers (AREA)
Description
【発明の詳細な説明】 この発明はラダーダイヤグラム式で代表されるプログラ
マブル・コントローラに関し、特に、ダウンカウント式
で動作するカウンタ命令の処理手段を備えたものにおい
て、そのカウンタ機能の初期設定(プリセット)の技術
に関する。The present invention relates to a programmable controller typified by a ladder diagram type, and in particular, in a unit provided with a counter instruction processing means operating in a down-count type, initial setting (preset) of the counter function thereof. Of technology.
プログラマブル・コントローラのカウンタ命令とは、良
く知られているように、カウンタ命令で特定した入出力
信号の入力回数を当該カウンタ命令で特定した設定値だ
け計数したとき当該カウンタ命令で特定した出力を発す
るものである。As is well known, the counter instruction of the programmable controller emits the output specified by the counter command when the input count of the input / output signal specified by the counter command is counted by the set value specified by the counter command. It is a thing.
上記のカウンタ命令を実現するための処理は、ユーザプ
ログラム中のカウンタ命令の設定値をプリセット信号
(ユーザプログラムで設定される)に応答してカウンタ
メモリの所定の番号エリアにプリセットし、そのプリセ
ット値をカウント入力信号(ユーザプログラムにて設定
される)が印加される度に順次減算して行き、そのデー
タが0になったときに出力を発する、というダウンカウ
ント方式のデータ処理が一般的である。この方式がデー
タ処理を高速化する上で各段に有利である。The processing for realizing the above counter instruction is performed by presetting the set value of the counter instruction in the user program in a predetermined number area of the counter memory in response to a preset signal (set by the user program), and then the preset value In general, the data processing of the down-count method in which a count input signal (set by the user program) is sequentially subtracted and an output is issued when the data becomes 0 is common. . This method is advantageous for each stage in speeding up data processing.
また、殆どのプログラマブル・コントローラではカウン
タ機能は停電補償されるようになっている。つまり、上
記のカウンタメモリは不揮発性化されていて、停電が生
じてもその値が保持され、停電復帰後にそれ以前から継
続したカウント動作を行なうようになっている。なお、
ここで停電といっているのは、装置の電源スイッチを切
った場合も含まれる。Also, in most programmable controllers, the counter function is designed to be power failure compensated. That is, the above-mentioned counter memory is made non-volatile, and its value is retained even if a power failure occurs, and the counting operation that continues from before the power failure is performed. In addition,
The term "power outage" includes the case where the power switch of the device is turned off.
上述のように構成されたごく一般的なプログラマブル・
コントローラにおいて、ユーザが新たなカウンタ命令を
追加する場合、そのカウンタ命令の設定値をカウンタメ
モリにプリセットしなければならない。A very general programmable device configured as above
When the user adds a new counter command in the controller, the set value of the counter command must be preset in the counter memory.
従来、このような場合のプリセット方式としては、ま
ず、プログラムコンソールのキー入力装置を操作してカ
ウンタメモリに逐一アクセスして書き込むという方式が
ある。しかし、このような方式ではその都度ユーザが手
動によってプリセットしていくという面倒な操作を行な
う必要がある。Conventionally, as a preset method in such a case, first, there is a method of operating the key input device of the program console to access the counter memory one by one and write it. However, in such a method, it is necessary for the user to manually perform presetting each time.
また、ユーザプログラム中に各カウンタ命令に付随して
プリセット回路を設定し(プログラム上である)、新た
なカウンタ命令を追加するときには特別なプリセット回
路をユーザプログラム中に設けるという方式もある。し
かし、この場合も新たに特別なプリセット回路を設けな
ければならないという煩わしさがある。There is also a method in which a preset circuit is set in the user program in association with each counter instruction (on the program), and a special preset circuit is provided in the user program when a new counter instruction is added. However, also in this case, there is a trouble that a special preset circuit must be newly provided.
この発明は上述した従来の問題点に鑑みなされたもので
あり、その目的は、ユーザプログラム中に新たにカウン
タ命令を追加した場合、ユーザが手動によってプリセッ
トしていくという面倒な操作を行なう必要がないととも
に特別なプリセット回路をユーザプログラム中に設ける
必要もなく、自動的にその設定値がカウンタメモリにプ
リセットできるようにしたプログラマブル・コントロー
ラにおけるカウンタのプリセット方式を提供することに
ある。The present invention has been made in view of the above-described conventional problems, and an object thereof is to perform a troublesome operation of manually presetting a counter command when a new counter command is added to a user program. Another object of the present invention is to provide a counter preset method in a programmable controller that allows the preset value to be automatically preset in the counter memory without providing a special preset circuit in the user program.
上記の目的を達成するために、この発明は、ダウンカウ
ント式で動作するカウンタ命令の処理手段を備え、かつ
カウンタデータを記憶するカウンタメモリが不揮発性化
されたプログラマブル・コントローラにおいて、ユーザ
プログラムの実行前に動作する次の各手段を備えること
を特徴とする。To achieve the above object, the present invention executes a user program in a programmable controller including a counter instruction processing unit that operates in a down-counting manner and a counter memory that stores counter data is non-volatile. It is characterized by including the following respective means that operate before.
A…ユーザプログラムで使用されているカウンタ番号を
検索する手段、 B…上記カウンタメモリに各カウンタ番号に対応して設
定されている使用有フラグを最初にすべてクリアし、上
記手段Aで検出されたカウンタ番号に対応する使用有フ
ラグを“1”にする手段、 C…上記手段Aで検出されたカウンタ番号について、上
記カウンタメモリに各カウンタ番号に対応して設定され
ているプリセットフラグのうち、該当のものが“1”か
“0”かをチェックする手段、 D…上記手段Cにて“1”が検出されたとき、上記カウ
ンタメモリの該当番号エリアに該当番号のカウンタ命令
の設定値をプリセットし、かつ該当番号の上記プリセッ
トフラグを“0”にする手段、 E…上記手段Aで検出された使用されているカウンタ番
号以外の残りのカウンタ番号について、該当する上記プ
リセットフラグを“1”にする手段。A: means for retrieving counter numbers used in the user program, B ... first clear all used flags set in the counter memory corresponding to each counter number, and detected by means A Means for setting the used flag corresponding to the counter number to "1", C ... Corresponding to the counter number detected by the means A, among the preset flags set in the counter memory corresponding to the respective counter numbers. Means for checking whether the number is "1" or "0", D ... When the means C detects "1", the preset value of the counter instruction of the corresponding number is preset in the corresponding number area of the counter memory. And the means for setting the preset flag of the corresponding number to "0", E ... The remaining counts other than the used counter number detected by the means A Means for setting the corresponding preset flag to "1" for the data number.
以下、この発明の実施例を図面に基づいて詳細に説明す
る。Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
第1図はこの発明を適用したプログラマブル・コントロ
ーラの全体の概略構成を示すブロック図である。このプ
ログラマブル・コントローラは、全体の制御の中枢とな
るCPU1と、CPU1によって実行されるシステムプ
ログラムを格納したROM2と、CPU1によってシス
テムワーキングメモリとして使われるRAM3と、使用
者が任意に設定したシーケンス制御プログラムが格納さ
れるユーザプログラムメモリ4と、外部入力信号が与え
られる入力インターフェースとなる入力回路5と、外部
出力信号を送出する出力インターフェースとなる出力回
路6と、CPU1に各種の動作指令を与えるとともにユ
ーザープログラムの作成入力等に使用されるプログラム
コンソール7とを備えている。FIG. 1 is a block diagram showing an overall schematic configuration of a programmable controller to which the present invention is applied. This programmable controller includes a CPU 1 which is the center of overall control, a ROM 2 which stores a system program executed by the CPU 1, a RAM 3 which is used as a system working memory by the CPU 1, and a sequence control program which is arbitrarily set by a user. , A user program memory 4 in which is stored, an input circuit 5 serving as an input interface to which an external input signal is applied, an output circuit 6 serving as an output interface for sending an external output signal, and various operation commands to the CPU 1 and the user. A program console 7 used for creating and inputting a program is provided.
RAM3には、入力回路5および出力回路6の各入出力
信号に1対1に対応したバッファメモリとなる入出力メ
モリ31が設定されているとともに、前述したカウンタ
機能の実現のために各カウンタの現在値データを格納す
るカウンタメモリ32が設定されている。カウンタメモ
リ32は不揮発性化されている。第2図はカウンタメモ
リ32の記憶エリアの構成を示している。このメモリ3
2は、予め設定された複数個のカウンタの各番号C1,
C2,C3,…に対応したデータエリアを有する他、本
発明を適用するために、各カウンタ番号に対応しプリセ
ットフラグPと使用有フラグUとが設定されている。The RAM 3 is provided with an input / output memory 31 serving as a buffer memory corresponding to each input / output signal of the input circuit 5 and the output circuit 6 in a one-to-one manner. A counter memory 32 for storing current value data is set. The counter memory 32 is non-volatile. FIG. 2 shows the configuration of the storage area of the counter memory 32. This memory 3
2 is each number C1 of a plurality of preset counters
In addition to having data areas corresponding to C2, C3, ..., In order to apply the present invention, a preset flag P and a used flag U are set corresponding to each counter number.
第3図はCPU1によって実行されるシステムプログラ
ムの概要を本発明の要旨となる部分を中心にして現した
フローチャートである。以下このフローチャートに従っ
て説明する。FIG. 3 is a flow chart showing the outline of the system program executed by the CPU 1 centering on the essential part of the present invention. This will be described below according to this flowchart.
このコントローラに電源を投入すると、所定のイニシャ
ライザル−チンが実行された後、ステップ100でプロ
グラムコンソール7のモードキーの状態が判定される。
モードキーがプログラム実行中を示していればステップ
101でユーザプログラムを一巡実行し、次のステップ
102でプログラムコンソール7の入力受付や表示等の
その他のシステム処理が行なわれ、最初のステップ10
0にもどる。プログラム実行中は上記の動作を繰り返
す。When the controller is powered on, a predetermined initialization is executed, and then the state of the mode key of the program console 7 is determined in step 100.
If the mode key indicates that the program is being executed, the user program is executed once in step 101, and in the next step 102, other system processing such as input reception and display of the program console 7 is performed, and the first step 10
Return to 0. The above operation is repeated during the program execution.
上記モードキーがユーザプログラム実行以外のモードを
示している場合、まずステップ103に進みカウンタメ
モリ30におけるすべての使用有フラグU1,U2,U
3,…を“0”にクリアする。次にステップ104でユ
ーザプログラムを1命令ずつ順番に読出し、ステップ1
05でユーザ命令がカウンタ命令か否かを判断する。カ
ウンタ命令が検出された場合、ステップ106でそのカ
ウンタ命令の番号に対応するプリセットフラグPが
“1”か否かを判断する。このときプリセットフラグP
が“0”であるのは、既にそのカウンタ番号について設
定値をカウンタメモリ32にプリセットしてあることを
意味する。プリセットフラグPが“1”になっているの
は、そのカウンタ番号のカウンタについて未だ設定値を
カウンタメモリ32にプリセットしていないことを意味
する。その場合はステップ107でユーザプログラム中
の設定値を該当する番号のカウンタメモリ32のデータ
エリアにプリセットし、次にステップ108で該当番号
のプリセットフラグを“0”にする。先のステップ10
6でNOと判断された場合およびステップ108の実行
後に、ステップ109にてそれぞれ該当するカウンタ番
号の使用有フラグUを“1”にする。このステップ10
9の実行後およびステップ105でカウンタでないと判
断された場合、次のステップ110でユーザプログラム
の最後までチェック終了したかどうかを判断し、最後ま
で達していない場合はステップ104に戻り、次のユー
ザ命令について上述の動作を繰り返す。ユーザプログラ
ムの最後まで処理が終了すると、ステップ11に進み、
カウンタメモリ32における使用有フラグUが“0”と
なっているカウンタ番号については、それに対応するプ
リセットフラグPを“1”にする。その後ステップ10
2に進む。When the mode key indicates a mode other than the execution of the user program, the process first proceeds to step 103, and all the used flags U1, U2, U in the counter memory 30.
Clear 3, ... to “0”. Next, in step 104, the user program is sequentially read one instruction at a time, and step 1
At 05, it is determined whether the user instruction is a counter instruction. When the counter command is detected, it is judged at step 106 whether or not the preset flag P corresponding to the counter command number is "1". At this time, the preset flag P
"0" means that the set value for the counter number has already been preset in the counter memory 32. The fact that the preset flag P is "1" means that the set value for the counter of that counter number has not yet been preset in the counter memory 32. In that case, the set value in the user program is preset in the data area of the counter memory 32 of the corresponding number in step 107, and then the preset flag of the corresponding number is set to "0" in step 108. Step 10 above
When NO is determined in step 6 and after step 108 is executed, the use flag U of the corresponding counter number is set to "1" in step 109. This step 10
After execution of step 9 and if it is determined in step 105 that the counter is not the counter, it is determined in the next step 110 whether or not the check has been completed up to the end of the user program. The above operation is repeated for the instruction. When the processing is completed up to the end of the user program, the process proceeds to step 11,
For a counter number for which the used flag U in the counter memory 32 is "0", the preset flag P corresponding thereto is set to "1". Then step 10
Go to 2.
以上の処理により、始めて使用されたカウンタ(その対
応するプリセットフラグPが“1”になっている)につ
いては自動的に設定値がカウンタメモリ32にプリセッ
トされ、そのプリセットフラグを“0”にすることによ
ってプリセット済みであることが記録保持される。また
当初のユーザプログラムでは使用されておらず、ユーザ
プログラムの追加変更によって新たに使用されたカウン
タは、その使用有フラグUをチェックすることによって
検出される。By the above processing, the counter memory 32 which is used for the first time (its corresponding preset flag P is “1”) is automatically preset with the set value in the counter memory 32, and the preset flag is set to “0”. As a result, it is recorded and held that the preset has been completed. Further, a counter which is not used in the original user program and which is newly used by the additional change of the user program is detected by checking the used flag U.
なお、上記のステップ103から111までのカウンタ
のプリセット処理は、上記の実施例ではユーザプログラ
ムの実行モード以外の動作モードでこれを行なうように
しているが、本発明はこれに限定されるものではなく、
プログラム実行モードに切替えられ、かつユーザプログ
ラムを実行する前にこれを行なうように構成しても同じ
である。The counter preset processing from steps 103 to 111 is performed in an operation mode other than the user program execution mode in the above embodiment, but the present invention is not limited to this. Without
It is the same if the mode is switched to the program execution mode and configured to do this before executing the user program.
以上詳細に説明したように、この発明に係るプログラマ
ブル・コントローラにおけるカウンタのプリセット方式
によれば、ユーザプログラム中に新たにカウンタ命令を
追加した場合、自動的にその設定値がカウンタメモリに
プリセットされるので、ユーザが手動によってプリセッ
トしていくという面倒な操作を行なう必要がなく、また
特別なプリセット回路をユーザプログラム中に設ける必
要性もなくなる。その結果、動作開始直後のカウントア
ップ状態もなくなり、またプログラム中にカウンタに付
随したリセット回路を余分に追加することがなくなるの
で、ユーザプログラム設計上の制約が少なくなり、ユー
ザプログラム容量の軽減にもつながる。As described in detail above, according to the counter preset method in the programmable controller according to the present invention, when a new counter instruction is added to the user program, the set value is automatically preset in the counter memory. Therefore, it is not necessary for the user to manually perform presetting, and it is not necessary to provide a special preset circuit in the user program. As a result, the count-up state immediately after the start of the operation is eliminated, and an additional reset circuit associated with the counter is not added during programming, so that the restrictions on the user program design are reduced and the user program capacity can be reduced. Connect
第1図はこの発明を適用したプログラマブル・コントロ
ーラの概略構成を示すブロック図、第2図はカウンタメ
モリのデータ構成を示す説明図、第3図はCPUによっ
て実行されるシステムプログラムの概要を本発明の要旨
となる部分を中心にして現わしたフローチャートであ
る。 1…CPU 3…RAM 31…入出力メモリ 32…カウンタメモリ 4…ユーザプログラムメモリ C1,C2,C3,…カウンタ番号 P1,P2,P3…プリセットフラグ U1,U2,U3…使用有フラグFIG. 1 is a block diagram showing a schematic configuration of a programmable controller to which the present invention is applied, FIG. 2 is an explanatory diagram showing a data configuration of a counter memory, and FIG. 3 is an outline of a system program executed by a CPU. 3 is a flowchart showing mainly the part that is the gist of. 1 ... CPU 3 ... RAM 31 ... Input / output memory 32 ... Counter memory 4 ... User program memory C1, C2, C3, ... Counter number P1, P2, P3 ... Preset flag U1, U2, U3 ... Used flag
Claims (1)
の処理手段を備え、かつカウンタデータを記憶するカウ
ンタメモリが不揮発性化されたプログラマブル・コント
ローラにおいて、ユーザプログラムの実行前に動作する
次の各手段を備えることを特徴とするプログラマブル・
コントローラにおけるカウンタのプリセット方式。 A…ユーザプログラムで使用されているカウンタ番号を
検索する手段、 B…上記カウンタメモリに各カウンタ番号に対応して設
定されている使用有フラグを最初にすべてクリアし、上
記手段Aで検出されたカウンタ番号に対応する使用有フ
ラグを“1”にする手段、 C…上記手段Aで検出されたカウンタ番号について、上
記カウンタメモリに各カウンタ番号に対応して設定され
ているプリセットフラグのうち、該当のものが“1”か
“0”かをチェックする手段、 D…上記手段Cにて“1”が検出されたとき、上記カウ
ンタメモリの該当番号エリアに該当番号のカウンタ命令
の設定値をプリセットし、かつ該当番号の上記プリセッ
トフラグを“0”にする手段、 E…上記手段Aで検出された使用されているカウンタ番
号以外の残りのカウンタ番号について、該当する上記プ
リセットフラグを“1”にする手段。1. A programmable controller comprising a counter instruction processing unit that operates in a down-counting manner, and a counter memory that stores counter data is non-volatile. The following units operate before execution of a user program. Programmable characterized by having
Counter preset method in the controller. A: means for retrieving counter numbers used in the user program, B ... first clear all used flags set in the counter memory corresponding to each counter number, and detected by means A Means for setting the used flag corresponding to the counter number to "1", C ... Corresponding to the counter number detected by the means A, among the preset flags set in the counter memory corresponding to the respective counter numbers. Means for checking whether the number is "1" or "0", D ... When the means C detects "1", the preset value of the counter instruction of the corresponding number is preset in the corresponding number area of the counter memory. And the means for setting the preset flag of the corresponding number to "0", E ... The remaining counts other than the used counter number detected by the means A Means for setting the corresponding preset flag to "1" for the data number.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP57090994A JPH0630004B2 (en) | 1982-05-28 | 1982-05-28 | Counter preset method in programmable controller |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP57090994A JPH0630004B2 (en) | 1982-05-28 | 1982-05-28 | Counter preset method in programmable controller |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS58207124A JPS58207124A (en) | 1983-12-02 |
| JPH0630004B2 true JPH0630004B2 (en) | 1994-04-20 |
Family
ID=14014057
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP57090994A Expired - Lifetime JPH0630004B2 (en) | 1982-05-28 | 1982-05-28 | Counter preset method in programmable controller |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0630004B2 (en) |
-
1982
- 1982-05-28 JP JP57090994A patent/JPH0630004B2/en not_active Expired - Lifetime
Also Published As
| Publication number | Publication date |
|---|---|
| JPS58207124A (en) | 1983-12-02 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JPH0630004B2 (en) | Counter preset method in programmable controller | |
| US6182207B1 (en) | Microcontroller with register system for the indirect accessing of internal memory via auxiliary register | |
| JPS5946002B2 (en) | Processing method during power outage and power restoration in sequence control equipment | |
| JPS6333168B2 (en) | ||
| JP3226566B2 (en) | Electronic exchange system | |
| JPS6211369B2 (en) | ||
| JP2560363Y2 (en) | Counter device | |
| JPH02171802A (en) | programmable controller | |
| JP2696811B2 (en) | Electronic preset counter | |
| JPS58106602A (en) | Programmable controller | |
| JP2519867B2 (en) | Differentiating device for controller for construction machine actuator | |
| JPH0619518A (en) | Program calling system | |
| JPH0568726B2 (en) | ||
| JPH035602B2 (en) | ||
| JP2658699B2 (en) | Method of managing device under test of input / output device test program | |
| JPH01183719A (en) | Power supply control system for computer system | |
| JPS6144328B2 (en) | ||
| US20020113535A1 (en) | Microprocessor for saving contextual data when switching to a test program | |
| JPS624729B2 (en) | ||
| JPS58221405A (en) | Programmable controller | |
| JPS6017123B2 (en) | Unmanned operation device for data processing equipment | |
| JPH0462093B2 (en) | ||
| JPS59168528A (en) | Initial program loading system | |
| JPS6371761A (en) | System for defining system condition of online system | |
| JPH01150168A (en) | Copy machine operating mode reset device |