CN1811632A - A digital control code encoder and method for establishing digital control system software based on the same - Google Patents

A digital control code encoder and method for establishing digital control system software based on the same Download PDF

Info

Publication number
CN1811632A
CN1811632A CN 200510121005 CN200510121005A CN1811632A CN 1811632 A CN1811632 A CN 1811632A CN 200510121005 CN200510121005 CN 200510121005 CN 200510121005 A CN200510121005 A CN 200510121005A CN 1811632 A CN1811632 A CN 1811632A
Authority
CN
China
Prior art keywords
pidp
code
order
file
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.)
Granted
Application number
CN 200510121005
Other languages
Chinese (zh)
Other versions
CN100480916C (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.)
Shenzhen Institute of Information Technology
Original Assignee
Shenzhen Institute of Information Technology
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 Shenzhen Institute of Information Technology filed Critical Shenzhen Institute of Information Technology
Priority to CNB2005101210050A priority Critical patent/CN100480916C/en
Publication of CN1811632A publication Critical patent/CN1811632A/en
Application granted granted Critical
Publication of CN100480916C publication Critical patent/CN100480916C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

The present invention discloses a numeric control code compiler, and also discloses a method for creating numeric control system software by using said numeric control code compiler. It is characterized by that it includes the following several steps: (1), constructing PIDP_NC code compiler; (2), in upper-position machine adopting PIDP_NC code compiler to compile NC program into object code file with specific data format and complete sequence execution signification; (3), upper-position machine can feed the PIDP object codes into lower-position machine circulation buffer zone in batches according to sequence; and (4), lower-position machine can read out PIDP object codes from circulation buffer zone according to sequence, identify the data in PIDP and judge the significance correspondent to NC command, at the same time obtain correspondent data and call correspondent motion control function according to significance of command so as to implement processing control.

Description

