1. What is a macro program
The method of NC programming with variables is called NC macro programming. Our ordinary programs (such as G01X100.Y100.F200) X and Y addresses are followed by constants. If we use these constants to write variables such as G01X#1 Y#2 F200, this is what we call a macro program.
Note*: FUNC system uses #1, #2, etc. to represent variables. Different expressions of the machine tool system are also different, here is the FUNC system as an example) The FUNC system uses #1, #2, etc. to represent variables. It is composed of "#" and "number". Such as #1, #2...#33 etc. Does the number 1, 2, 3, etc. behind these # have any meaning? In fact, it is just the code name of the macro variable.
To give the simplest example: If there are three people, their names are all Xiao Li. Then when you call Xiao Li, there will be a question, all three people will answer, but you actually only want to call one of them. This is not clear. Similarly, #1, if the following numbers are the same, when the system uses #1, it will also be confused. Which one should I use? So in order to distinguish them, write the following numbers as different, such as #1, #2, #3. If the system uses #1 at this time, there will be no confusion.
2. What is a variable
A variable is a quantity that changes, and the corresponding constant is a constant. (Constants such as: 1, 2, 22, 65, etc. Arabic numerals. Variables such as: #1, #2, #5, etc., what is the value of #1, #2? Because it is a variable, one will change ).
3. What are the variables
For example, if variables like #1, #2 are used as bank cards, if you deposit a lot of money in these cards, then there will be a lot of money in these cards (for example, if you deposit 500 yuan in #1, then #1 is equivalent At 500, 300 is taken away, and there is 200 in #1)
4. Assignment of variables
The process of storing 500 yuan in #1 is called variable assignment. If you don’t deposit or withdraw money in "#1", then #1 is equivalent to 500. That is to say, if there is no operation on #1, it is 500. If there is such a program segment G0X#1, then It is equivalent to this program segment G0X500. So how are variables assigned in CNC machine tools?
The format is as follows:
#5=100 Assign the value of 100 to the variable #5 Assign the constant to #5
#1=#1-1 Assigns the result of the operation #1-1 to #1 and assigns the result of the expression to #1
#6= [#11 #15 3] Assign [#11 #15 3] the result of the expression to #6 and assign the result of the expression to #6
Okay, after understanding the variables, Qingfeng, I will start with a simple part and experience how variables can be used in part processing.
For example, in the following diagram, a batch of balls with the same shape but different sizes need to be processed.
The main procedure for processing SR6.0 balls is as follows:
....
G03X12.0Z-6.0R6.0
....
When we process R8.0 balls, we need to modify the program:
....
G03X16.0Z-8.0R8.0
....
Similarly, when we process the R12.0 ball, we need to modify the program:
....
G03X24.0Z-12.R12.0
....
At this point, we can also see that if you change the part once, at least G03X24.0Z-12.R12.0 needs to be modified once. If macro programming is used, we can set a variable #1 to represent the radius of the ball, such as #1 =6.0 then the program can be modified to:
....
#1=6.0
G03X[2*#1]Z-#1R#1
....
When we are processing SR8.0, SR10.0, SR12.0 balls, we only need to assign the corresponding ball radius value to #1.
Well, this example is relatively simple, the purpose is to let everyone experience the use of variables. Learning is like climbing stairs. What you want may be on the 10th floor, and you need to step from the 1st floor to the 10th floor.
How to quickly climb from the "1st floor" to the "10th floor"?
Remember this sentence:
The macro program is very simple, but you don't know how to learn it temporarily! ----Zou Jun
What is the method? Brother Jun will share two points with you:
One, mentality
2. Methods
One, mentality
If you "feel" you can learn, then you can climb to the "3rd floor".
If you "think" you can learn, then you can climb to the "4th floor".
If you "believe" you can learn, then you can climb to the "8th floor".
If you "confirm" that you can learn, then you can climb to the "tenth floor".
2. Methods
Many friends who are new to macro program programming feel that macro programs are very mysterious. If they rely on their own ability or a little bit of accumulation when there is no one to guide them, it is very likely that they will be abandoned because of difficulties. It is a pity.
If someone imparts his own experience to one another, he can avoid many detours. Therefore, finding a master in this area can help you avoid detours and quickly become a master in this field.
Well, the content shared by Jun Brother is of great value, you have to understand it carefully.
Now, you start to choose the right method with firm belief, and practice it step by step. Before you know it, you will find that you have reached the "10th floor".
|