Origin and Modal
Code Practice
This chapter supports Lesson 3, page 10.
OBJECTIVE
After completing this unit, you should be able to:
- identify modal commands
- recognize the reference for origin in CNC codes
Origin
The origin is located on the part. The coordinates are (0, 0, 0). Engineers and programmers will call this a datum. For this introduction to CNC, datum and origin will mean the same thing. Origin is also called part zero.
Because this point of origin is on the part, it positions the axes (0 ,0, 0) of the work coordinate system. The origin point is where G90 coordinates will calculate their movements.
Modal or Non-Modal
You may have noticed that there are different kinds of switches that we use every day to turn things on and off.
- A light switch mounted on the wall is a type of toggle switch. When you turn it on, it stays on until somebody comes along and turns it off.
- A car horn is a different type of switch. Thankfully a properly functioning horn only makes sound while it is being pressed. This type of switch is known as a momentary contact switch.
Similarly, there are two kinds of G-codes that work much the same way. These are known as modal (toggle switch) codes and non-modal (momentary contact) codes. Modal codes stay on until another code turns them off.
It is vital to understand that modal codes stay active even after a program has ended. This is one reason standard headers are so often used in industry. These headers clear out the codes that would be dangerous to the operation of the machine if their setting was not set to a known condition.
An example of a modal code is G20. G20 sets the units of the machine to inches (G21 sets to mm). If a programmer wrote a program for a machine that was assumed to be in millimeters, it could be a big problem when the machine interpreted the values as inches.
Always be sure to use a header to set explicitly any modal commands that would affect execution of the program.
Non-modal commands, however, are only active during the block in which they exist.
An example of a non-modal command is G04 (dwell). G04 is often used to pause a drilling operation at the bottom of a hole for a certain length of time so the bottom of a hole can be made completely smooth. If a G04 is put in one line of code, it only pauses the operation(s) initiated by that block. The following blocks will not be paused unless they include their own G04 command. Non-modal commands are temporary.
Most machine tool manufacturers distinguish between modal and non-modal commands in their programming manuals.
Questions