A kind of NC code compiler and set up the method for cnc system software based on it
Technical field
The present invention relates to code compilation, especially relate to a kind of NC code compiler and set up the method for cnc system software based on it.
Background technology
By general orbiting motion control module as slave computer, the digital control system that is consisted of as host computer by industrial control computer, a kind of novel Hardware Structure of NC System in 2, in the digital control system process of this structure of development, must the adapted cnc system software. Described cnc system software is when implementing the control of workpiece processing, must be to numerical control (Numerical Control, referred to as NC) code in the program carries out the translation of grammer, meaning, the corresponding control function of call by result according to translation is finished each axis' control, namely realize machining control, present above-mentioned interpretative function is finished by explanation type NC code encoder mostly, set up the method for cnc system software based on explanation type NC code encoder, may further comprise the steps: (1) will be conveyed into slave computer under the NC program by host computer, large-scale NC program, can not all once send into, and need repeatedly to pass down in batches; (2) at slave computer the NC program is compiled; (3) control mode is that slave computer reads a NC code, one of process of compilation, and according to process of compilation call by result control function realization machining control, it is the explanation type control model, be that explain on the limit, the limit is identified, limit control, its NC code encoder is actually the NC code interpretative device, and it combines together with control software. The problem that this method of setting up cnc system software exists, the one, NC code encoder and control program take CPU, the RAM resource of slave computer jointly, cause resource nervous, be unfavorable for that slave computer operation advance control algorithm realizes high accuracy control, is unfavorable for the realization of the real-time control of multiaxis; The 2nd, NC code encoder is nested in the real-time control software, makes the control software complicated of slave computer; In addition, in the NC program subprogram is arranged, large-scale NC program can not all once be sent into, and needs repeatedly to pass down in batches, the redirect of calling the NC subprogram in solution with return, and guarantee that there is very large obstacle in the real-time aspect of control.
Summary of the invention
The technical problem that the present invention will solve is the defective that overcomes prior art, proposes a kind of NC code compiler. Described NC code compiler is agreement integer bag (Protocol Integer Data Packet is referred to as PIDP) NC code compiler, is called for short the PIDP_NC code encoder.
Another technical problem that the present invention will solve is the defective that overcomes prior art, proposes a kind of method of setting up cnc system software based on above-mentioned NC code compiler.
For a kind of NC code compiler, technical problem of the present invention is solved like this:
The characteristics of this NC code compiler are that its structure comprises:
1) object code of NC order is namely worked out in definition;
2) form and the content of the PIDP of the corresponding NC order of design construction: comprise that the form of PIDP and the PIDP of multi-parameter, printenv and one-parameter order formulate;
3) design is programmed in the PIDP_NC code encoder of host computer operation, and following steps are arranged:
1. open the NC program file: open the NC program file, create one for the file destination of storing object code, a report file that is used for record compiling result at least with the function that opens file;
2. the NC program file is put in order: will become not have with the grand extension process of the NC program of subprogram the sequence type NC program file of subprogram;
3. sequence type NC program file is carried out the PIDP compiling: comprise used variable set up initial value in the compiling; By CONFIG.SYS the systematic parameter variable is set; The capable compiling of recursive call function is compiled into a PIDP with each NC order in order, and the PIDP sequence that will compile generation is stored in the hard disk of host computer with the form of file destination; Comprise that also calling PIDP arrangement function finishes the speed budget, and the arrangement of finishing presumable a plurality of PIDP after delegation's compiling;
4. judge whether the compiling result is correct: be just to generate the file of report correct information; No, just generate the file of reporting error message;
5. close all EP (end of program).
The form of described PIDP is format, becomes the PIDP object code after inserting data. The function of described PIDP_NC code encoder is the object code that the NC code compilation is become format, becomes format and complete order to carry out the object code file of meaning the NC program compilation.
Described PIDP object code all is to be comprised of integer data (Integer Data is referred to as ID) coding.
As: the order object code that " G00~G99 " is corresponding is " 1000~1099 ";
The format of described PIDP is: order object code+sequence number+packet length+parameter. Wherein packet length is different with the difference of parameter, parameter is different with the difference of NC code commands, after amplifying, coordinate, speed, angle-data all with the ID storage, transmit to make things convenient for data, as long as can obtain actual floating type data just slave computer dwindles identical multiple.
As: the NC code is " N006 G01X10.35Y20.68Z20.00 ", and corresponding PIDP is shown in table 1.
Table 1
1001 (G01 orders object code)
6 (sequence numbers)
9 (length of PIDP)
103500 (X coordinate values)
206800 (X coordinate values)
200000 (X coordinate values)
0 (Vs commencing speed)
140000 (Vm midrange speeds)
0 (Ve terminal velocity)
For a kind of NC code compiler, technical problem of the present invention is further to solve like this:
Described PIDP_NC code encoder is comprised of PIDP_NC source files of program, PIDP_NC_lib library file and PIDP_NC_sys CONFIG.SYS and help information file PIDP_NC_help.
Described PIDP_NC code encoder is applicable to Windows2000, WindowsXP and Linux operating system.
Described PIDP_NC code encoder is applicable to the cnc system software by Java, C and C++ exploitation.
Set up the method for cnc system software for a kind of based on NC code compiler, technical problem of the present invention is solved like this:
Thisly set up the method for cnc system software based on NC code compiler, following steps arranged:
(1) makes up the PIDP_NC code encoder;
(2) in host computer, adopt the PIDP_NC code encoder to become format and complete order to carry out the object code file of meaning the NC program compilation;
(3) host computer is sent the PIDP object code into the slave computer cyclic buffer in order in batches;
(4) slave computer reads in order from cyclic buffer and comprises slave computer cyclic buffer management PIDP and slave computer PIDP object code, through data identification among the PIDP being determined the meaning of corresponding NC order, obtain simultaneously corresponding data, meaning according to order is called corresponding motion control function, realizes machining control.
Set up the method for cnc system software for a kind of based on NC code compiler, technical problem of the present invention is further to solve like this:
The form of the PIDP of described NC code compiler is format, becomes the PIDP object code that is comprised of the integer data encoding after inserting data.
The format of described PIDP is: order object code+sequence number+packet length+parameter. Wherein packet length is different with the difference of parameter, and parameter is different with the difference of NC code commands, and coordinate, speed, angle-data are all stored with ID after amplifying.
Be compared with the prior art, the present invention has the following advantages:
(1) PIDP_NC code encoder of the present invention moves at host computer in advance, separate fully with slave computer, do not take CPU and the RAM resource of slave computer, being conducive to slave computer has sufficient resources operation advanced algorithm realization high accuracy and multiaxis to control in real time, slave computer software is oversimplified, and the Software for Design of slave computer needn't be considered the compiling problem of NC code;
(2) the present invention adopts first grand expansion technique to be organized into the NC program of subprogram does not have the sequence type of subprogram NC program file, again the NC code in the sequence type NC program file is carried out in order PIDP compiling, each NC order is compiled into a PIDP, adopt the PIDP sequences data structures of fully sequentially carrying out meaning to realize that large-scale NC procedure order passes down in batches, slave computer adopts cyclic buffer management PIDP, no matter how large the NC program has, can both realize digital control processing control, to satisfy the continuously demand of processing of large-scale NC program, this complete order is carried out meaning and is not had redirect and the challenge that returns, and has namely thoroughly solved the redirect of NC subprogram and a difficult problem of returning;
(3) target data of slave computer employing is PIDP, its first unit is the order object code, the 3rd unit is packet length, it is the parameter of corresponding order object code after the length cell, and the data in whole unit all are ID, the control software of slave computer is obviously become simply, be convenient to identification, according to just can recruit the easily relevant parameter of corresponding function and easily extraction plan usefulness of order object code and packet length, be that the TRAJECTORY CONTROL function call is very convenient, thereby make the easier realization control of slave computer, also solve the versatility problem of different lower computer systems, can extensively be suitable for multiple lower computer system. Because different upper and lower position machines, or even the upper and lower position machine of different floating type data formats, its ID form is all identical, and the PIDP that is made of ID needn't increase format conversion, just can guarantee that slave computer obtains correct data;
(4) PIDP_NC code encoder of the present invention can stand-alone development, has higher economic worth and technological value. It only relates to the NC code is become PIDP and the NC program is become the PIDP sequence file destination that complete order is carried out meaning, as long as method of calling and PIDP format description handbook are provided, the user just can use.
(5) PIDP data structure of the present invention and slave computer circular buffering management PIDP mode, for the upper and lower machine software in the digital control system provides a kind of interface modes, be conducive to the standardization of numerical control software, the bag of PIDP is long variable, budget work such as speed budget can move to host computer, further to alleviate the load of slave computer.
The present invention is applicable to the digital control system of the upper and lower computer structure that is made of industrial control computer and general motion-control module, and branch's formula orbiting motion control system.
Description of drawings
The present invention will be described in detail below in conjunction with the specific embodiment:
Fig. 1 is the main program flow chart of the PIDP_NC code encoder of the embodiment of the invention;
Fig. 2 is the program flow diagram of the collector of the embodiment of the invention;
Fig. 3 is the program flow diagram of the row compiling function of the embodiment of the invention;
Fig. 4 is the program flow diagram of the capable PIDP compiling function of the embodiment of the invention;
Fig. 5 is the slave computer of the embodiment of the invention is realized machining control with PIDP program flow diagram.
The specific embodiment
A kind of method of setting up the CNC2000 cnc system software based on the PIDP_NC code encoder
The digital-controlled carving machine that is made up by the CNC2000 digital control system can carry out the processing of the Chinese character engraving of various fonts, three-dimensional statue engraving, threedimensional model.
(1) specification requirement of PIDP_NC code encoder
Host computer: operating system is Windows2000, WindowsXP or Linux, application software system c program, C++ program or JAVA program development; The digital control system configuration file is arranged; Internal memory 256MB, hard disk 30GB, CPU is at least 32;
Slave computer: general motion-control module, CPU is at least 32, band motion control function;
Communication interface: parallel bus, damascene structures, 32; RS-232/485, separate type.
(2) functional planning of PIDP_NC code encoder
The functional planning of PIDP_NC code encoder is referring to table 2.
Table 2
Sequence number Function Solution
  1 Can identify beginning and the end of NC program. Begin with the behavior that runs into for the first time ' % '; Finish with the behavior that runs into for the second time ' % '.
  2 Can identify which be comment line which be that the NC code commands is capable. To go beginning character as the ' comment line of the behavior NC program of (' or '/'.
  3 Can identify and compile the grammer of NC program, the error message with different that exceeds restriction for thing and the data of None-identified be charged to report file. A NC code commands is an alphabetical character and adds digital character formation. As: G00, G01, they add one or two digits with G, and its digital scope is 0~99. And other forms are illegally, as: G100 is wrong.
  4 The number of times of makeing mistakes is limited to be withdrawed from. Utilize the errors number counter to realize, as: errors number>=10, withdraw from.
  5 The running software report file that bears results is with the success or failure of explanation compiling. The NC program is compiled inerrancy from the beginning to the end, just produce and compile successfully report, wrong, just produce the information reporting of makeing mistakes.
  6 The row compile mode Referring to the row collector
  7 Can carry out easily system parameter setting Form with CONFIG.SYS realizes.
  8 The different workpieces coordinate is processed automatically Workpiece coordinate is converted into mechanical coordinate system automatically.
  9 The processing requirements that can adapt to absolute coordinate and relative coordinate. Relative coordinate converts absolute coordinate to. The unified absolute coordinate data of using.
  10 Processing to some NC code commands Solve with Split Method. As: the G28 order is two PIDP to the translation result of G28 namely with two G00 orders.
  11 Can adapt to the processing of the subprogram of NC code Solve with grand expansion technique. The composing software layering is processed, and ground floor carries out macro expansion, and the second layer produces the PIDP file destination.
  12 Can automatically adjust the order of auxiliary NC order Open cooling, drive main shaft and must place before the machining action.
  13 Adapt to metric system and system made in Great Britain Be as the criterion with metric system, meet English system and be converted to metric system
