TOC PREV NEXT INDEX

National Institute of Standards and Technology





The NIST RS274NGC Interpreter - Version 3


Thomas R. Kramer
Frederick M. Proctor
Elena Messina


Intelligent Systems Division
National Institute of Standards and Technology
Technology Administration
U.S. Department of Commerce
Gaithersburg, Maryland 20899


NISTIR 6556
August 17, 2000

Disclaimer

Commercial equipment and materials are identified in order to specify certain procedures adequately. In no case does such identification imply recommendation or endorsement by the National Institute of Standards and Technology, not does it imply that the materials or equipment identified are necessarily the best available for the purpose.

Acknowledgements

Partial funding for the work described in this paper was provided to Catholic University by the National Institute of Standards and Technology under cooperative agreement Number 70NANB7H0016.

Abstract

This report describes an interpreter which reads numerical control code and produces calls to a set of canonical machining functions. The interpreter is a software system written in the C++ programming language. The output of the interpreter may be used to drive 3-axis to 6-axis machining centers. Input to the interpreter is RS274 code in the dialect defined by the Next Generation Controller (NGC) project, with modifications. The interpreter may be compiled as a stand-alone computer program or may be integrated with the NIST Enhanced Machine Controller (EMC) control system. Input can come from a file or from a user typing on a computer keyboard. Output commands can either be printed for future use or be executed directly on a machining center. The report includes a full description of the RS274/NGC input language and the canonical machining functions called by the interpreter. It is a complete users manual.

Keywords

controller, interpreter, machining, NC code, numerical control, NIST, rs274

