JP4613003B2 - Source program conversion method - Google Patents

Source program conversion method Download PDF

Info

Publication number
JP4613003B2
JP4613003B2 JP2003386660A JP2003386660A JP4613003B2 JP 4613003 B2 JP4613003 B2 JP 4613003B2 JP 2003386660 A JP2003386660 A JP 2003386660A JP 2003386660 A JP2003386660 A JP 2003386660A JP 4613003 B2 JP4613003 B2 JP 4613003B2
Authority
JP
Japan
Prior art keywords
instruction code
argument
instruction
character string
source 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.)
Expired - Fee Related
Application number
JP2003386660A
Other languages
Japanese (ja)
Other versions
JP2005149194A (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.)
Honda Motor Co Ltd
Original Assignee
Honda Motor 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 Honda Motor Co Ltd filed Critical Honda Motor Co Ltd
Priority to JP2003386660A priority Critical patent/JP4613003B2/en
Publication of JP2005149194A publication Critical patent/JP2005149194A/en
Application granted granted Critical
Publication of JP4613003B2 publication Critical patent/JP4613003B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

本発明は、テキスト形式のソースプログラムをコンピュータが読み取り実行可能な実行プログラムに変換するためのソースプログラム変換方法に関する。 The present invention relates to a source program conversion method for converting a source program in a text format into an executable program that can be read and executed by a computer.

数値制御式の加工機械(NC装置)を動作させる加工プログラムはテキスト形式で編集されており、該ソースプログラムには命令コードとして動作の種類の設定コード、目標位置の設定コード及び動作速度の設定コード等が記録される。NC装置では、所定の変換部によってこれらの命令コードを認識、解釈してバイナリ形式の実行プログラムに変換した後、この実行プログラムを実行させてモータ等の制御を行う。   A machining program for operating a numerically controlled machining machine (NC device) is edited in a text format. In the source program, an operation type setting code, a target position setting code, and an operation speed setting code are provided as instruction codes. Etc. are recorded. In the NC device, these instruction codes are recognized and interpreted by a predetermined conversion unit and converted into a binary execution program, and then the execution program is executed to control the motor and the like.

加工プログラムの記述方法はNC装置の変換部の機能に対応しており、1行に1つの命令コードを記述する方法の他に、1行に複数の命令コードを記述する方法や、行の概念がなく連続して命令コードを記述する方法もある。   The machining program description method corresponds to the function of the conversion unit of the NC device. In addition to the method of describing one instruction code in one line, the method of describing a plurality of instruction codes in one line, the concept of the line, etc. There is also a method of writing instruction codes in succession.

1行に複数の命令コードを記述する方法では、NC装置の変換部に各命令コードに対応する処理部を設けて、該処理部において複数の命令コードが併記可能であることを認識するようにしている(例えば、特許文献1参照)。   In the method of describing a plurality of instruction codes in one line, a processing unit corresponding to each instruction code is provided in the conversion unit of the NC device so that the processing unit can recognize that a plurality of instruction codes can be written together. (For example, refer to Patent Document 1).

また、行の概念がなく連続して命令コードを記述する方法では、加工プログラムを命令コード毎に分割して、その後の分割した文字列が併記可能なものであるか否かを認識しながら変換を行っている。   Also, in the method of writing instruction codes continuously without the concept of lines, the machining program is divided for each instruction code, and conversion is performed while recognizing whether the divided character strings can be written together. It is carried out.

特開平10−133726号公報JP-A-10-133726

上記のとおり、NC装置間では加工プログラムに互換性がないため、所定の加工プログラムを他のNC装置に移植しようとする場合、移植先のNC装置における変換部の仕様に合わせて加工プログラムを再編集する必要がある。   As mentioned above, machining programs are not compatible between NC machines, so when trying to port a predetermined machining program to another NC machine, the machining program must be re-run according to the specifications of the conversion unit in the NC machine at the transplant destination. Need to edit.

また、1行に複数の命令コードを記述する方法や、行の概念がなく連続して命令コードを記述する方法では、従来適用されていなかった新規の命令コードが適用される場合には、該命令コードに対応した処理部を追加するだけでは足らず、従来の命令コードに対応する処理部も変更する必要がある。従って、新規の命令コードを追加するためには、処理部の内容を熟知している者でなければ追加の操作を行うことができず、該操作自体にも時間がかかる。   In addition, in a method of describing a plurality of instruction codes in one line or a method of describing instruction codes continuously without a concept of lines, when a new instruction code not conventionally applied is applied, It is not only necessary to add a processing unit corresponding to the instruction code, but it is also necessary to change the processing unit corresponding to the conventional instruction code. Therefore, in order to add a new instruction code, an additional operation cannot be performed unless the user is familiar with the contents of the processing unit, and the operation itself takes time.

本発明はこのような課題を考慮してなされたものであり、プログラムの互換性を向上させるとともに、加工プログラム等のソースプログラムに対して新規の命令コードを適用する際に、該命令コードを簡便に適用させることができるソースプログラム変換方法を提供することを目的とする。 The present invention has been made in consideration of such problems . In addition to improving program compatibility , the application code can be simplified when a new instruction code is applied to a source program such as a machining program. An object of the present invention is to provide a source program conversion method that can be applied to the above.

本発明に係るソースプログラム変換方法は、命令コード及びその引数を含むテキスト形式のソースプログラムをコンピュータが読み取り実行可能な実行プログラムに変換するためのソースプログラム変換方法において、命令コード抽出手段により、前記ソースプログラムの文字列群の先頭文字から順次読み込みながら、あらかじめ適用された命令コード及び該命令コード毎に従属する引数が記録されたリストを参照して、命令コードを抽出する命令抽出工程と、命令コード抽出手段によって抽出された前記命令コードが引数をとるものである場合に、引数抽出手段により、前記リストにおける前記命令コードに対応する箇所を参照し、前記命令コードに続く文字列から該命令コードに対応する引数を抽出する引数抽出工程と、複数の命令コード専用変換手段のうち前記命令コードに対応した命令コード専用変換手段により、前記命令コード抽出手段によって抽出された命令コードを、前記引数抽出手段によって抽出された引数とともに変換し、実行可能な実行コードを生成する変換工程と、命令コード抽出手段により、前記命令コード専用変換手段によって変換される文字列の次に記述された文字列を文字列群の先頭文字とする更新工程とを有し、前記命令抽出工程、前記引数抽出工程、前記変換工程及び前記更新工程を繰り返し実行し、前記引数抽出工程は、前記命令コードに続く文字列を順に調べて引数を順次抽出するとともに、抽出された文字列と同じ文字列の引数がすでに抽出処理済みであるとき、その時点における命令コードに対応した引数の抽出を終了することを特徴とする。 The source program conversion method according to the present invention is a source program conversion method for converting a text source program including an instruction code and its argument into an executable program that can be read and executed by a computer. An instruction extraction step for extracting an instruction code by referring to a list in which an instruction code applied in advance and an argument subordinate to each instruction code are recorded while sequentially reading from the first character of a program character string group; and an instruction code When the instruction code extracted by the extraction means takes an argument, the argument extraction means refers to a location corresponding to the instruction code in the list and changes the instruction code from the character string following the instruction code. Argument extraction process to extract corresponding arguments and multiple instruction codes The instruction code extracted by the instruction code extracting means is converted together with the argument extracted by the argument extracting means by the instruction code exclusive converting means corresponding to the instruction code among the dedicated converting means, and executable executable code is obtained. A conversion step for generating, and an update step for setting the character string described next to the character string converted by the instruction code exclusive conversion means to be the first character of the character string group by the instruction code extraction means , The extraction step, the argument extraction step, the conversion step and the update step are repeatedly executed, and the argument extraction step sequentially examines the character string following the instruction code and sequentially extracts the argument, and the extracted character string and If the argument of the same character string has already extracted processed, characterized in that to terminate the extraction of the argument that corresponds to the instruction code at that point To.

このように、リストを参照しながら命令コード及び引数を抽出することにより、プログラムの互換性を向上させるとともに、ソースプログラムに対して新規の命令コードを適用する際にはリストに命令コード及び引数を追加登録すればよく、該命令コードを簡便に適用させることができる。また、命令コードと引数とを正確に区別することができる。 Thus, by extracting the instruction code and argument while referring to the list, the compatibility of the program is improved, and when applying a new instruction code to the source program, the instruction code and argument are added to the list. What is necessary is just to carry out additional registration, and this instruction code can be applied simply. In addition, the instruction code and the argument can be accurately distinguished.

また、前記リストは、命令コードが記録されている第1リストと、各命令コード毎にその従属する引数が記録されている第2リストとに分けて構成することにより、新規の登録が容易になる。   Further, the list is divided into a first list in which instruction codes are recorded and a second list in which arguments dependent on each instruction code are recorded, so that new registration can be easily performed. Become.