(3) set up the method for software for the CNC2000 digital control system, following steps arranged:
(1) make up the PIDP_NC code encoder, comprising:
1) object code of NC order is namely worked out in definition; The NC order comprises G order, M order, H order, T order, P order and S order.
The object code of G00~G99 is respectively 1000~1099 in the G order;
The object code of M00~M99 is respectively 2000~2099 in the M order;
The code Design of the object code of other order is referring to table 3, and this table is used for setting up the definition that software process is browsed verification, increase and modifying target code.
The principle of definition numerical control order object code: adopt ID to represent object code; The code section of order object code is divided must be clear, is convenient to memory; The order object code must be corresponding one by one with the relation of numerical control order.
Table 3
G Object code   M Object code   T Object code   P Object code   H Object code
G00
  1000   M00   2000   T00   3000   P10000   8000   H00   4000
G01   1001   M01   2001   T01   3000   P20300   8000   H01   4000
G02   1002   M02   2002   T02   3000   P60088   #   H02   #
G03   1003   M03   2003   T03   #
G04   1004   M04   2004
。。。   。。。 Sequentially Analogize # annotates: the target code of 8000 expression pause command P; The target code of 9000 expression speed of mainshaft order S; 4000 expression cuttves are mended the target code of order H; The target code of 3000 expression tool changing order T.
Sequentially Analogize
  S   9000
  S1145   9000   #
  5000 Program file begins (first ' % ')
  5001 Program file finishes (second ' % ')
  5002 The program number sign
2) form and the content of the PIDP of the corresponding NC order of design construction: comprise that the form of PIDP and the PIDP of multi-parameter, printenv and one-parameter order formulate;
The Organization of Data formal definition of object code is PIDP.
1. PIDP is made of four parts, and its format design is as follows:
The order object code Sequence number Packet length Argument section
The order object code: be the object code of NC order, be used for sign NC order, slave computer utilizes it to call corresponding control function, realizes machining control, takies an integer unit.
Sequence number: be the capable sequence number of NC program, take an integer unit.
Packet length: begin to finish the integer number of unit that altogether takies to argument section from the order object code.
Argument section: be parameter region, comprise 0,1 or a plurality of parameter, each parameter takies an integer unit, and number of parameters can increase, to be applicable to the requirement of multi-axis numerical control system and multinomial budget.
Each part mentioned above represents with ID that all PIDP adopts above-mentioned form to represent, describes a NC code.
The grammer of NC code and meaning are take " FANUC Series 16 FANUC Series 18 operational manuals " as reference.
2. the PIDP of multi-parameter numerical control order formulates
Example 1: object code and the PIDP form of locating fast G00
The object code of G00 or G0 order and PIDP coded format are referring to table 4.
Table 4
The object code of G00 (1000)
The instruction sequence number
9 (length)
  X*10000
  Y*10000
  Z*10000
  Vs
  Vmo
  Ve