1.0 Introduction 1
1.1 Audience 1
1.2 Background 1
1.2.1 Enhanced Machine Controller Project 1
1.2.2 Numerical Control Programming Language RS274 1
1.2.3 The RS274/NGC Language 2
1.2.4 Previous Work at NIST 2
1.2.5 Current Work at NIST 3
1.3 Major Characteristics of the Interpreter 3
1.3.1 How it Runs 3
1.3.2 Modes of Use 3
2.0 Machining Center Overview 4
2.1 Machining Centers 4
2.1.1 Mechanical Components 4
2.1.2 Control and Data Components 6
2.2 Interpreter Interaction with Switches 9
2.2.1 Feed and Speed Override Switches 9
2.2.2 Block Delete Switch 9
2.2.3 Optional Program Stop Switch 9
2.3 Tool File 9
3.0 Input: the RS274/NGC Language 12
3.1 Overview 12
3.2 RS274/NGC Language View of a Machining Center 12
3.2.1 Parameters 12
3.2.2 Coordinate Systems 14
3.3 Format of a Line 14
3.3.1 Line Number 15
3.3.2 Word 15
3.3.3 Parameter Setting 18
3.3.4 Comments and Messages 18
3.3.5 Item Repeats 19
3.3.6 Item order 19
3.3.7 Commands and Machine Modes 19
3.4 Modal Groups 20
3.5 G Codes 21
3.5.1 Rapid Linear Motion - G0 23
3.5.2 Linear Motion at Feed Rate - G1 23
3.5.3 Arc at Feed Rate - G2 and G3 23
3.5.4 Dwell - G4 25
3.5.5 Set Coordinate System Data - G10 25
3.5.6 Plane Selection - G17, G18, and G19 25
3.5.7 Length Units - G20 and G21 26
3.5.8 Return to Home - G28 and G30 26
3.5.9 Straight Probe - G38.2 26
3.5.10 Cutter Radius Compensation - G40, G41, and G42 28
3.5.11 Tool Length Offsets - G43 and G49 29
3.5.12 Move in Absolute Coordinates - G53 29
3.5.13 Select Coordinate System - G54 to G59.3 29
3.5.14 Set Path Control Mode - G61, G61.1, and G64 30
3.5.15 Cancel Modal Motion - G80 30
3.5.16 Canned Cycles - G81 to G89 30
3.5.17 Set Distance Mode - G90 and G91 36
3.5.18 Coordinate System Offsets - G92, G92.1, G92.2, G92.3 36
3.5.19 Set Feed Rate Mode - G93 and G94 37
3.5.20 Set Canned Cycle Return Level - G98 and G99 37
3.6 Input M Codes 38
3.6.1 Program Stopping and Ending - M0, M1, M2, M30, M60 38
3.6.2 Spindle Control - M3, M4, M5 39
3.6.3 Tool Change - M6 39
3.6.4 Coolant Control - M7, M8, M9 39
3.6.5 Override Control - M48 and M49 39
3.7 Other Input Codes 40
3.7.1 Set Feed Rate - F 40
3.7.2 Set Spindle Speed - S 40
3.7.3 Select Tool - T 40
3.8 Order of Execution 41
4.0 Output: the Canonical Machining Functions 42
4.1 Introduction 42
4.1.1 Objectives of Canonical Machining Functions 42
4.1.2 Implementing Canonical Machining Functions 42
4.2 Canonical Machining Function View of a Machining Center 45
4.2.1 Mechanical Components 45
4.2.2 Control Components 45
4.2.3 Error Conditions 46
4.3 The Canonical Machining Functions Defined 46
4.3.1 Preliminaries 46
4.3.2 Initialization and Termination 47
4.3.3 Representation 47
4.3.4 Free Space Motion 48
4.3.5 Machining Attributes 48
4.3.6 Machining Functions 51
4.3.7 Spindle Functions 55
4.3.8 Tool Functions 57
4.3.9 Miscellaneous Functions 58
4.3.10 Program Functions 61
4.3.11 Cutter Radius Compensation 61
5.0 Stand-Alone Interpreter 62
5.1 Running the SAI 62
5.1.1 Starting the SAI 62
5.1.2 Running with Keyboard Input 63
5.1.3 Running with RS274/NGC File Input 65
5.2 Building an SAI Executable 65
5.3 Interpreter Speed 68
Appendix A Error Handling 70
A.1 Basic Approach 70
A.2 Handling Calculated Values 71
A.3 Compiler Macros 71
A.4 Automatic Generation of Software 71
A.5 Interpreter Bugs 72
A.6 Stand-Alone Interpreter Driver Error Messages 72
Appendix B Cutter Radius Compensation 73
B.1 Introduction 73
B.1.1 Data for Cutter Radius Compensation 74
B.2 Programming Instructions 75
B.2.1 Turning Cutter Radius Compensation On 75
B.2.2 Turning Cutter Radius Compensation Off 75
B.2.3 Sequencing 75
B.2.4 Use of D Number 75
B.3 Material Edge Contour 75
B.3.1 Programming Entry Moves 76
B.4 Nominal Path Contour 78
B.5 Programming Errors and Limitations 80
B.5.1 Concave Corner and Tool Radius Too Big (10 and 16) 81
B.5.2 Cannot Turn Cutter Radius Comp on When On (5) 81
B.5.3 Cutter Gouging (11) 82
B.5.4 Tool Radius Index Too Big (15) 82
B.5.5 Two G Codes Used from Same Modal Group (17) 82
B.6 First Move into Cutter Compensation 82
Appendix C Sample Programs 84
C.1 Sample Simple Program 84
C.2 Sample Program to Test Expressions 85
C.3 Sample Program to Test Canned Cycles 86
Appendix D Interpreter Software 88
D.1 Interpreter Interfaces 88
D.2 Software Files and Organization 89
D.3 Cyclic Operation 91
D.3.1 Read, Store, and Check 91
D.3.2 Execute 91
D.4 Interpreter-do-it Functions 91
D.5 Interpreter-give-information Functions 92
D.6 World-give-information Functions 93
D.7 Interpreter Function Call Hierarchies 95
D.8 Special Topics 101
D.8.1 Interpreter World Model 101
D.8.2 Block Model 102
D.8.3 Expression Evaluation 103
D.8.4 Parameter Buffering 103
Appendix E Production Rules for theRS274/NGC Language 105
E.1 Production Language 105
E.2 Productions 105
E.3 Production Tokens in Terms of Characters 107

TOC PREV NEXT INDEX