さらに、前記命令コード専用変換手段は、前記命令コード毎に対応して実行コードを生成するバイナリ変換部を有し、前記命令コード専用変換手段には、命令コードに対応したバイナリ変換部を追加登録可能とするとよい。前記引数抽出手段は前記命令コード専用変換手段に含まれ、前記命令コード抽出手段は、前記ソースプログラムの文字列群の先頭文字から順次読み込みながら、前記リストを参照して抽出した命令コードに続く文字列群を前記命令コード専用変換手段に渡すようにしてもよい。前記ソースプログラムは、命令コードと引数の間、及び引数同士の間がスペースで区切られていてもよい。 Further, the instruction code dedicated conversion unit has a binary conversion unit that generates an execution code corresponding to each instruction code, and the instruction code dedicated conversion unit additionally registers a binary conversion unit corresponding to the instruction code. It should be possible. The argument extraction means is included in the instruction code dedicated conversion means, and the instruction code extraction means reads the characters following the instruction code extracted by referring to the list while sequentially reading from the first character of the character string group of the source program. You may make it pass a sequence group to the said instruction code exclusive conversion means. In the source program, an instruction code and an argument, and an argument may be separated by a space.

本発明に係るソースプログラム変換方法によれば、加工プログラム等のソースプログラムに対して新規の命令コードを適用する際に、該命令コードを簡便に適用させることができる。これにより、例えば、それまでの追加登録の履歴を把握していない者であっても、容易且つ短時間に新規の命令コードを追加し、適用させることができる。また、プログラムの互換性が向上する。 According to the source program conversion method of the present invention, when a new instruction code is applied to a source program such as a machining program, the instruction code can be easily applied. Thereby, for example, even a person who has not grasped the history of additional registration so far can add and apply a new instruction code easily and in a short time. In addition, program compatibility is improved.

以下、本発明に係るソースプログラム変換方法について実施の形態を挙げ、添付の図1〜図7を参照しながら説明する。 Hereinafter, the source program conversion method according to the present invention will be described with reference to FIGS.

本実施の形態に係るソースプログラム変換方法は、例えばソースプログラム変換システム10を用いて行われる。図1に示すように、ソースプログラム変換システム10は、加工部12の数値制御を行うNC装置14と、該NC装置14を動作させるための加工プログラム(ソースプログラム)16、第1リスト18及び第2リスト20の編集を行う編集端末22とを有する。加工プログラム16、第1リスト18及び第2リスト20は、編集端末22のエディタ24によってテキスト形式で編集される。 The source program conversion method according to the present embodiment is performed using, for example, the source program conversion system 10. As shown in FIG. 1, source over the scan program conversion system 10 includes a NC device 14 for numerical control processing unit 12, a machining program (source program) for operating the NC device 14 16, the first list 18 and the 2 has an editing terminal 22 for editing the list 20. The processing program 16, the first list 18, and the second list 20 are edited in a text format by the editor 24 of the editing terminal 22.

NC装置14は、編集端末22から転送された加工プログラム16、第1リスト18及び第2リスト20をそれぞれ加工プログラム16a、第1リスト18a及び第2リスト20aとして記録するメモリ26と、第1リスト18a及び第2リスト20aを参照しながら加工プログラム16aを実行プログラム28に変換する変換部30と、実行プログラム28を読み取り実行して前記加工部12を動作させる実行処理部32とを有する。実行処理部32はアンプ34を介してモータ36、ソレノイド37等を作用させ、工具やテーブル等を駆動することによりワークに対する加工を行う。   The NC device 14 includes a memory 26 for recording the machining program 16, the first list 18 and the second list 20 transferred from the editing terminal 22 as a machining program 16a, a first list 18a and a second list 20a, and a first list. A conversion unit 30 that converts the machining program 16a into an execution program 28 with reference to 18a and the second list 20a, and an execution processing unit 32 that reads and executes the execution program 28 to operate the machining unit 12. The execution processing unit 32 processes the workpiece by operating a motor 36, a solenoid 37, and the like via an amplifier 34 and driving a tool, a table, or the like.

変換部30は、加工プログラム16aから所定の長さの文字列を順に読み出す入力部40と、第1リスト18aを参照しながら、入力部40によって読み出された文字列に記述されている命令コードの種類を識別する命令コード抽出部42と、該命令コード抽出部42で識別した命令コードの種類に応じた引数を、第2リスト20aを参照しながら抽出し、実行可能なバイナリ形成に変換する変換処理部(引数抽出手段)44とを有する。該変換処理部44は、各命令コード毎に対応したバイナリ変換部46a、46b、46c、46d、46e及び46fを有する。   The converting unit 30 sequentially reads a character string of a predetermined length from the processing program 16a, and an instruction code described in the character string read by the input unit 40 while referring to the first list 18a. The instruction code extracting unit 42 for identifying the type of the command and an argument corresponding to the type of the instruction code identified by the instruction code extracting unit 42 are extracted with reference to the second list 20a and converted into an executable binary format. A conversion processing unit (argument extraction means) 44. The conversion processing unit 44 includes binary conversion units 46a, 46b, 46c, 46d, 46e, and 46f corresponding to each instruction code.

図2に示すように、加工プログラム16及び16aは、テキスト形式で編集されており、命令コード(「N」、「E」、「G00」等)と、命令コードに従属する引数(「X100.0」、「Y200.0」等)と、コメントが記述されている。   As shown in FIG. 2, the machining programs 16 and 16a are edited in a text format, and include instruction codes (“N”, “E”, “G00”, etc.) and arguments (“X100. 0 ”,“ Y200.0 ”, etc.) and comments.

NC装置14で適用可能な命令コードは「G00」、「G01」、「G02」「E」、「F」及び「N」の6つの命令コードである。引数は省略可能である。命令コード「G00」は変換処理部44におけるバイナリ変換部46aによって変換処理される。同様に、命令コード「G01」、「G02」、「E」、「F」及び「N」は、それぞれバイナリ変換部46b、46c、46d、46e及び46fによって変換処理される。   The instruction codes applicable in the NC device 14 are six instruction codes “G00”, “G01”, “G02”, “E”, “F”, and “N”. The argument can be omitted. The instruction code “G00” is converted by the binary conversion unit 46 a in the conversion processing unit 44. Similarly, the instruction codes “G01”, “G02”, “E”, “F”, and “N” are converted by the binary conversion units 46b, 46c, 46d, 46e, and 46f, respectively.

なお、後述するように、変換処理部44には、新規の命令コードに対応する変換部を追加することが可能であり、例えば、新規の命令コード「G103」に対応するバイナリ変換部46gを追加設定することができる。   As will be described later, a conversion unit corresponding to a new instruction code can be added to the conversion processing unit 44. For example, a binary conversion unit 46g corresponding to a new instruction code “G103” is added. Can be set.

実際上、NC装置14にはより多くの命令コードが存在するが、理解を容易にするために代表的な6つの命令コードと、新規の命令コード「G103」に限って説明する。   Actually, more instruction codes exist in the NC device 14, but only six typical instruction codes and a new instruction code “G103” will be described for easy understanding.

変換部30で変換可能な加工プログラム16aの書式は、1行に複数の命令コードを記述することが可能であって、命令コード毎に他の命令コードとの併記が許可されるか又は排他的であるかが規定されている。併記が許可される命令コードは、1行に複数を記述可能である。排他的な命令コード同士を1行に記述することは禁止されており、併記が許可される1以上の命令コードと1つの排他的な命令コードを記述することは可能である。   The format of the machining program 16a that can be converted by the conversion unit 30 can describe a plurality of instruction codes in one line, and is allowed to be combined with other instruction codes for each instruction code or exclusive. It is prescribed whether or not. A plurality of instruction codes permitted to be written together can be described in one line. It is forbidden to describe exclusive instruction codes in one line, and it is possible to describe one or more instruction codes and one exclusive instruction code that are allowed to be written together.

「G00」の命令コードは、非補間の位置決めコードであって、排他的な命令コードである。また、引数は3次元座標としての「X」、「Y」及び「Z」と、姿勢を示す「A」、「B」及び「C」である。   The instruction code “G00” is a non-interpolated positioning code and an exclusive instruction code. The arguments are “X”, “Y”, and “Z” as three-dimensional coordinates, and “A”, “B”, and “C” indicating the posture.

「G01」の命令コードは、直線補間コードであり、排他的な命令コードである。また、引数は「X」、「Y」、「Z」、「A」、「B」及び「C」である。   The instruction code “G01” is a linear interpolation code and is an exclusive instruction code. The arguments are “X”, “Y”, “Z”, “A”, “B”, and “C”.

「G02」の命令コードは、時計回りの円弧補間コードであり、排他的な命令コードである。また、引数は「X」、「Y」、「Z」及び円弧の半径としての「R」である。   The instruction code “G02” is a clockwise circular interpolation code and is an exclusive instruction code. The arguments are “X”, “Y”, “Z” and “R” as the radius of the arc.