1000 is the object code of G00 or G0 order in the table 4; Length 9 these orders of expression take 9 ID unit; X is the X-axis coordinate, and X*10000 amplifies floating number and preserves with the ID coding, and is as the criterion with absolute coordinate; Y is the Y-axis coordinate, and Y*10000 amplifies floating number and preserves with the ID coding, and is as the criterion with absolute coordinate; Z is the Z axis coordinate, and Z*10000 amplifies floating number and preserves with the ID coding, and is as the criterion with absolute coordinate; Slave computer divided by 10000, is reduced into floating data with the coordinate data.
For G00/G0 order, Vs and Ve need not, Vmo is the speed of G00, its value obtains from the CONFIG.SYS of compiler.
Example 2: the object code of rectilinear motion G01 and PIDP form
The object code of G01 or G1 order and PIDP coded format are referring to table 5.
Table 5
The object code of G01 (1001)
The instruction sequence number
9 (length)
  X*10000
  Y*10000
  Z*10000
  Vs
  Vm
  Ve
1001 is the order object code of G01 or G1 in the table 5; Length 9 these orders of expression take 9 ID unit; X, Y, Z are identical with G00.
Vs is that commencing speed, Vm are that stabilized speed is that midrange speed, Ve are a section tail speed, and these speed data Negotiation speed computing functions get, and multiply by 1000 and deposit with ID.
Example 3: the object code of circular motion G02 (or G03) and PIDP coded format are referring to table 6.
Table 6
The object code 1002 (1003) of G02 (G03) is along the displacement of (contrary) hour hands circular arc
The instruction sequence number
13 (length)
X0 (center of circle) * 10000
Y0 (center of circle) * 10000
Z0 (center of circle) * 10000
  Xe*10000
  Ye*10000
  Ze*10000
  Vs
  Vm
  Ve
  Angle*1000000
Angle is the segment angle of circular arc in the table 6, and take radian as unit, multiplication factor is 106, and preserves with the ID coding. The circular arc starting point is current point, and the circular arc terminal point is (Xe, Ye, Ze), starting velocity Vs, stabilized speed Vm, terminal velocity Ve. These speed datas provide according to the requirement of control algolithm, with the computational load of further minimizing slave computer. To multiply by weights by the speed data that the NC program provides to insert Vm generally speaking. When the motion control function needs Vs, the Vm of an orbit segment and Ve, require to take suitable algorithm to obtain these speed datas such as rate smoothing according to the correlation between orbit segment.
3. the PIDP of printenv order formulates
Example 4: object code and the coded format of single NC order
The PIDP form of XY plane specified command G17 is referring to table 7.
Table 7
The object code of G17 (1017)
The instruction sequence number
3 (length)
The PIDP form of absolute order G90 is referring to table 8.
Table 8
The object code of G90 (1090)
Make sequence number
3 (length)
Object code and the coded format of example 5: miscellaneous function M order
The PIDP form of order M03 is referring to table 9.
Table 9
The object code of M03 (2003)
The instruction sequence number
3 (length)
The PIDP form of coolant pump open command M08 is referring to table 10.
Table 10
The object code of M08 (2008)
The instruction sequence number
3 (length)
4. the PIDP of one-parameter order formulates
Example 6: the object code of other order and coded format
The PIDP form of time out order P is seen ginseng table 11.
Table 11
The object code of P20 (8000)
The instruction sequence number
4 (length)
Time parameter (20sec)
The PIDP form of speed of mainshaft order S is referring to table 12.
Table 12
The object code of S2800 (9000)
The instruction sequence number
4 (length)
Rotary speed parameter (2800)
3) design is programmed in the PIDP_NC code encoder of host computer operation
Example 7: NC program such as the table 13 of a rectangle of processing:
Table 13
  %
  N0100 G90
  N0101 G00Z30
  N0102 G00X10Y10
N0103 G01Z16S2500F100 (first)
N0104 G01X30Y10 (second)
N0105 G01X30Y20 (the 3rd)
N0106 G01X10Y20F120 (the 4th)
N0107 G01X10Y10 (the 5th)
  N0108 M30
  %
Operation PIDP_NC code encoder, it is as shown in table 14 that institute produces the PIDP form target sequence of correspondence, and each cell is a PIDP in the table 14. Table 13,14 has illustrated the relation of NC program and PIDP sequence, and the task of PIDP_NC code encoder is that table 13 is compiled into table 14.
Table 14
5000 (first % is beginning) 03
       1090  (G90)        100   (N0100)        3
1000 (G00) 101 090 (X), 0 (Y) 300000 (Z=30*10000) 0 200000 (speed of the G00 of default) 0
1000 (G00) 102 9 100000 (X=10*10000), 100000 (Y=10*10000) 300000 (Z does not have change) 0 200,000 0
9000 (S orders), 103 4 2500 (speeds of mainshaft)
1001 (G01) (first) 103 9 (length of IDP), 100000 (X) 100000 (Y), 160000 (Z) 0 (Vs) 100000 (Vm is determined by F100), 0 (Ve)
1001 (G01) (second) 104 9 300,000 100,000 160,000 0 100,000 0
1001 (G01) (the 3rd) 105 9 300,000 200,000 160,000 0 100,000 0
1001 (G01) (the 4th) 106 9 100,000 200,000 160,000 0 120,000 0
1001 (the 5th) 107 9 100,000 100,000 160,000 0
     120000      0
2030 108 3
     501      108      3
