Sep 01, 2023 Leave a message

NC macro program unconditional transfer GOTO statement explanation, easy to understand

 

We know that ordinary programs run from top to bottom, and unconditional jumps can be realized in macro programs. Let me share an application case of unconditional transfer statements

 

picture

Add WeChat: Yuki7557 to send 10G CNC tutorial

When all machine tools are turned on in winter, they must be operated with a heat engine. This is something everyone knows, so what is a heat engine? It is to prevent some problems when the guide suddenly starts up due to the low temperature in winter, such as minor problems such as low precision, and serious problems such as the breakage of some parts of the machine tool. Therefore, we must perform a heat engine operation before starting the machine in winter, so that the machine tool components can be heated evenly through the heat engine operation.

 

So how do you usually carry out the heat engine operation? Ordinary people, that is, turn on the spindle and let the spindle rotate for tens of minutes, and at the same time manually move the tool post back and forth on the X-axis and Z-axis. Do it repeatedly like this. If at this time, you have something to leave for a while, and you don't want the machine tool to stop, what should you do? At this time, do you really want the machine tool to run automatically? Can this be done?

 

Before you have learned macro programs, you will feel that this seems to be an incredible thing. If you know a little about macro programs, you will find that this is actually a simple thing, and it is easy to implement.

Before sharing this case, preview the unconditional transfer statement

GOTO n (n represents the number of the serial number)

Students who have learned English know that the above is composed of GO and TO, which means to go to ..., where the following n (n represents the number of the serial number) represents the program line number (such as GOTO 100, which means jumping to the N100 line program segment)

Well, we can learn how to realize this automatic warm-up function through macro statements.

Example of using conditional statement - thermal engine macro program

(PROGRAM BY)

O0001

M03S300

N5 G01Z50.F50.

Z300.

X200.

Y200.

X-200.

Y-200.

GOTO 5

M30

This is the simplest macro program heat engine.

Here we have to learn about the role of the GOTO statement

The meaning of the program segment GOTO 5 is: unconditionally go to the N5 line when this program segment is executed. Then run the following program segments in turn, and jump to N5 program segment when encountering GOTO 5....

This constitutes an endless loop. The CNC machine tool can run without limitation until the execution of the program is stopped manually.

 

 

Send Inquiry

whatsapp

skype

E-mail

Inquiry