「E」の命令コードは、各軸速度の指定コードであり、他命令コードとの併記は許可されている。また、引数はない。   The instruction code “E” is a designation code for each axis speed, and writing with other instruction codes is permitted. There are no arguments.

「F」の命令コードは、補間動作速度指定コードであり、他命令コードとの併記は許可されている。また、引数はない。   The instruction code “F” is an interpolation operation speed designation code, and writing with other instruction codes is permitted. There are no arguments.

「N」の命令コードは、ラベル番号指定コードであり、他命令コードとの併記は許可されている。また、引数はない。この「N」の命令コードは、所定の分岐命令(いわゆるGO TO文等)に対応する分岐先として利用可能である。   The instruction code “N” is a label number designation code, and is allowed to be written together with other instruction codes. There are no arguments. The instruction code “N” can be used as a branch destination corresponding to a predetermined branch instruction (so-called GO TO statement or the like).

例えば、「N10」という記述は、ラベル番号「10」を指定する命令であり、「N」の直後に対応する数値を記述する。「F」及び「N」も同様である。また、行番号を10番として採番し、動作としてX=100.0[mm]、Y=200.0[mm]の位置へ各軸速度を100[%]で移動させる場合には、
「N10 G00 X100.0 Y200.0 E100」
という文字列を1行に記述すればよい。
For example, the description “N10” is an instruction for designating the label number “10”, and a corresponding numerical value is described immediately after “N”. The same applies to “F” and “N”. In addition, when the line number is assigned as No. 10 and each axis speed is moved to the position of X = 100.0 [mm] and Y = 200.0 [mm] as an operation at 100 [%],
"N10 G00 X100.0 Y200.0 E100"
May be described in one line.

なお、これらの命令のうちいくつかは、JIS B 6315−2及びISO/DIS6983−2にも規定されている。   Some of these instructions are also defined in JIS B 6315-2 and ISO / DIS 6983-2.

図3Aに示すように、第1リスト18及び18aには各命令コードが記録されている。   As shown in FIG. 3A, each instruction code is recorded in the first lists 18 and 18a.

図4Aに示すように、第2リスト20及び20aには各命令コード毎にその従属する引数が記録されている。このうち、引数を有する命令コードの行には、最後の引数の欄の右側欄にそれ以上の引数がないことを示す「−」が記録されている。また、命令コード「E」、「F」及び「N」には、従属する引数がないことから、最初の欄に「−」が記録されており、引数がないことを示している。   As shown in FIG. 4A, the dependent arguments are recorded for each instruction code in the second lists 20 and 20a. Among these, “−” indicating that there are no more arguments is recorded in the right column of the last argument column in the line of the instruction code having the argument. In addition, since the instruction codes “E”, “F”, and “N” have no dependent argument, “−” is recorded in the first column, indicating that there is no argument.

第1リスト18に命令コード、第2リスト20に引数をそれぞれ分けて記録することにより適用済みの命令コード及び引数が明瞭になり、後述するように新規の命令コードを追加登録する際にも編集が容易である。   By separately recording the instruction codes in the first list 18 and the arguments in the second list 20, the applied instruction codes and arguments are clarified and edited when a new instruction code is additionally registered as will be described later. Is easy.

次に、このように構成されるソースプログラム変換システム10によって、加工プログラム16を実行プログラム28に変換する手順(ソースプログラム変換方法)について、図5〜図7を参照しながら説明する。図5に示す処理のうち、ステップS1〜S4は、主に前記入力部40によって実行される処理であり、ステップS5〜S14は主に前記命令コード抽出部42によって実行される処理である。また、図6に示す処理は、主に変換処理部44のバイナリ変換部46aによって実行される処理である。 Next, a procedure (source program conversion method) for converting the machining program 16 into the execution program 28 by the source program conversion system 10 configured as described above will be described with reference to FIGS. Of the processes shown in FIG. 5, steps S <b> 1 to S <b> 4 are processes mainly executed by the input unit 40, and steps S <b> 5 to S <b> 14 are processes mainly executed by the instruction code extraction unit 42. Further, the process illustrated in FIG. 6 is a process mainly executed by the binary conversion unit 46 a of the conversion processing unit 44.

先ず、ステップS1において、編集端末22のエディタ24によって加工プログラム16を編集する。この編集作業は、いわゆるプログラミング作業であり、NC装置14が所定の動作を行うことができるように加工プログラム16を作成・編集する。また、第1リスト18及び第2リスト20は、あらかじめ図3A及び図4Aに示すように作成されているものとする。   First, in step S <b> 1, the machining program 16 is edited by the editor 24 of the editing terminal 22. This editing operation is a so-called programming operation, and the machining program 16 is created and edited so that the NC device 14 can perform a predetermined operation. Further, it is assumed that the first list 18 and the second list 20 are created in advance as shown in FIGS. 3A and 4A.

加工プログラム16は、テキスト形式で編集され、第1リスト18及び第2リスト20はテキスト形式又はバイナリ形式で編集されている。   The processing program 16 is edited in a text format, and the first list 18 and the second list 20 are edited in a text format or a binary format.

次に、ステップS2において、加工プログラム16、第1リスト18及び第2リスト20をNC装置14のメモリ26に転送し、加工プログラム16a、第1リスト18a及び第2リスト20aとして記録する。   Next, in step S2, the machining program 16, the first list 18 and the second list 20 are transferred to the memory 26 of the NC device 14, and recorded as the machining program 16a, the first list 18a and the second list 20a.

次いで、ステップS3において、所定の変換開始指示操作により、入力部40がメモリ26内の加工プログラム16aに対するアクセスを可能にするためのオープン処理を行う。加工プログラム16aは、図2に示すように編集されているものとする。   Next, in step S3, an open process for enabling the input unit 40 to access the machining program 16a in the memory 26 is performed by a predetermined conversion start instruction operation. It is assumed that the machining program 16a has been edited as shown in FIG.

さらに、ステップS4において、入力部40は加工プログラム16aから1行を所定のバッファに読み込む。このステップS4の処理は、実行される度に先頭から順に1行ずつを読み込むことができるように、加工プログラム16aにおける行を示す所定の行ポインタにより制御される。   Furthermore, in step S4, the input unit 40 reads one line from the machining program 16a into a predetermined buffer. The processing in step S4 is controlled by a predetermined line pointer indicating a line in the machining program 16a so that each line can be read in order from the beginning each time it is executed.

次に、ステップS5において、読み込んだ行がファイルの終端を示す「EOF」コードであるか否かを確認する。バッファ中の文字列が「EOF」コードであるときには処理を終了し、それ以外のときにはステップS6へ進む。   Next, in step S5, it is confirmed whether or not the read line is an “EOF” code indicating the end of the file. If the character string in the buffer is an “EOF” code, the process is terminated; otherwise, the process proceeds to step S6.

ステップS6においては、バッファ中の文字列からコメントの文字列を削除する。つまり、括弧“(”及び閉じ括弧“)”で囲まれる範囲の文字列をその括弧を含んで削除し、さらに、その行におけるセミコロン“;”以降の文字列を削除する。   In step S6, the comment character string is deleted from the character string in the buffer. That is, a character string in a range surrounded by parentheses “(” and closing parenthesis “)” is deleted including the parentheses, and a character string after the semicolon “;” in the line is deleted.

これにより、例えば、加工プログラム16の第1行目の文字列(図2参照)の場合、「(10番のタップ位置へ移動)」という文字列と、「;速度設定」という文字列が削除され、
「G00 X100.0 Y200.0 E100」
という文字列がバッファ中に残る。
Thereby, for example, in the case of the character string in the first line of the machining program 16 (see FIG. 2), the character string “(move to the tap position of No. 10)” and the character string “; speed setting” are deleted. And
"G00 X100.0 Y200.0 E100"
Will remain in the buffer.

次に、ステップS7において、読み取り位置を示す命令抽出用ポインタをバッファの先頭にセットする。つまり、上記の文字列の場合には、先頭の文字である「G」の部分に所定の命令抽出用ポインタがセットされる。この命令抽出用ポインタはステップS8以降の処理においてバッファにおける位置が移動する。   In step S7, an instruction extraction pointer indicating the reading position is set at the head of the buffer. That is, in the case of the above character string, a predetermined instruction extraction pointer is set in the portion “G” which is the first character. The position of the instruction extraction pointer in the buffer is moved in the processing after step S8.

次いで、ステップS8において、その時点の命令抽出用ポインタの位置を調べ、該命令抽出用ポインタがバッファの終端にある場合には前記ステップS4へ戻り、それ以外の場合には次のステップS9へ移る。ステップS4へ戻る場合には加工プログラム16aから次の行の文字列をバッファに順次読み込み、該文字列に対して処理を続行することになる。   Next, in step S8, the position of the instruction extraction pointer at that time is checked. If the instruction extraction pointer is at the end of the buffer, the process returns to step S4. Otherwise, the process proceeds to the next step S9. . When returning to step S4, the character string of the next line is sequentially read from the processing program 16a into the buffer, and the processing is continued for the character string.