Design is programmed in the PIDP_NC code encoder of host computer operation, and 1. following~5. step is arranged:
1. open the NC program file
Open the NC program file with the function that opens file, create respectively one and be used for storing the file destination of object code, report file and a reading file that is used for reading that is used for record compiling result, referring to Fig. 1.
2. the NC program file is put in order
To become not have with the grand extension process of the NC program of subprogram the sequence type NC program file of subprogram.
Specific implementation is as follows:
If the file of NC program is called " scode.txt ", new NC program file is called " newNC.txt ".
" scode.txt " arranged two file pointer P1 and P2, and P1 is used for the normal row reading pointer, reads after the delegation it is write " newNC.txt " file;
When running into " M98 " capable, the row that will not contain " M98 " writes " newNC.txt ", but with P2 pointer search " scode.txt ";
When searching corresponding subprogram numbering, begin to read delegation and write " newNC.txt " file from the next line of subprogram number line, until till " M99 ";
Continue again to remove to read " scode.txt " by P1, until the end of file.
" scode.txt " also arranged P3, P4, P5 pointer, be respectively applied to second and third, the search of four straton programs, can call with the maximum four straton programs that have that meet the international standard regulation.
Described file consolidation is a kind of grand extension process, realizes with fairly simple function program. The result of arrangement is as follows:
The arrangement of example 8:NC program
Sequence type NC program after the NC program arrangement before the arrangement
N0010 G01X10Y10                    N0010 G01X10Y10
N0011 M98P1000                     N1000 G01Z30
N0012 G01X30Y30                    N1001 G01Z60
N0013 M98P00022000                 N0012 G01X30Y30
N0014 M30                          N2000 G01Z20
                                   N2001 G01Z60
