Abstract:
A dual language numerical controller includes a terminal (8&#39;) for entering both a numerical control (NC) language program and a higher level language, such as BASIC, program, a language discriminator (31) for determining which language has been entered, a higher level language interpreter (32) and an NC language interpreter (33), both for producing NC instruction data and an NC data table formatter (34) for arranging the instruction data in the order of which the entered programs produced them.

Description:
This is a continuation of application Ser. No. 592,491 filed Mar. 22, 1984, now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     The invention relates generally to a controller for a numerical control device, and it relates in particular, to a controller that simultaneously processes a numerical control language and a higher level language. 
     The term &#34;NC&#34; as used herein means numerical control. The term &#34;NC language&#34; as used herein is intended to mean an NC instruction language that has a format peculiar to numerical control for operating a numerical control device, and the term &#34;high level language&#34; is a general purpose language such as a BASIC language. 
     FIG. 1 is a block diagram outlining the arrangement of a conventional numerical control device. In FIG. 1, an NC tape 1 contains a machining program in the NC language. An input section 2 comprises a reading circuit and a command decoding and processing circuit. The control device further comprises a control section 3, a memory section 4, a processor section 5, an output section 6, a machine tool 7 to be controlled, a BASIC language terminal 8 which sets and displays the BASIC language, and a change-over switch 9. 
     The operation of the device will be briefly described. In the case where control is effected using an NC language, an example of which is shown in Table 1, before the operation is started the change-over switch 9 is set to select the input section 2 so that the input section 2 reads the machining program on the NC tape 1. The program is interpreted by the control section 3, and the processor 5 carries out the necessary calculations according to the interpreted program. The resultant data of the calculation are stored in the memory section 4. The data thus stored are successively applied through the output section 6 to the machine tool 7, so that the tool is controlled according to the program. This control is carried out for each axis of the machine tool 7. 
     On the other hand, in the case where it is required to control the machine tool by using a BASIC language program, an example of which is shown in Table 2, it is necessary to set the change-over switch 9 in advance. In this case, the switch 9 is set to select the BASIC terminal 8, and the operator operates the keyboard at the terminal 9 to prepare a control program in a BASIC language while viewing a CRT (cathode ray tube) display unit, so that the machine tool is controlled according to the control program thus prepared. 
     As is apparent from the above description, in the conventional device shown in FIG. 1, NC language instructions are inputted from the NC tape 1 through the input section 2 to the control section 3, and BASIC language instructions are inputted from the BASIC terminal 8 to the control section. Therefore, the control section 3 is required to detect the state of the change-over switch 9, i.e., whether the switch 9 is connected to the input section 2 or the BASIC terminal 8, thereby to determine what language is used for the instruction. The machine tool is controlled according to the instruction in the language thus determined. 
     With the conventional NC device, the control is effected according to NC language instructions or BASIC language instructions by operating the change-over switch 9; however, it is possible to control the machine tool by using two languages simultaneously. If in the case of a simple movement instruction for &#34;Feed the X-axis 100 mm quickly&#34;, an NC language instruction such as &#34;GOO X 1000D;&#34; can be used. However, BASIC language instructions can be advantageously used in the case of a special cycle instruction such as a series of operations in which, as in a deep hole drilling cycle instruction, after being dropped quickly to a certain depth, the drill is advanced by predetermined incremental distances for drilling, and after the hole has been drilled to a predetermined depth, the drill is quickly returned to its original position. The advantages of the use of two languages lies in that the BASIC special cycle can be formulated as desired by the user and the NC language simple movement instruction can be readily executed because of the simple instruction format. However, the conventional device cannot use the two languages in this manner. 
     SUMMARY OF THE INVENTION 
     Accordingly, an object of this invention is to eliminate the above-described difficulty accompanying a conventional numerical control device. More specifically, an object of the invention is to provide a numerical control device in which, unlike the conventional NC device in which the NC tape 1 inputs only the NC language data and the BASIC terminal 8 inputs only the high level language data, the terminal section is so designed as to be able to input both NC language data and high level language data, whereby a program written in both NC language and high level language such as BASIC language can be used. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram showing the arrangement of one example of a conventional NC device; 
     FIG. 2 is a block diagram showing the arrangement of one embodiment of a numerical control device according to this invention; 
     FIG. 3 is a flow chart describing the operation of the device in FIG. 2. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     One example of a numerical control device according to this invention will be described with reference to FIG. 2. 
     The NC device of the invention is different from that shown in FIG. 1 in the following points: The change-over switch 9 in FIG. 1 is not used in the controller of the invention, and the input section 2 and a terminal 8&#39; are connected directly to a control section 3&#39; so that the terminal 8&#39; can input both NC and BASIC languages. The control section 3&#39; comprises a language discriminating section 31, a BASIC language interpreting section 32 which produces data in NC form, an NC language interpreting section 33 and an NC data table formatting section 43 which combines the NC data output from both the BASIC interpreter 32 and the NC interpreter 33. 
     The operation of the device will be described with reference to a flow chart in FIG. 3. Input data from the NC tape 1 are identical to those in the conventional NC device shown in FIG. 1. It is assumed that the terminal 8&#39; inputs a program containing, as shown in Table 3, both NC language and BASIC language. 
     First, the program is inputted into the control section 3&#39; from the terminal 8&#39; by operating the keyboard. The language discriminating section 31 determines whether or not the program inputted into the control section 3 has been written in the NC language. This language discrimination is accomplished by a series 20 of steps shown in the flow chart in FIG. 3. In step 21 it is determined whether or not the BASIC language processing flag is on. If not, the operation advances to step 22, in which it is determined whether or not the instruction is a BASIC start delimiter instruction which indicates that the following instructions are in the BASIC language. In the program shown in Table 3 the BASIC start delimiter is &#34;G22&#34;. If, in step 22, the program is not a BASIC start delimiter, then it is determined that the program is in NC language, and the operation advances to step 23 where NC language processing or interpreting is carried out. 
     When, in step 22, a BASIC start delimiter instruction is detected, a G22 instruction in the example of Table 3, operation advances and the BASIC language processing flag is turned on in the language discriminating section 31, and operation then returns to step 21. Thus, it is determined that the instruction is in BASIC language. 
     When, in step 21 the BASIC language processing flag is found to be on, operation advances to step 25. In step 25, it is determined whether or not the program is a BASIC end delimiter instruction which indicates the end of BASIC instructions. More specifically, it is determined whether or not the program language is changed from the BASIC language. In the program in Table 3, the BASIC end delimiter instruction is &#34;G23&#34;. When, in step 25 the instruction is found to be a BASIC end delimiter instruction, i.e., &#34;G23;&#34; in the example of Table 3, operation advances to step 24. In step 24, the BASIC language processing flag is turned off in the language discriminating section 31, and operation returns to step 21. It is thus determined that the following program is in NC language. 
     When in step 25 the program is not a BASIC end delimiter instruction, it is determined that the program is in BASIC language, and operation advances to step 27, in which BASIC language processing or interpreting is carried out. 
     When the language discriminating section 31 determines that the program is in NC language, then the operation advances to step 23. In step 23, the NC language interpreting section 33 interprets the NC language program, and in step 28 the NC data table formatting section 34 forms and NC data table. More specifically, in step 23 NC instruction data are formed according to the NC language instruction, and the instruction data thus formed are set sequentially as instructed to provide the NC data table in step 28. 
     When the language discriminating section 31 determines that the program is in BASIC in step 27 the BASIC language interpreter section 32 forms NC instruction data, and in step 28 the NC data table formatting section 34 forms an NC data table. 
     Accordingly, when a program written in both NC language and BASIC language as shown in Table 3 is inputted to the control section 3&#39; by operating the keyboard in the terminal 8&#39;, the control section 3&#39; carries out language discrimination and language processing, so that the NC instruction data are set as an NC data table in the order of both the BASIC and NC instructions. The NC data are then sequentially fed to the output section 6. 
     As is clear from the above description, a program written in both NC and BASIC language is interpreted by the control section 3&#39;, so that NC data are set as required, and finally the machine tool 7 is controlled by the output section 6 as intended. 
     Instead of the BASIC language, another high level language may be used for the NC device. In this general case, the BASIC interpreting section 32 is replaced by a high level language interpreting section which produces NC data. 
     As is apparent from the above description, according to the invention the terminal for inputting NC language instructions and high level language instructions is provided in the NC device, and the control section has the language discriminating section for determining whether a program is in NC language or in a high level language. The high level language interpreting section processes the high level language to produce NC data and the NC language interpreting section processes NC language. Therefore, the operation can readily use two kinds of languages simultaneously in programming. Furthermore, the numerical control device of the invention is advantageous in that programs can be simplified owing to the use of the NC language, but complex programs can be formed because of the use of high level language. 
     
                       TABLE 1______________________________________N1000            G92 X0Z0 M03;N1001            G91 GO Xx.sub.1N1002            Xx.sub.2 ;N1003            Gl Xx.sub.3 Ff.sub.1 ;N1004            GO Xx.sub.4 ;N1005            GOX-(x.sub.2 +x.sub.3 +x.sub.4,);N1006            GO Zz.sub.1 ;N1007            GO Xx.sub.2 ;N1008            Gl Xx.sub.3 Ff.sub.1 ;N1009            GO Xx.sub.4 ;N1010            GO X-(x.sub.2 +x.sub.3 +x.sub.4);N1011            GO Zz.sub.1 ;N1012            GO Xx.sub.2 ;N1013            G1 Xx.sub.3 Ff.sub.1 ;N1014            GO Xx.sub.4 ;N1016            GO Z-z.sub.1 ;N1017            GO X-x.sub.1 Z-z.sub.1 M05;N1018            M00;______________________________________ 
    
     
                       TABLE 2______________________________________100      K=$C100; X=$C006; Z=$C00A110      INPUT K(0), K(1), K(2), K(3)120      INPUT K(4), K(10)130      X(0)=0; Z(0)=0; G=92; M=03; A=03; C=$13140      GOSUB 1000150      X(0)=K(0); G=91; H=00; A=01; C=$07160      GOSUB 1000170      FOR I=1 TO 3180      X(0)=K(1); A=01; C=$01; GOSUB 1000190      X(0)=K(2); G=01; F=K(10); A=01; C=$03200      GOSUB 1000210      X(0)=K(3); G=00; A=01; C=$03220      GOSUB 1000230      X(0)=-(K(1)+K(2)+K(3)); A=01; C=$01240      GOSUB 1000260      Z(0)=K(4); A=02; C=$01; GOSUB 1000270      NEXT I280      X(0)=-K(0); Z(0)=-3 K(4); A=$03290      M=05; C=$11; GOSUB 1000300      M=00; C=$11; GOSUB 1000; STOP1000     POKE $C002, G; POKE $C003, H1010     POKE $C005, A1020     @($C00E)=F; @($C010)=M1030     POKE $C001, C1040     B=WPEEK($C000)1050     IF B &lt; &gt; 1GOTO 10401060     RETURN______________________________________ 
    
     
                       TABLE 3______________________________________     (NC PROGRAM)     G 92X0X0Z0M03;     G 91GXx.sub.1 ;     Xx.sub.2 &#39;;     .     .     .     G 22;     (BASIC PROGRAM)     FOR I=1 TO 3     X(0)=K(1); A=01     GOSUB 1000     .     .     .     G 23;     (NC PROGRAM)     .     .     .______________________________________