ステップS9において、その時点における命令抽出用ポインタの位置から次のスペース位置までに含まれる文字列を命令コードとして抽出する。上記の文字列の場合には、当初「G00」という命令コードの文字列が抽出される。   In step S9, a character string included between the position of the instruction extraction pointer at that time and the next space position is extracted as an instruction code. In the case of the above character string, the character string of the instruction code “G00” is initially extracted.

ステップS10において、抽出された命令コードを示す文字列が第1リスト18aにあるか否かを確認する。該文字列が第1リスト18aに存在する場合には、次のステップS11へ移り、存在しない場合には所定の異常表示を行い、処理を終了する。   In step S10, it is confirmed whether or not the character string indicating the extracted instruction code is in the first list 18a. If the character string exists in the first list 18a, the process proceeds to the next step S11. If the character string does not exist, a predetermined abnormality is displayed, and the process is terminated.

ステップS11において、抽出された命令コードに対応する所定のバイナリ変換部を変換処理部44から呼び出す。具体的には、抽出された命令コードが「G00」である場合には、対応するバイナリ変換部46aを呼び出す。   In step S <b> 11, a predetermined binary conversion unit corresponding to the extracted instruction code is called from the conversion processing unit 44. Specifically, when the extracted instruction code is “G00”, the corresponding binary conversion unit 46a is called.

次に、ステップS12において、呼び出されたバイナリ変換部を実行させる。このとき、バイナリ変換部に対して、抽出された命令コードに続く文字列を引き渡す。つまり、上記の文字列の場合には、「G00」に続く文字列である
「X100.0 Y200.0 E100」
という文字列をバイナリ変換部46aに引き渡す。このバイナリ変換部46aにおける処理については後述する。
Next, in step S12, the called binary conversion unit is executed. At this time, the character string following the extracted instruction code is delivered to the binary conversion unit. That is, in the case of the above character string, “X100.0 Y200.0 E100” which is a character string following “G00”.
Is transferred to the binary conversion unit 46a. The processing in the binary conversion unit 46a will be described later.

次いで、ステップS13において、バイナリ変換部によって認識された引数を確認し、バッファ上において該引数の文字列に続く次の文字の位置に命令抽出用ポインタを移動する。つまり、上記の文字列における最初の命令コード「G00」に対応したバイナリ変換部46aを呼び出した場合には、引数が「X100.0 Y200.0」であると認識され、命令抽出用ポインタはそれに続く文字である「E」の位置にセットされる。 Then, Oite to step S1 3, confirm the arguments that are recognized by the binary conversion unit, to move the instruction extraction pointer at the position of the next character following the string of the cited number in the buffer. That is, when the binary conversion unit 46a corresponding to the first instruction code “G00” in the character string is called, the argument is recognized as “X100.0 Y200.0”, and the instruction extraction pointer is It is set at the position of “E” which is the subsequent character.

さらにステップS14において、バイナリ変換部における処理中にエラーが発生したか否かを確認し、エラーがある場合には所定の異常表示を行い、処理を終了する。それ以外の場合、つまり正常である場合には前記ステップS8へ戻りバッファ中の次の文字列に対して処理を続行する。   Furthermore, in step S14, it is confirmed whether or not an error has occurred during the processing in the binary conversion unit. If there is an error, a predetermined abnormality is displayed and the processing is terminated. In other cases, that is, in the case of normality, the process returns to step S8 to continue the process for the next character string in the buffer.

このようにして、加工プログラム16aに記述された文字列を、ステップS4〜S8において1行ずつバッファに順次読み込むとともに、ステップS9〜S14においてバッファ内の文字列を分解して、バイナリ変換部46a〜46fによって順次バイナリ形式に変換することができる。   In this way, the character strings described in the machining program 16a are sequentially read into the buffer line by line in steps S4 to S8, and the character strings in the buffer are decomposed in steps S9 to S14, so that the binary conversion units 46a to 46a. 46f can be sequentially converted into a binary format.

次に、前記ステップS12におけるバイナリ変換部の処理について図6を参照しながら説明する。なお、本説明では、代表例として、バイナリ変換部のうち命令コード「G00」に対応するバイナリ変換部46aが、命令コード抽出部42から文字列「X100.0 Y200.0 E100」の引き渡しを受けた場合について説明する。   Next, the processing of the binary conversion unit in step S12 will be described with reference to FIG. In this description, as a representative example, the binary conversion unit 46a corresponding to the instruction code “G00” in the binary conversion unit receives the character string “X100.0 Y200.0 E100” from the instruction code extraction unit 42. The case will be described.

先ず、ステップS101において、引き渡しを受けた文字列における先頭の文字「X」の位置に引数抽出用ポインタをセットしておく。   First, in step S101, an argument extraction pointer is set at the position of the first character “X” in the delivered character string.

次に、ステップS102において、対応する命令コードである「G00」は引数をとるか否かを確認する。具体的には、第2リスト20aを参照して、命令コード「G00」の行を参照し、この行に引数を示す文字がなく、文字「−」のみが記録されているときにはステップS108へ移り、引数を示す文字列が記録されている場合には、ステップS103へ移る。   Next, in step S102, it is confirmed whether or not the corresponding instruction code “G00” takes an argument. Specifically, referring to the second list 20a, the line of the instruction code “G00” is referred to. If there is no character indicating an argument in this line and only the character “−” is recorded, the process proceeds to step S108. If a character string indicating an argument is recorded, the process proceeds to step S103.

また、引数がない命令コードは第2リスト20aに登録しないこととし、該第2リスト20aを参照したときに対応する文字列がない場合にステップS108へ移るようにしてもよい。   Further, instruction codes having no argument may not be registered in the second list 20a, and the process may move to step S108 when there is no corresponding character string when the second list 20a is referred to.

次に、ステップS103において、第2リスト20aにおける「G00」の行を参照し、その時点における引数抽出用ポインタが示す文字(例えば、「X」)が存在するか否かを調べる。対応する文字がないときにはステップS108へ移り、該文字が存在するときにはステップS104へ移る。   Next, in step S103, the line “G00” in the second list 20a is referenced to check whether or not there is a character (eg, “X”) indicated by the argument extraction pointer at that time. When there is no corresponding character, the process proceeds to step S108, and when the character exists, the process proceeds to step S104.

なお、上記のとおり、命令コード「G00」は、引数として「X」、「Y」、 「Z」、「A」、「B」及び「C」の6つをとり得るが、引数の数は6以下の任意の数でよく、例えば、引数が全くなくてもよい。   As described above, the instruction code “G00” can take six arguments “X”, “Y”, “Z”, “A”, “B”, and “C”. Any number of 6 or less may be used. For example, there may be no argument.

ステップS104において、その時点における引数抽出用ポインタが示す文字がすでに処理済みであるか否かを確認する。つまり、後述するように、ある引数が所定の命令コードと同じ文字列に適用されている場合であっても、引き渡された文字列のうち先頭側に存在する文字列を引数として識別し、後側に存在する文字列を「G00」に続く次の命令コードであると識別することができる。   In step S104, it is confirmed whether or not the character indicated by the argument extraction pointer at that time has already been processed. In other words, as will be described later, even if a certain argument is applied to the same character string as the predetermined instruction code, the character string existing at the beginning of the passed character string is identified as an argument, and The character string existing on the side can be identified as the next instruction code following “G00”.

引数抽出用ポインタが示す文字がすでに処理済みである場合には、ステップS108へ移り、それ以外の場合にはステップS105へ移る。   If the character indicated by the argument extraction pointer has already been processed, the process proceeds to step S108; otherwise, the process proceeds to step S105.

ステップS105においては、その時点における引数抽出用ポインタの位置から次のスペース位置までに含まれる数値を示す文字列を抽出し、引数抽出用ポインタの示す文字と組み合わせて、その引数が示す数値データとして認識する。   In step S105, a character string indicating a numerical value included from the position of the argument extraction pointer at that time to the next space position is extracted and combined with the character indicated by the argument extraction pointer as numerical data indicated by the argument. recognize.

具体的には、引数抽出用ポインタが「X」を示す場合には、引数Xを、X=100.0として認識し、メモリ26上の所定の変数エリア(又は所定のバッファ)に記録する。この場合、「100.0」という文字列としてではなく数値データとして記録してもよい。   Specifically, when the argument extraction pointer indicates “X”, the argument X is recognized as X = 100.0, and is recorded in a predetermined variable area (or a predetermined buffer) on the memory 26. In this case, it may be recorded as numerical data instead of the character string “100.0”.

