# PCB Heaven

## General Category => Maths, Geometry, Physics and others => Topic started by: stamatis on August 23, 2008, 21:20:35 PM

Title: CNC Machines - Workpiece Coordinate Systems
Post by: stamatis on August 23, 2008, 21:20:35 PM
When you start up a machine, it will ask you for a zero cycle***. It will not start until it has complete the zero cycle. What is this zero cycle? Simply, the machine will slowly move all their axis to meet some limit switches. For the X axis for example, the machine will slowly move the X axis until it reaches the X axis limit switch. It will then stop moving. Now the machine knows exactly where it stands. When you turn on a CNC, it does not know itâ€™s actual position on each axis. Thatâ€™s why the zero cycle is necessary.

In an ideal world, the actual zero position of each axis would be the same as the zero point. But this never happens. The program zero point for X-axis for example is different than the machine zero point of the X axis and this happens because the limit switch could be placed anywhere on the body of the machine. Now it is necessary to somehow declare the programming zero point in respect to the zero point. This is done using the WCS (Workpiece Coordinate Systems). In the attached picture p8.jpg for example, we need to adjust the program zero point in order to be at the top left side of the paper. We do this because it is easier to have reference from this position, rather than the machine zero point. So, we define the WCS as follows:

WCS  X= - 253.4mm and
WCS Y= 53.4.

Each machine has more than one WCS. This is done because there may be more than one program zero points to be used. In the attached picture p9.jpg, you can se four different WCSs for a table, each one declared on each corner of it.

The WCS for a normal controller can be up to 6, named WCS 1, WCS 2 and so on. They are pre-defined from the settings of the controller. When you start programming, the WCS 1 is by default the first WCS to be taken into account. But during program flow, you may change a WCS system. This is done by the following commands:

G54: Select Workpiece Coordinate System 1
G55: Select Workpiece Coordinate System 2
G56: Select Workpiece Coordinate System 3
G57: Select Workpiece Coordinate System 4
G58: Select Workpiece Coordinate System 5
G59: Select Workpiece Coordinate System 6

It will be easier to understand the above with an example. In our example, the WCS 1 (G54) is declared on the top left corner of the machine table and the WCS 2 (G55) is declared on the bottom right corner of the machine table.

Code: [Select]
`N1 G90 G21 G54 ; Absolute programming, metric units, WCS 1N2 G0 X10 Y10 Z30N3 G1 Z0 F1000N4 G55 G1 X-20 Y-20 ; Change to WCS 2 and draw a line to â€“20 , -20N5 G0 Z30`
The result of the above program is shown in attached file p10.jpg. Why X and Y are negative? Because, we are currently using the WCS 2. A positive value would move the X axis below of the new zero point and same a positive value for Y would move it right of the new zero point. This would set the point out of the working table and we do not want that to happen. You should now notice that:

CHANGING A WORKPIECE COORDINATE SYSTEM CAUSES ONLY THE ZERO POINT TO CHANGE. THE DIRECTION OF MOVEMENT OF EACH AXIS WILL REMAIN AS IS.

In our example machine, negative values on X will move the machine always higher and positive always lower. For Y axis, positive values will move the machine always to the right and negative always to the left. And this will happen regardless the currently selected WCS. Keep that always in mind.