O1000                              N0014 M30
N1000 G01Z30
N1001 G01Z60
N1003 M99
O2000
N2000 G01Z20
N2001 G01Z60
N2003 M99
3. sequence type NC program file is carried out the PIDP compiling:
Comprise used variable set up initial value in the compiling; By CONFIG.SYS the systematic parameter variable is set; The capable compiling of recursive call function is compiled into a PIDP with each NC order in order, and the PIDP sequence that will compile generation is stored in the hard disk of host computer with the form of file destination; Comprise that also calling PIDP arrangement function finishes the speed budget, and the arrangement of finishing presumable a plurality of PIDP after delegation's compiling;
Flow chart is referring to Fig. 2 and table 15, and table 15 is N-S charts of circulating compiler control program.
Following a~the i of specific implementation step:
A, the variable set up initial value arranges initial value to variable used in the program such as the counter variable of makeing mistakes, English/metric system indexed variable etc.;
B arranges the systematic parameter variable, by CONFIG.SYS maximum permission speed value, accekeration, the cutter length compensation value of systematic parameter variable such as axle, the limiting value of mechanical coordinate system is set;
Does c declare file and finishes? be, finish compiling, enter step 4.; No, enter the d step;
Does d declare the whether set of total error flag? be, finish compiling, enter step 4.; No, enter the e step;
E reads row of N C code;
F, is declaring the beginning of NC program? be, generate PIDP and the deposit of expression beginning, enter the c step; Is no, then declaring the end of NC program? be to finish, generate PIDP and deposit that expression finishes, and end mark is set, enter the c step; Not to finish, enter the g step;
G, is declaring the NC program number? be, generate PIDP and the deposit of representation program number, enter the c step; No, enter the h step;
H, is declaring the NC code line? be, call NC code line compiling function, enter the c step; No, enter the i step;
I, is declaring comment line? be, ignore this journey, directly enter the c step; No, think invalid information, the counter of makeing mistakes increases one, and error message writes report file, enters the c step.
Described h step is called NC code line compiling function, referring to Fig. 3, comprises and extracts and filter NC code line sequence number; Call capable PIDP compiling function; Call PIDP arrangement function. Described row PIDP compiling function program block diagram, referring to Fig. 4, wherein "*Treat () " the PIDP compiling function of NC command character of expression corresponding " * " beginning, for example " Gtreat () " expression is to the compiling of G order, and this class function has 14 at least, and their realization principle is identical.
Table 15
While (! Total error flag Bian Liang ﹠﹠! Feof (filel))
Read data line
Filter out first character
Switch (first character)
Case ' % ': if (first character==' % ' and be for the first time)
Yes No
Produce the PIDP that an explanation NC program begins, and write file destination If (first character==' % ')
Yes: produce the PIDP of explanation NC EP (end of program), and write file destination, put end mark No:
break;
case‘O’:
Produce the PIDP of NC program number sign, and write file destination
break;
case‘N’:
Yes: call row compiling function
break;
case‘’:case‘(’:
Break; // (ignoring comment line)
Defualt: the count flag of makeing mistakes increases 1, calls error handler, to report file write error information.
Example 9; To row of N C code: " N102 G01x10.8y30.6 ", extract and filter NC code line sequence number after, remaining " G01x10.8y30.6 " deposits array stmp[in], by identification stmp[0] decide which call*Treat () function?
Since iv=0, stmp[iv] be ' G ', therefore, call Gtreat (). At this moment array index variable i v++, Gtreat () is from stmp[iv] read according to the order of sequence numerical character " 01 ", and deposit array cnum[in] array, after the continuous number character extracts and finishes, judge cnum[] string length whether equal 0 or greater than 2, be, wrong for grammer, do not compile and carry out wrong processing; No, for grammer error-free, just with cnum[] in character string convert the integer number to, and deposit the v1 variable in, utilize switch (v1) ... statement identifies and is G01 order, and and then the object code 1001 of G01 is write first unit of the buffering area of PIDP, program number 102 writes second unit, length 9 writes the 3rd unit, and so far Gtreat () carries out and finishes. Later " x10.8y30.6 " compiled by Xtreat () and Ytreat () function, and the data of compiling are write Unit the 4th, the 5th. Since in this example without the Z data, the Unit the 6th that just current Z data write direct, and current speed data write Unit the 8th, and Unit the 7th, the 9th writes first 0, in the situation that needs Vs, Ve, finally determine these speed datas by PIDP arrangement function after waiting for.
The described specific requirement that will put on request and write through the PIDP that the space compiler produces file destination in order comprises:
A. essential sequence requirement: for example: NC01X10.2Y10.8M08, the PIDP of M08 will be positioned at before the PIDP of G01X10.2Y10.8.
B. optional correlation requires: this section machining locus and the front correlation of the section of continuing, subsequent segment in process, for example the feedrate linking between the orbit segment is more level and smooth better. When this correlation depended primarily on motion control function in the numerical control software and needs Vs, Vm, Ve, PIDP arrangement function just adopted the speed budget finally to determine these speed datas.
Described PIDP collates program as follows:
A. current PIDP is deposited among the buffering area BuffData, buffering area Buff_result is used for storing a collection of PIDP that correlation motion NC order is arranged;
Whether be motion NC order, can be to carry out c by whether X, Y, Z coordinate discriminating data being arranged if b. declaring; No, carry out g;
Whether c. declare is the G00 order:
If G00 order, declare again whether a collection of beginning, whether data are namely arranged among the Buff_result, countless certificates are a collection of beginning, state variable Seg_count=0 is expressed as a collection of beginning: be, the PIDP of G00 is write file destination, then return; No, front a collection of PIDP is carried out the relevant speed budget, and the data among the Buff_result are write file destination, the PIDP of G00 is write file destination, then return;
If not the G00 order, carry out d;
Whether d. declare is the G01 order:
If G01 order, declare again whether a collection of beginning: be, deposit the PIDP of G01 in Buff_result, then return; No, carry out again whether correlation is differentiated: be, deposit PIDP in Buff_result, then return; No, front a collection of PIDP is carried out speed budget and front a collection of PIDP is write file destination, the PIDP of current G01 is write Buff_result, then return;
If not the G01 order, carry out e;
Whether e. declare is G02 or G03:
If G02 or G03 order, declare again whether a collection of beginning: be, deposit PIDP in Buff_result, then return; No, carry out again whether correlation is differentiated: be, deposit PIDP in Buff_result, then return; No, front a collection of PIDP is carried out speed budget and front a collection of PIDP is write file destination, deposit the PIDP of current G02 or G03 in Buff_result, then return;
Neither G03 if not G02, carry out f;
Whether is G28 order: be to declare Seg_count again and whether equal 0 if f. declaring: be, the PIDP of G28 is write file destination, then return; No, the data among the Buff_result are carried out the speed budget, and the PIDP among the buff_result is write file destination, then the PIDP with G28 writes file destination, then returns;
If not G28, carry out g;
Whether is a collection of beginning: be, current PIDP is write file destination, then return if g. declaring; No, the PIDP among the Buff_result is carried out the speed budget, and the PIDP after the budget is write file destination, then current PIDP is write file destination, then return.
4. judge whether translation result is correct
Whether counter judges whether correctly that greater than 0 no is correct, produces expression correct report and deposit, enters 5. by makeing mistakes; Be for incorrect, directly enter 5..
5. close all EP (end of program).
(2) operation PIDP_NC code encoder in host computer becomes format and complete order to carry out the object code file of meaning the NC program translation.
The software of host computer is by call format system (" PIDP_NC sgcode.txt ") operation PIDP_NC code encoder, and wherein: PIDP_NC is executable file; Sgcode.txt is the NC program file. the result of operation is that the generation content is the sgcode.obj file destination of PIDP sequence, becomes format and complete order to carry out the object code file of meaning for program compilation NC.
(3) host computer is sent the PIDP object code into the slave computer cyclic buffer in order in batches.
The slave computer cyclic buffer forms with capacity buffering area buffer1 and buffer2 by two, host computer is constantly inquired about state variable buffer1_status, the buffer2_status of buffering area buffer1, buffer2 in whole process, if wherein the value of certain variable is zero, just write the PIDP data to this buffering area, write step is as follows:
1) open up extra buffer PC_buff at host computer, variable x zero clearing, the sum_size zero clearing, pointed PC_buff first address, PC_buff is identical with the buffer1 size;
2) from file destination, read in order a PIDP, and obtain the length value x of this PIDP;
3) in order PIDP is write PC_buff, sum_size=sum_size+x;
Whether the value of 4) judging sum_size+m is to enter step 5 greater than the length of PC_buff); No, continue step 2); Wherein m is more than or equal to the length of maximum PIDP, and recommendation is 60;
5) PC_buff is remained the unit and insert data 0x80000000, represent that follow-up unit is not effective PIDP;
6) differentiating whether available free buffering area of slave computer by the buffer state variable, is to enter step 7); No, continue to differentiate;
7) the data communication handling function that provides with embedded system writes the PC_buff data in the freebuf of slave computer;
8) putting current buffer state variable is 1, represents that this buffer data can not be capped, and so far, passes end under a collection of PIDP, the x zero clearing, and the sum_size zero clearing, pointed PC_buff first address goes to step 2), so circulation is until the file destination end.
(4) slave computer uses PIDP.
Slave computer reads in order from cyclic buffer and comprises slave computer cyclic buffer management PIDP and slave computer PIDP object code, through data identification among the PIDP being determined the meaning of corresponding NC order, obtain simultaneously corresponding data, meaning according to order is called corresponding motion control function, realizes machining control.
1) slave computer reads in order from cyclic buffer and comprises slave computer cyclic buffer management PIDP and slave computer PIDP object code.
Host computer has been sent into first and second batch data respectively slave computer cyclic buffer Buffer1, Buffer2, the control software of slave computer is at first from Buffer1 reading out data according to the order of sequence, call corresponding motion control function through recognizer and realize digital control processing, use the data among the Buffer1, just with the zero setting of buffer1_statue variable, then use the data of Buffer2, this moment buffer2_statue=1, host computer is sent the 3rd batch data into Buffer1 again simultaneously, slave computer uses the data among the Buffer2, again with the zero setting of buffer2_statue variable, and use Buffer1, this moment buffer1_statue=1, host computer is sent the 4th batch data into Buffer2 again simultaneously, the PIDP data are to circulate successively to send into Buffer1, Buffer2, use PIDP to recycle successively Buffer1, Buffer2;
In Software for Design when planning,, definition cyclic buffer Buffer1,2 size are 2KB or less, adopt cyclic buffering queues, no matter how large the NC program is, namely no matter how large the PIDP file destination is, and the data buffering RAM of slave computer only needs 4KB, can significantly save the memory space of slave computer.
2) slave computer obtains corresponding data simultaneously through the PIDP identification decision being gone out the meaning of corresponding NC order, calls corresponding motion control function according to the meaning of order, realizes machining control.
Slave computer obtains a PIDP, usefulness switch () ... statement carries out order object code identification to first unit among the PIDP, if 1001, the rectilinear motion control function called; If 1002, call the circular motion control function; If other integer, just call other corresponding function, to realize machining control, referring to Fig. 5. When calling above-mentioned function, owing among the PIDP packet length data and parameter are arranged, can therefrom obtain the parameter that function needs.
Above content is the further description of the present invention being done in conjunction with concrete preferred embodiment, can not assert that implementation of the present invention is confined to these explanations. For the general technical staff of the technical field of the invention; without departing from the inventive concept of the premise; can also make some simple deduction or replace, all should be considered as belonging to the scope of patent protection that the present invention is determined by claims of submitting to.