次に、ステップS106において、前記ステップS105において認識した数値データがあらかじめ規定された適正範囲の値であるか否かを確認する。適正である場合には、ステップS107へ移り、不適正である場合には所定の異常表示を行い、処理を終了する。数値データが不適正である場合には、所定のワーニング表示を行った後にステップS107へ移って処理を続行してもよい。   Next, in step S106, it is confirmed whether or not the numerical data recognized in step S105 is in a proper range defined in advance. If it is appropriate, the process proceeds to step S107. If it is not appropriate, a predetermined abnormality is displayed, and the process is terminated. If the numerical data is inappropriate, after a predetermined warning display is performed, the process may proceed to step S107 to continue.

ステップS107においては、その時点まで認識した引数と該引数に付属する数値を示す文字列の次の文字に引数抽出用ポインタをセットする。つまり、引数を示す文字列「X」に対して、X=100.0と認識した後には、引数抽出用ポインタを次の文字列「Y」の位置にセットする。この後、前記ステップS102へ移る。   In step S107, an argument extraction pointer is set to the character next to the character string indicating the argument recognized up to that point and the numerical value attached to the argument. That is, for a character string “X” indicating an argument, after recognizing that X = 100.0, the argument extraction pointer is set at the position of the next character string “Y”. Thereafter, the process proceeds to step S102.

このようにして、ステップS102〜S107を繰り返し行うことにより、文字列「X100.0 Y200.0 E100」に対して、命令コード「G00」に対応する引数をX=100.0、Y=200.0として認識することができる。この後、引数抽出用ポインタが文字列「E」の位置にセットされたときには、前記ステップS103により、該文字列「E」が引数でないことが認識されてステップS108へ移る。   In this way, by repeatedly performing steps S102 to S107, the argument corresponding to the instruction code “G00” is set to X = 100.0, Y = 200.X for the character string “X100.0 Y200.0 E100”. It can be recognized as 0. Thereafter, when the argument extraction pointer is set at the position of the character string “E”, it is recognized in step S103 that the character string “E” is not an argument, and the process proceeds to step S108.

ステップS108(変換手段)においては、その時点までに認識された引数の数(0〜6)と各引数の数値データを反映させて「G00」をバイナリ形式に変換する。   In step S108 (conversion means), “G00” is converted into a binary format by reflecting the number of arguments (0 to 6) recognized up to that point and the numerical data of each argument.

ここでいう変換とは、単に「G00」という文字列をバイナリ形式に表現形式だけを変えることではなく、NC装置14において実行処理部32が読み取り実行可能な形式(つまり実行コード)に変換することをいう。変換したコードは、実行プログラム28を記録する領域に対して、所定のアドレス順に書き込む。   The conversion here does not simply change the expression format of the character string “G00” into a binary format, but converts it into a format (ie, an execution code) that can be read and executed by the execution processing unit 32 in the NC device 14. Say. The converted code is written in a predetermined address order in the area where the execution program 28 is recorded.

この後、引き渡しを受けた文字列「X100.0 Y200.0 E100」のうち、この時点における引数抽出用ポインタの位置である「E」の位置に基づき、「X100.0 Y200.0」までが認識済みであり、これに続く文字列「E100」が未処理である旨を命令コード抽出部42に通知する。命令コード抽出部42では、この通知に基づき前記ステップS13において命令抽出用ポインタを移動させる。   Thereafter, up to “X100.0 Y200.0” based on the position of the argument extraction pointer at this point in the character string “X100.0 Y200.0 E100” that has been delivered. The instruction code extraction unit 42 is notified that the character string “E100” that has been recognized has not yet been processed. Based on this notification, the instruction code extraction unit 42 moves the instruction extraction pointer in step S13.

ステップS108の処理の後、バイナリ変換部46aにおける今回の処理、つまり図6に示す処理を終了する。加工プログラム16aに命令コードとしての文字列「G00」が複数記述されている場合には、バイナリ変換部46aが再度呼び出されることはもちろんである。   After the processing in step S108, the current processing in the binary conversion unit 46a, that is, the processing shown in FIG. Of course, when a plurality of character strings “G00” as instruction codes are described in the machining program 16a, the binary conversion unit 46a is called again.

ここまで命令コード「G00」に対応したバイナリ変換部46aの処理について説明したが、他の命令コード「G01」、「G02」、「E」、「F」及び「N」についても、バイナリ変換部46b〜46f(図1参照)によって同様に処理される。バイナリ変換部46a〜46fは、ステップS101〜S107に相当する部分は共通にして、ステップS108に相当する部分だけを個別に設けるようにしてもよい。   Although the processing of the binary conversion unit 46a corresponding to the instruction code “G00” has been described so far, the binary conversion unit is also used for the other instruction codes “G01”, “G02”, “E”, “F”, and “N”. The same processing is performed by 46b to 46f (see FIG. 1). The binary conversion units 46a to 46f may share portions corresponding to steps S101 to S107 in common and provide only portions corresponding to step S108 individually.

また、上記の例では、1行に2つの命令コード「G00」及び「E100」が含まれている例について説明したが、1行に3つ以上の命令コードが含まれている場合も同様に処理可能である。   In the above example, an example in which two instruction codes “G00” and “E100” are included in one line has been described. Similarly, when three or more instruction codes are included in one line. It can be processed.

ところで、加工プログラム16aに記述される命令コードは、動作命令と非動作命令に区別される。動作命令とは、モータ36やソレノイド37等のアクチュエータを実際に動作させる命令であり、非動作命令は、速度設定や送り設定等のパラメータ設定用の命令であり、実際の動作を伴うことがない。   By the way, the instruction codes described in the machining program 16a are classified into operation instructions and non-operation instructions. The operation command is a command for actually operating an actuator such as the motor 36 or the solenoid 37, and the non-operation command is a command for parameter setting such as speed setting or feed setting, and does not involve actual operation. .

動作命令と非動作命令を組み合わせて、例えば、各軸の速度を100[%]に設定し、X=100.0、Y=200.0の座標に位置決めするように加工プログラム16aに記述する際、
「G00 X100.0 Y200.0 E100」
という記述と、
「E100 G00 X100.0 Y200.0」
という記述の両方が許容されている場合がある。
When describing in the machining program 16a by combining the motion command and the non-motion command, for example, setting the speed of each axis to 100 [%] and positioning to the coordinates of X = 100.0, Y = 200.0. ,
"G00 X100.0 Y200.0 E100"
And the description
“E100 G00 X100.0 Y200.0”
Both of the descriptions may be allowed.

このような場合には、前記ステップS108において変換したコードを、実行プログラム28を記録する領域に対して直接に書き込むのではなく、一度、動作命令用の記録領域と、非動作命令用の記録領域に分けて書き込み、加工プログラム16aの全て(又は所定の部分)まで変換が終わった後にコードを並び替えて実行プログラム28として記録してもよい。   In such a case, the code converted in step S108 is not directly written in the area for recording the execution program 28, but once for the operation instruction recording area and the non-operation instruction recording area. The codes may be rearranged and recorded as the execution program 28 after the conversion to the entire processing program 16a (or a predetermined portion) is completed.

以上の手順によって加工プログラム16aを変換することによって作成された実行プログラム28は、実行処理部32のコンピュータによって読み取り実行され、アンプ34を介してモータ36及びソレノイド37等を制御する。   The execution program 28 created by converting the machining program 16a by the above procedure is read and executed by the computer of the execution processing unit 32, and controls the motor 36, the solenoid 37, and the like via the amplifier 34.

なお、上記の手順は、加工プログラム16aに基づいて実行プログラム28を一度作成した後に、該実行プログラム28を実行させるという、いわゆるコンパイラ型の変換システムとしてもよいし、また、加工プログラム16aを実行プログラム28に変換しながら、変換した部分を直ちに実行させるという、いわゆるインタプリタ型の変換システムとしてもよい。   The above procedure may be a so-called compiler type conversion system in which the execution program 28 is executed once after the execution program 28 is created based on the machining program 16a, or the machining program 16a is executed as the execution program. It may be a so-called interpreter type conversion system in which the converted portion is immediately executed while being converted to 28.

次に、加工プログラム16に新規の命令コードを適用させる場合に、該加工プログラム16を実行プログラム28に変換する手順について説明する。   Next, a procedure for converting the machining program 16 into the execution program 28 when a new instruction code is applied to the machining program 16 will be described.

ここで説明する新規の命令コードは、従来適用されていなかったものであり、「G103」と表現されるものとする。また、この命令コード「G103」は、タップサイクルを設定するコードであって、排他的な命令コードであり、引数には工具の回転数を示す「N」と、ピッチを示す「F」と、タイマ設定用の「P」とをとり得るものとする。   The new instruction code described here is not applied conventionally and is expressed as “G103”. The instruction code “G103” is a code for setting a tap cycle, and is an exclusive instruction code. The argument includes “N” indicating the number of rotations of the tool, “F” indicating the pitch, It is assumed that “P” for timer setting can be taken.

この命令コード「G103」を用いて、加工プログラム16に
「G103 N8 F0.8 P1.0 F600」
という文字列を記述した場合について以下に説明する。
Using this instruction code “G103”, “G103 N8 F0.8 P1.0 F600” is added to the machining program 16.
The case where the character string is described will be described below.

