## Friday, October 30, 2015

### Programming 101: CNC (part 2 of 2)

http://www.bromotravelindo.com

After those steps, you have to create a subprogram that will deal with the math. This step will then allow your machine to compute the necessary variables and effectively operate without stopping to ask the operator what the limitations are.

To show you what these codes look like, here’s an example from Wikipedia:

#101=10  (how many holes)
#102=0   (x position of ctr of bolthole)
#103=0   (y position of ctr of bolthole)
#104=0   (angle of first hole
Tool call,
spindle speed,and offset pickup,etc
G43 in some cases (tool length pickup)
G81(drill cycle)
call sub program
N50
G80
M30

Subprogram
N100
#105=((COS#104)*#100)    (x location)
#106=((SIN#104)*#100)    (y location)
x#105 y#106   (remember your G81 code is modal)
If #100 GT 360 goto N50
#100=(#100+(360/#101))
Goto 100

In the code above, the machine is a drill. The operator utilized a loop in order to keep the machine from stopping. The subprogram then governs the cycle of the machine. This code is still quite a simple code. Other machines require the inclusion of the maximum RPM in the coding.

An easier way of programming CNC machines would be the use of Computer Aided Manufacturing (CAM). This system takes on the brunt of programming so that it doesn’t seem so tedious and frustrating. It is still similar to BASIC.

Another programming enhancement that was developed was the parametric programs or the logical commands. These programs were designed to shorten lengthy codes in order to make them user friendly. However, these codes do not always use the same language with every machine. The language and sequence often varies depending on the typ of machine you will be working on.

The operator has to know what the machine can do or what it was made to do before attempting to program it. You should be able to visualize the machine doing what you want it to do.

But, you don’t have to be a math wizard or a programming genius. You just have to know what your machine does and what you want it to do.