Claims (10)

1. NC code compiler, it is characterized in that: its structure comprises:
1) object code of NC order is namely worked out in definition;
2) form and the content of the PIDP of the corresponding NC order of design construction: comprise that the form of PIDP and the PIDP of multi-parameter, printenv and one-parameter order formulate;
3) design is programmed in the PIDP_NC code encoder of host computer operation, and following steps are arranged:
1. open the NC program file: open the NC program file, create one for the file destination of storing object code, a report file that is used for record compiling result at least with the function that opens file;
2. the NC program file is put in order: will become not have with the grand extension process of the NC program of subprogram the sequence type NC program file of subprogram;
3. sequence type NC program file is carried out the PIDP compiling: comprise used variable set up initial value in the compiling; By CONFIG.SYS the systematic parameter variable is set; The capable compiling of recursive call function is compiled into a PIDP with each NC order in order, and the PIDP sequence that will compile the complete order execution meaning that produces is stored in the hard disk of host computer with the form of file destination; Comprise that also calling PIDP arrangement function finishes the speed budget, and the arrangement of finishing presumable a plurality of PIDP after delegation's compiling;
4. judge whether the compiling result is correct: be just to generate the file of report correct information; No, just generate the file of reporting error message;
5. close all EP (end of program).
2. according to NC code compiler claimed in claim 1, it is characterized in that:
The form of described PIDP is format, becomes the PIDP object code after inserting data.
3. according to claim 1 or 2 described NC code compilers, it is characterized in that:
Described PIDP object code all is comprised of the integer data encoding.
4. according to NC code compiler claimed in claim 3, it is characterized in that:
The format of described PIDP is: order object code+sequence number+packet length+parameter.
5. according to NC code compiler claimed in claim 4, it is characterized in that:
Formed by PIDP_NC source files of program, PIDP_NC_lib library file and PIDP_NC_sys CONFIG.SYS and help information file PIDP_NC_help.
6. according to NC code compiler claimed in claim 5, it is characterized in that:
Be applicable to Windows2000, WindowsXP and (SuSE) Linux OS.
7. according to NC code compiler claimed in claim 6, it is characterized in that:
Be applicable to the cnc system software by Java, C and C++ exploitation.
8. set up the method for cnc system software based on NC code compiler for one kind, it is characterized in that: following steps are arranged:
(1) makes up the PIDP_NC code encoder;
(2) in host computer, adopt the PIDP_NC code encoder to become format and complete order to carry out the object code file of meaning the NC program compilation;
(3) host computer is sent the PIDP object code into the slave computer cyclic buffer in order in batches;
(4) slave computer reads in order from cyclic buffer and comprises slave computer cyclic buffer management PIDP and slave computer PIDP object code, through data identification among the PIDP being determined the meaning of corresponding NC order, obtain simultaneously corresponding data, meaning according to order is called corresponding motion control function, realizes machining control.
9. set up the method for cnc system software according to claimed in claim 8 based on NC code compiler, it is characterized in that:
The form of the PIDP of described NC code compiler is format, becomes the PIDP object code that is comprised of the integer data encoding after inserting data.
10. describedly set up the method for cnc system software based on NC code compiler according to claim 8 or 9, it is characterized in that:
The format of described PIDP is: order object code+sequence number+packet length+parameter.
CNB2005101210050A 2005-12-19 2005-12-19 Method for establishing digital control system software based on digital control code encoder Expired - Fee Related CN100480916C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2005101210050A CN100480916C (en) 2005-12-19 2005-12-19 Method for establishing digital control system software based on digital control code encoder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2005101210050A CN100480916C (en) 2005-12-19 2005-12-19 Method for establishing digital control system software based on digital control code encoder

Publications (2)

Publication Number Publication Date
CN1811632A true CN1811632A (en) 2006-08-02
CN100480916C CN100480916C (en) 2009-04-22