この場合、2つの文字列「F」のうち先頭側の「F0.8」は「G103」の引数で、ピッチが0.8[mm]であることを示す。一方、後側の「F600」は、「G103」とは別の命令コードであって、補間動作速度が600[mm/s]であることを示す。また、「N8」は、「G103」の引数であって、工具の回転数が8回であることを示し、前記の命令コード「N」とは異なる。「P1.0」は、「G103」の引数であって、1.0[s]のタイマ機能を示す。   In this case, “F0.8” at the head of the two character strings “F” is an argument of “G103” and indicates that the pitch is 0.8 [mm]. On the other hand, “F600” on the rear side is an instruction code different from “G103”, and indicates that the interpolation operation speed is 600 [mm / s]. “N8” is an argument of “G103”, which indicates that the number of rotations of the tool is 8, and is different from the instruction code “N”. “P1.0” is an argument of “G103” and indicates a timer function of 1.0 [s].

加工プログラム16に新規の命令コード「G103」を記述し、該加工プログラム16を実行プログラム28に変換する際、準備として図7に示す作業を行う。   When a new instruction code “G103” is described in the machining program 16 and the machining program 16 is converted into the execution program 28, the work shown in FIG. 7 is performed as a preparation.

先ず、ステップS201において、変換処理部44(図1参照)に新規の命令コード「G103」をバイナリコードに変換するためのバイナリ変換部46g(図1参照)を追加登録する。この場合、他のバイナリ変換部46a〜46f及び命令コード抽出部42は変更する必要がない。   First, in step S201, a binary conversion unit 46g (see FIG. 1) for converting a new instruction code “G103” into a binary code is additionally registered in the conversion processing unit 44 (see FIG. 1). In this case, it is not necessary to change the other binary conversion units 46a to 46f and the instruction code extraction unit 42.

バイナリ変換部46gは、図6に基づいて説明したバイナリ変換部46aと基本的に同じ構成であり、前記ステップS108に相当する部分が異なる。つまり、バイナリ変換部46aは命令コード「G00」をバイナリ形式に変換することに対して、バイナリ変換部46gにおけるステップS108に相当する部分では命令コード「G103」をバイナリ形式に変換する。以下の説明では、バイナリ変換部46gに対して、図6と同じステップ番号を用いて説明する。   The binary conversion unit 46g has basically the same configuration as the binary conversion unit 46a described with reference to FIG. 6, and the part corresponding to step S108 is different. That is, the binary conversion unit 46a converts the instruction code “G00” into the binary format, whereas the binary conversion unit 46g converts the instruction code “G103” into the binary format in the portion corresponding to step S108. In the following description, the binary conversion unit 46g will be described using the same step numbers as in FIG.

次に、ステップS202において、第1リスト18に新規の命令コード「G103」を追加登録し、更新する(図3B参照)。   Next, in step S202, a new instruction code “G103” is additionally registered in the first list 18 and updated (see FIG. 3B).

さらに、ステップS203において、第2リスト20に命令コード「G103」と、そのとり得る引数の「N」、「F」及び「P」を追加登録し、更新する(図4B参照)。   Further, in step S203, the instruction code “G103” and its possible arguments “N”, “F”, and “P” are additionally registered in the second list 20 and updated (see FIG. 4B).

第1リスト18及び第2リスト20に対する追加登録は、例えば、エディタ24を用いればよい。   For example, the editor 24 may be used for the additional registration with respect to the first list 18 and the second list 20.

このようにステップS203までの準備が終了した後、図5及び図6に示す処理を実行する。   After completing the preparation up to step S203 in this way, the processing shown in FIGS. 5 and 6 is executed.

この場合、前記ステップS9及びS10において、更新された第1リスト18(図3B参照)を参照することにより「G103」という文字列が命令コードであることが認識可能であり、しかも最初の1文字が同一である他の命令コードの「G00」、「G01」及び「G02」との区別が可能である。   In this case, in steps S9 and S10, it is possible to recognize that the character string “G103” is an instruction code by referring to the updated first list 18 (see FIG. 3B), and the first one character. Can be distinguished from “G00”, “G01”, and “G02” of other instruction codes having the same.

また、この後、ステップS11により、命令コード「G103」に対応するバイナリ変換部46gが適切に呼び出され、「G103」に続く文字列である「N8 F0.8 P1.0 F600」がバイナリ変換部46gに引き渡される。   Thereafter, in step S11, the binary conversion unit 46g corresponding to the instruction code “G103” is appropriately called, and the character string “N8 F0.8 P1.0 F600” following “G103” is converted into the binary conversion unit. Delivered to 46g.

バイナリ変換部46gにおける処理では、ステップS102及びS103において、更新された第2リスト20(図4B参照)を参照することにより、文字列「N」が「G103」の引数であることが認識可能であり、ラベル番号指定コードである「N」とは区別できる。   In the processing in the binary conversion unit 46g, it is possible to recognize that the character string “N” is an argument of “G103” by referring to the updated second list 20 (see FIG. 4B) in steps S102 and S103. Yes, and can be distinguished from the label number designation code “N”.

さらに、ステップS105及びS106において、文字列「N」に続く文字列である「8」を認識することにより、N=8、つまり工具の回転数が8回であることが認識可能となり、命令コード「G103」の最初の引数である[N]についての処理が終了する。   Furthermore, in steps S105 and S106, by recognizing the character string “8” following the character string “N”, it becomes possible to recognize that N = 8, that is, the number of rotations of the tool is 8, and the instruction code The process for [N], which is the first argument of “G103”, ends.

次に、ステップS107において引数抽出用ポインタを2つの文字列「F」のうち先頭側の位置にセットする。その後、文字列「N」の場合と同様に、F=0.8、つまりピッチが0.8[mm]であることを認識する。   Next, in step S107, the argument extraction pointer is set at the top position of the two character strings “F”. Thereafter, as in the case of the character string “N”, it is recognized that F = 0.8, that is, the pitch is 0.8 [mm].

さらに、引数抽出用ポインタを文字列「P」の位置にセットして同様の処理を行い、P=1.0、つまり1.0[s]のタイマ機能を認識する。   Further, the argument extraction pointer is set at the position of the character string “P” and the same processing is performed to recognize the timer function of P = 1.0, that is, 1.0 [s].

このようにして、新規の命令コードである「G103」に従属する引数である「N8」、「F0.8」及び「P1.0」を正しく認識することができる。   In this way, the arguments “N8”, “F0.8”, and “P1.0” that are subordinate to the new instruction code “G103” can be correctly recognized.

さらにまた、この後ステップS107において引数抽出用ポインタを2つの文字列「F」のうち後側の位置にセットし、ステップS103を介してステップS104に移る。このステップS104においては、前記のとおり、その時点における引数抽出用ポインタが示す文字列「F」が処理済みであるか否かを確認するが、この文字列「F」は2つ存在するうちの後側であることからすでに1度処理を行っていると判断されて、ステップS108へ移ることとなる。   Furthermore, in step S107, the argument extraction pointer is set at the rear position of the two character strings “F”, and the process proceeds to step S104 via step S103. In step S104, as described above, it is checked whether or not the character string “F” indicated by the argument extraction pointer at that time has been processed, but there are two character strings “F”. Since it is the rear side, it is determined that the processing has already been performed once, and the process proceeds to step S108.

従って、後側の「F」及びこれに続く「600」という文字列は、命令コードである「G103」の引数ではなく、異なる次の命令コードであることを正しく判断することができる。   Accordingly, it is possible to correctly determine that the character string “F” on the rear side and “600” subsequent thereto are not arguments of the instruction code “G103” but are different next instruction codes.

この後、ステップS108では、認識された各引数及びその数値データを反映させて新規の命令コードである「G103」をバイナリ形式に変換する。   Thereafter, in step S108, each recognized argument and its numerical data are reflected to convert the new instruction code “G103” into a binary format.

上述したように、本実施の形態に係るソースプログラム変換システム10によれば、「G103」等の新規の命令コードを用いる場合、これに対応するバイナリ変換部46gを変換処理部44に追加登録するとともに、第1リスト18及び第2リスト20に「G103」の命令コードとその引数「N」、「F」及び「P」を追加登録すればよい。この場合、他のバイナリ変換部46a〜46f及び命令コード抽出部42には影響がなく、修正を行う必要がない。   As described above, according to the source program conversion system 10 according to the present embodiment, when a new instruction code such as “G103” is used, the binary conversion unit 46g corresponding thereto is additionally registered in the conversion processing unit 44. In addition, the instruction code “G103” and its arguments “N”, “F”, and “P” may be additionally registered in the first list 18 and the second list 20. In this case, the other binary conversion units 46a to 46f and the instruction code extraction unit 42 are not affected and need not be corrected.

次に、本実施の形態に係るソースプログラム変換方法と対比するために、従来技術について説明する。 Next, in order to compare with the source program conversion method according to the present embodiment, a conventional technique will be described.

従来技術においては、加工プログラム16aからバッファに読み込んだ文字列のうち、「E」、「F」、「G」又は「N」のいずれかの文字から次に現れる「E」、「F」、「G」又は「N」までの間を1つの命令として認識している。従って、前記の「G103」のような新規の命令コードが「F」や「N」を引数としてとるものと規定されている場合には、そのままでは命令コードと引数との区別ができず、専用の判断処理を設ける必要がある。   In the prior art, among the character strings read into the buffer from the machining program 16a, “E”, “F”, which appears next from any of the characters “E”, “F”, “G” or “N”, The period up to “G” or “N” is recognized as one command. Therefore, when a new instruction code such as “G103” is defined as taking “F” or “N” as an argument, the instruction code cannot be distinguished from the argument as it is, It is necessary to provide a determination process.

つまり、命令コード抽出部42に相当する処理部又は変換処理部44に相当する処理部において次のような意味の例外処理を追加、変更する必要がある。   That is, it is necessary to add or change exception processing having the following meaning in a processing unit corresponding to the instruction code extraction unit 42 or a processing unit corresponding to the conversion processing unit 44.

すなわち、この場合の例外処理は、“ただし、切り分け予定部分の先頭の文字列が「G103」であったら、1回目の「F」及び「N」は無視する”という意味のものである。   In other words, the exception processing in this case means “however, if the first character string of the portion to be carved is“ G103 ”,“ F ”and“ N ”for the first time are ignored”.

また、このような追加、変更の操作は、新規の命令コードが適用される度に行う必要があり、命令コード抽出部42に相当する処理部が次第に複雑となり、追加、変更の操作の際に人為的なミスを誘発することがある。また、追加、変更の操作を担当した以外の者には処理構造の理解が困難になる。さらに、いわゆるバージョン管理が繁雑となる。   In addition, such addition and change operations need to be performed every time a new instruction code is applied, and the processing unit corresponding to the instruction code extraction unit 42 becomes increasingly complicated. May cause human error. In addition, it becomes difficult for those who are not in charge of the addition and change operations to understand the processing structure. Furthermore, so-called version management becomes complicated.

一方、本実施の形態に係るソースプログラム変換方法によれば、命令コード抽出部42や変換処理部44は、第1リスト18及び第2リスト20を参照しながら命令コードの抽出を行うため、新規の命令コードを適用する際に、命令コード抽出部42や従来の命令コードに対応するバイナリ変換部46a〜46fに対して変更を加える必要がない。この場合、第1リスト18及び第2リスト20には、新規の命令コードに対応して、その命令コード自体と、引数とを追加登録するが、この手順は極めて容易であって、しかも追加登録の数が増えても第1リスト18及び第2リスト20の基本構造は変化がない。従って、それまでの追加登録の履歴を把握していない者であっても、容易且つ短時間に新規の命令コードを追加適用させることができる。 On the other hand, according to the source program conversion method according to the present embodiment, the instruction code extraction unit 42 and the conversion processing unit 44 extract the instruction code while referring to the first list 18 and the second list 20. When this instruction code is applied, it is not necessary to change the instruction code extraction unit 42 or the binary conversion units 46a to 46f corresponding to the conventional instruction code. In this case, the instruction list itself and the argument are additionally registered in the first list 18 and the second list 20 in correspondence with the new instruction code, but this procedure is very easy and additionally registered. Even if the number increases, the basic structure of the first list 18 and the second list 20 does not change. Therefore, even a person who does not grasp the history of additional registration up to that point can easily apply a new instruction code in a short time.

このように、本実施の形態に係るソースプログラム変換方法によれば、加工プログラム16及び16aに対して新規の命令コードを適用する際に、該命令コードを簡便に適用させることができる。 As described above, according to the source program conversion method according to the present embodiment, when a new instruction code is applied to the machining programs 16 and 16a, the instruction code can be easily applied.

また、上記の説明では、命令コードとして「E」、「G00」、「G103」等の動作や条件を設定するための命令コードについて例示したが、これ以外に、分岐処理、演算処理及び代入処理等に関する命令コードについても適用可能であることはもちろんである。例えば、第2リスト20における登録データを引数なしとし、前記ステップS108の処理を分岐命令、演算命令及び代入命令に置き換えれることにより、これらの処理に対して適用可能となる。つまり、図6に示す処理は各命令コード毎に用意されるものであり、全体の仕組みや他の命令処理に影響されずに作成可能である。   In the above description, instruction codes for setting operations and conditions such as “E”, “G00”, and “G103” are illustrated as instruction codes. However, in addition to this, branch processing, arithmetic processing, and substitution processing are performed. Of course, it is applicable also about the instruction code regarding such as. For example, the registration data in the second list 20 has no argument, and the process in step S108 is replaced with a branch instruction, an operation instruction, and an assignment instruction, so that it can be applied to these processes. That is, the process shown in FIG. 6 is prepared for each instruction code, and can be created without being affected by the overall mechanism and other instruction processes.

さらに、本実施の形態に係るソースプログラム変換方法は、NC装置14を制御するための加工プログラム16に限らず、他の形式のプログラムにも適用可能である。 Furthermore, the source program conversion method according to the present embodiment is not limited to the machining program 16 for controlling the NC device 14, but can be applied to other types of programs.

上記の説明では、新規の命令コードとして1つの命令コード「G103」に対して適用する例について説明したが、新規の命令コードが複数である場合にも同様の手順により対応可能であることはもちろんである。   In the above description, an example in which one instruction code “G103” is applied as a new instruction code has been described. However, the same procedure can be used when there are a plurality of new instruction codes. It is.

さらにまた、上記の説明では、第1リスト18と第2リスト20とを参照しながら命令コード及び引数を抽出する例について説明したが、第2リスト20のうち図4Aにおける最も左側の列に相当する部分を第1リスト18として兼用することとし、該第1リスト18自体を省略してもよい。   Furthermore, in the above description, an example in which instruction codes and arguments are extracted with reference to the first list 18 and the second list 20 has been described. However, the second list 20 corresponds to the leftmost column in FIG. 4A. The portion to be used may also be used as the first list 18, and the first list 18 itself may be omitted.

実行プログラム28は、1つの加工プログラム16から変換されるものとして説明したが、加工プログラム16は複数のファイルから構成されていてもよい。   Although the execution program 28 has been described as being converted from one machining program 16, the machining program 16 may be composed of a plurality of files.

本発明に係るソースプログラム変換方法は、上述の実施の形態に限らず、本発明の要旨を逸脱することなく、種々の構成をとり得ることはもちろんである。 Of course, the source program conversion method according to the present invention is not limited to the above-described embodiment, and can take various configurations without departing from the gist of the present invention.

ースプログラム変換システムの構成ブロック図である。It is a block diagram of a source over the scan program conversion system. 加工プログラムの内容を示す図である。It is a figure which shows the content of the processing program. 図3Aは、第1リストの内容を示す図であり、図3Bは、新規の命令コードを追加登録して更新された第1リストの内容を示す図である。FIG. 3A is a diagram showing the contents of the first list, and FIG. 3B is a diagram showing the contents of the first list updated by additionally registering a new instruction code. 図4Aは、第2リストの内容を示す図であり、図4Bは、新規の命令コードを追加登録して更新された第2リストの内容を示す図である。FIG. 4A is a diagram showing the contents of the second list, and FIG. 4B is a diagram showing the contents of the second list updated by additionally registering a new instruction code. 入力部及び命令コード抽出部が行う処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the process which an input part and an instruction code extraction part perform. バイナリ変換部が行う処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the process which a binary conversion part performs. 新規の命令コードを適用させる際における準備の手順を示すフローチャートである。It is a flowchart which shows the procedure of the preparation at the time of applying a new instruction code.

符号の説明Explanation of symbols

10…ソースプログラム変換システム 14…NC装置
16、16a…加工プログラム 18、18a…第1リスト
20、20a…第2リスト 22…編集端末
24…エディタ 26…メモリ
28…実行プログラム 30…変換部
32…実行処理部 40…入力部
42…命令コード抽出部 44…変換処理部
46a〜46g…バイナリ変換部
DESCRIPTION OF SYMBOLS 10 ... Source program conversion system 14 ... NC apparatus 16, 16a ... Machining program 18, 18a ... 1st list 20, 20a ... 2nd list 22 ... Editing terminal 24 ... Editor 26 ... Memory 28 ... Execution program 30 ... Conversion part 32 ... Execution processing unit 40 ... input unit 42 ... instruction code extraction unit 44 ... conversion processing units 46a to 46g ... binary conversion unit

Claims (5)