Family

ID=36844600

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2005101210050A Expired - Fee Related CN100480916C (en) 2005-12-19 2005-12-19 Method for establishing digital control system software based on digital control code encoder

Country Status (1)

Country Link
CN (1) CN100480916C (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100412736C (en) * 2006-10-17 2008-08-20 哈尔滨工业大学 Edition-translation type numerical-control system and edition-translation and operation control method of same
CN101247294B (en) * 2008-03-14 2010-09-29 北京星网锐捷网络技术有限公司 Test data generating method and device
CN102141794A (en) * 2011-02-25 2011-08-03 广西大学 Continuous locus intersegment connecting speed processing method for numerical control system
CN102103371B (en) * 2009-12-18 2012-10-10 财团法人工业技术研究院 Device and method for realizing multiaxial synchronous interpolation by multisystem connection
CN103019801A (en) * 2012-12-20 2013-04-03 北京航天测控技术有限公司 Compiler applied to high-speed digital I/O wave engines
CN103907067A (en) * 2012-10-30 2014-07-02 三菱电机株式会社 Numerical control device
CN104133421A (en) * 2014-08-01 2014-11-05 南京埃斯顿自动化股份有限公司 Motion control code analysis method based on process control
CN104281096A (en) * 2013-07-08 2015-01-14 广州中国科学院先进技术研究所 Construction method of numerical-control code compiler
CN104570957A (en) * 2015-02-02 2015-04-29 中山市大谷电子科技有限公司 Intelligent numerical-control engraving machine controller
CN110632499A (en) * 2019-09-23 2019-12-31 珠海格力电器股份有限公司 Test vector generation method based on test object and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100370380C (en) * 2004-10-15 2008-02-20 李迪 Opening rearrangeable soft digital control system
CN1306352C (en) * 2004-12-11 2007-03-21 东方汽轮机厂 Four-axle linked digital controlled processing post processing method and its control system

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100412736C (en) * 2006-10-17 2008-08-20 哈尔滨工业大学 Edition-translation type numerical-control system and edition-translation and operation control method of same
CN101247294B (en) * 2008-03-14 2010-09-29 北京星网锐捷网络技术有限公司 Test data generating method and device
CN102103371B (en) * 2009-12-18 2012-10-10 财团法人工业技术研究院 Device and method for realizing multiaxial synchronous interpolation by multisystem connection
CN102141794A (en) * 2011-02-25 2011-08-03 广西大学 Continuous locus intersegment connecting speed processing method for numerical control system
CN102141794B (en) * 2011-02-25 2012-11-21 广西大学 Continuous locus intersegment connecting speed processing method for numerical control system
CN103907067A (en) * 2012-10-30 2014-07-02 三菱电机株式会社 Numerical control device
CN103907067B (en) * 2012-10-30 2015-08-19 三菱电机株式会社 Numerical control device
CN103019801A (en) * 2012-12-20 2013-04-03 北京航天测控技术有限公司 Compiler applied to high-speed digital I/O wave engines
CN104281096A (en) * 2013-07-08 2015-01-14 广州中国科学院先进技术研究所 Construction method of numerical-control code compiler
CN104133421A (en) * 2014-08-01 2014-11-05 南京埃斯顿自动化股份有限公司 Motion control code analysis method based on process control
CN104570957A (en) * 2015-02-02 2015-04-29 中山市大谷电子科技有限公司 Intelligent numerical-control engraving machine controller
CN110632499A (en) * 2019-09-23 2019-12-31 珠海格力电器股份有限公司 Test vector generation method based on test object and storage medium
CN110632499B (en) * 2019-09-23 2021-04-23 珠海格力电器股份有限公司 Test vector generation method based on test object and storage medium

Also Published As

Publication number Publication date
CN100480916C (en) 2009-04-22

Similar Documents

Publication Publication Date Title
CN1811632A (en) A digital control code encoder and method for establishing digital control system software based on the same
CN1101019C (en) Data sequence generation method and apparatus, conversion method, and computer
CN1293465C (en) GUI application development support device, GUI display device, method, and computer program
CN1630838A (en) Numeric control method and numeric control system
CN1287257C (en) Optimization of N-base typed arithmetic expressions
CN1122216C (en) Optimizer
CN1229701C (en) Integrated support system for supporting sheet metal machining
CN1152305C (en) Virtual machine system
CN1227589C (en) Data processing apparatus and method for saving return state
CN1276359C (en) A memory engine for the inspection and manipulation of data
CN1521623A (en) Compiler apparatus and compilation method
CN1967421A (en) Dynamic forward-looking processing method of small program segment and implementing device
CN1355735A (en) Electric discharge machine and method of electric discharge machining
CN1037597A (en) Part program generating system
CN1046987A (en) Programmable Logic Controller
CN1637696A (en) System and method for supporting input confirmation in mobile terminal equipment
CN1918546A (en) Program conversion device and program conversion method
CN1869952A (en) Instruction actuating equipment, debugging method, debugging device, and debugging program
CN1862432A (en) Control method of carbon fiber high-precise numerically controlled milling machine
CN1026629C (en) Creating multiple version of panels from single panel definition file
CN1744093A (en) Data flow graph processing method and processing apparatus provided with reconfigurable circuit
CN1577250A (en) Method and apparatus for implementing power of two floating point estimation
CN1143213C (en) Compiler and processor for processing loops at high speed
CN1105953C (en) Machining program file convertor for numerically controlled equipment and computer-readable recording medium storing program for controlling computer to execute file conversion procedure
CN101055569A (en) Function collection method and device of electronic data table

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090422

Termination date: 20101219