命令コード及びその引数を含むテキスト形式のソースプログラムをコンピュータが読み取り実行可能な実行プログラムに変換するためのソースプログラム変換方法において、
命令コード抽出手段により、前記ソースプログラムの文字列群の先頭文字から順次読み込みながら、あらかじめ適用された命令コード及び該命令コード毎に従属する引数が記録されたリストを参照して、命令コードを抽出する命令抽出工程と、
命令コード抽出手段によって抽出された前記命令コードが引数をとるものである場合に、引数抽出手段により、前記リストにおける前記命令コードに対応する箇所を参照し、前記命令コードに続く文字列から該命令コードに対応する引数を抽出する引数抽出工程と、
複数の命令コード専用変換手段のうち前記命令コードに対応した命令コード専用変換手段により、前記命令コード抽出手段によって抽出された命令コードを、前記引数抽出手段によって抽出された引数とともに変換し、実行可能な実行コードを生成する変換工程と、
命令コード抽出手段により、前記命令コード専用変換手段によって変換される文字列の次に記述された文字列を文字列群の先頭文字とする更新工程と、
を有し、
前記命令抽出工程、前記引数抽出工程、前記変換工程及び前記更新工程を繰り返し実行し、
前記引数抽出工程は、前記命令コードに続く文字列を順に調べて引数を順次抽出するとともに、抽出された文字列と同じ文字列の引数がすでに抽出処理済みであるとき、その時点における命令コードに対応した引数の抽出を終了することを特徴とするソースプログラム変換方法。
In a source program conversion method for converting a text source program including an instruction code and its argument into an executable program that can be read and executed by a computer,
The instruction code is extracted by referring to a list in which instruction codes applied in advance and arguments subordinate to each instruction code are recorded while sequentially reading from the first character of the character string group of the source program by the instruction code extracting means. An instruction extraction process to
When the instruction code extracted by the instruction code extraction means takes an argument, the argument extraction means refers to a location corresponding to the instruction code in the list, and the instruction code is extracted from a character string following the instruction code. An argument extraction step for extracting an argument corresponding to the code;
An instruction code extracted by the instruction code extracting means is converted together with an argument extracted by the argument extracting means by an instruction code dedicated converting means corresponding to the instruction code among a plurality of instruction code exclusive converting means, and executable. A conversion process for generating a simple executable code,
An update step in which the character string described next to the character string converted by the instruction code exclusive conversion means is used as the first character of the character string group by the instruction code extraction means ;
Have
Repeatedly executing the instruction extraction step, the argument extraction step, the conversion step and the update step ;
The argument extraction step sequentially examines a character string following the instruction code and sequentially extracts arguments. When an argument of the same character string as the extracted character string has already been extracted, the instruction code at that time is A source program conversion method characterized in that extraction of a corresponding argument is terminated .
請求項記載のソースプログラム変換方法において、
前記リストは、命令コードが記録されている第1リストと、
各命令コード毎にその従属する引数が記録されている第2リストと、
に分けて構成されていることを特徴とするソースプログラム変換方法。
The source program conversion method according to claim 1 ,
The list includes a first list in which instruction codes are recorded;
A second list in which the dependent arguments are recorded for each instruction code;
A source program conversion method characterized in that the source program conversion method is divided into two.
請求項1又は2に記載のソースプログラム変換方法において、
前記命令コード専用変換手段は、前記命令コード毎に対応して実行コードを生成するバイナリ変換部を有し、
前記命令コード専用変換手段には、命令コードに対応したバイナリ変換部を追加登録可能であることを特徴とするソースプログラム変換方法。
The source program conversion method according to claim 1 or 2 ,
The instruction code dedicated conversion means includes a binary conversion unit that generates an execution code corresponding to each instruction code,
A source program conversion method, wherein a binary conversion unit corresponding to an instruction code can be additionally registered in the instruction code dedicated conversion means.
請求項1〜のいずれか1項に記載のソースプログラム変換方法において、
前記引数抽出手段は前記命令コード専用変換手段に含まれ、
前記命令コード抽出手段は、前記ソースプログラムの文字列群の先頭文字から順次読み込みながら、前記リストを参照して抽出した命令コードに続く文字列群を前記命令コード専用変換手段に渡すことを特徴とするソースプログラム変換方法。
In the source program conversion method according to any one of claims 1 to 3 ,
The argument extraction means is included in the instruction code dedicated conversion means,
The instruction code extracting means passes the character string group following the instruction code extracted with reference to the list to the instruction code dedicated converting means while sequentially reading from the first character of the character string group of the source program. Source program conversion method.
請求項1〜のいずれか1項に記載のソースプログラム変換方法において、
前記ソースプログラムは、命令コードと引数の間、及び引数同士の間がスペースで区切られていることを特徴とするソースプログラム変換方法。
In the source program conversion method according to any one of claims 1 to 4 ,
A source program conversion method, wherein the source program is divided between an instruction code and an argument and between arguments by a space.
JP2003386660A 2003-11-17 2003-11-17 Source program conversion method Expired - Fee Related JP4613003B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003386660A JP4613003B2 (en) 2003-11-17 2003-11-17 Source program conversion method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003386660A JP4613003B2 (en) 2003-11-17 2003-11-17 Source program conversion method

Publications (2)

Publication Number Publication Date
JP2005149194A JP2005149194A (en) 2005-06-09
JP4613003B2 true JP4613003B2 (en) 2011-01-12

Family

ID=34694291

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003386660A Expired - Fee Related JP4613003B2 (en) 2003-11-17 2003-11-17 Source program conversion method

Country Status (1)

Country Link
JP (1) JP4613003B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6339650B2 (en) * 2016-11-25 2018-06-06 ファナック株式会社 Machining program management device
JP6987960B1 (en) * 2020-12-24 2022-01-05 Dmg森精機株式会社 Information processing equipment
JP6987959B1 (en) * 2020-12-24 2022-01-05 Dmg森精機株式会社 Information processing equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000259424A (en) * 1999-03-10 2000-09-22 Hitachi Ltd Reserved work invalidation system
JP2002341912A (en) * 2001-05-16 2002-11-29 Citizen Watch Co Ltd Numerical controller, method for executing numerical control program and its program

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6168606A (en) * 1984-09-12 1986-04-09 Mitsubishi Electric Corp Numerical controller
JPS63307536A (en) * 1987-06-09 1988-12-15 Tokyo Electric Co Ltd Compiler for information processor
JPH03248230A (en) * 1990-02-26 1991-11-06 Nec Corp Parameter analyzing system
JPH04120628A (en) * 1990-09-12 1992-04-21 Toshiba Corp Reserved word maintaining and managing system
JPH05173799A (en) * 1991-12-25 1993-07-13 Hitachi Ltd Syntax analysis system
JPH05197560A (en) * 1992-01-20 1993-08-06 Toshiba Corp Programming language conversion device
JPH05313727A (en) * 1992-05-12 1993-11-26 Fuji Electric Co Ltd Positioning control method
JPH10133883A (en) * 1996-10-31 1998-05-22 Nec Corp Compile system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000259424A (en) * 1999-03-10 2000-09-22 Hitachi Ltd Reserved work invalidation system
JP2002341912A (en) * 2001-05-16 2002-11-29 Citizen Watch Co Ltd Numerical controller, method for executing numerical control program and its program

Also Published As

Publication number Publication date
JP2005149194A (en) 2005-06-09

Similar Documents

Publication Publication Date Title
TWI464558B (en) Program generation support device
EP0553731B1 (en) Programmable controller
JP4850556B2 (en) Program creation support apparatus and method
US8195911B2 (en) Numerical controller capable of dividing and combining memory areas to store machining programs and binary data
EP3540536B1 (en) Development support device, development support method, and development support program
CN105408823A (en) Engineering tool, program editing device, and program editing system
JP5777837B2 (en) Program development support apparatus and method
JP4876537B2 (en) Programmable controller programming device
JP4613003B2 (en) Source program conversion method
JP2006031311A (en) Robot control device and robot system
KR101447846B1 (en) Motion sfc program component creation device
JP2008059421A (en) Sequence program editing support device
CN115003459A (en) Origin resetting device
EP2339417A1 (en) Apparatus and method for controlling machine tool
US11320800B2 (en) Optimization device
JP2002268896A (en) Method and device for generating control program
CN100375938C (en) Controller for machinery
JPH10320027A (en) Numerical controller
EP0827053A1 (en) Programming system for motion controller
JP2005326909A (en) Plant engineering system
KR100423742B1 (en) Exclusive control system by sequential function chart
JP2007241399A (en) Method for obtaining nc program in g code format and execution method for program therefor
JP2006309387A (en) Method for supporting program compilation of programmable logic controller
US20040049622A1 (en) Programming tool
JPH04294404A (en) Numerical controller for robot and its system program developing device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20051226

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080430

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20081216

RD13 Notification of appointment of power of sub attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7433

Effective date: 20090130

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090216

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A821

Effective date: 20090130

RD14 Notification of resignation of power of sub attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7434

Effective date: 20090501

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100202

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100402

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20100427

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100727

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20100803

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20101012

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20101018

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20131022

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees