Macro is to use the formula to process parts, such as ellipse, if there is no macro, we have to calculate the points on the curve point by point, and then slowly use a straight line to approximate, if it is a workpiece with high smoothness requirements, then it needs to calculate a lot Point, but after applying the macro, we enter the ellipse formula into the system and then we give the Z coordinate and add 10um each time, then the macro will automatically calculate the X coordinate and cut, in fact, the main function of the macro in the program is Operational effect.
The role of macro programs
Users can use variables to perform arithmetic operations, logical operations and mixed operations of functions. In addition, the macro program also provides loop statements, branch statements and subroutine call statements, which is conducive to the preparation of various complex part processing programs and reduces or eliminates the tediousness of manual programming. Numerical calculation, and streamlining the program.
Macro program instructions are suitable for parabolic, elliptical, hyperbolic and other curve programming without interpolation instructions; suitable for programming of series parts with the same process path, but different position parameters; suitable for programming of series parts with the same graphics, but different sizes. Simplify programming greatly; expand the scope of application.
A type of macro reference:
Type A macros are entered in G65 Hxx P#xx Q#xx R#xx or G65 Hxx P#xx Qxx Rxx format, xx means numeric value, and is entered in um level, for example, if you enter 100, it is 0.1 MM.#xx is the variable number, and the variable number is to substitute the value into a fixed address. The fixed address is the variable. Generally, there are #0~#100~#149~#500~#531 in the OTD system. When the power is turned off Variables #100~#149 are initialized to "empty", while variables #500~#531 hold data.
Next, let’s talk about the H code. You can see that #xx and xx are numeric values in the standard format of class A macros, and G65 indicates the use of class A macros, then this H is to represent the values or various values in each value and variable number. What kind of operation should be performed between the value in the variable number and the value in the other variable number, it can be said that you can basically apply it after you understand the H code A type macro program.
Talk about the meaning of the H code:
The following uses #100 and #101 and #102, and the values 10 and 20 as examples, do not use them as formats when applying,
Basic instructions
H01 assignment; Format: G65H01P#101Q#102: Assign the value in #102 to #101
G65H01P#101Q#10: Assign #10 to #101
H02 plus instruction; format G65 H02 P#101 Q#102 R#103, add the value of #102 plus the value of #103 to #101
G65 H02 P#101 Q#102 R10
G65 H02 P#101 Q10 R#103
G65 H02 P#101 Q10 R20
The above four are all in the format of the add instruction are the value after Q or the value in the variable number plus the number after R
The value in the value or variable number is then equal to the variable number after P.
H03 subtraction instruction; format G65 H03 P#101 Q#102 R#103, the value of #102 minus the value of #103 is assigned to #101
G65 H03 P#101 Q#102 R10
G65 H03 P#101 Q10 R#103
G65 H03 P#101 Q20 R10
The above four are all the format of the subtraction instruction are the value after Q or the value in the variable number minus the number after R
The value in the value or variable number is then equal to the variable number after P.
H04 multiply command; format G65 H04 P#101 Q#102 R#103, multiply the value of #102 by the value of #103 to #101
G65 H04 P#101 Q#102 R10
G65 H04 P#101 Q10 R#103
G65 H04 P#101 Q20 R10
The above four are all the format of the multiply instruction are multiplied by the value after Q or the value in the variable number by the number after R
The value in the value or variable number is then equal to the variable number after P.
H05 division command; format G65 H05P#101 Q#102 R#103, divide the value of #102 by the value of #103 to #101
G65 H05 P#101 Q#102 R10
G65 H05 P#101 Q10 R#103
G65 H05 P#101 Q20 R10
The above 4 are all division instructions. The format is to divide the value after Q or the value in the variable number by the number after R.
The value in the value or variable number is then equal to the variable number after P. (The remainder is not saved, if the divisor is 0, 112 alarm will appear)
Trigonometric function instructions
H31 SIN positive Xuan function instruction: format G65 H31 P#101 Q#102 R#103; meaning #102 behind Q is the bevel of triangle and #103 behind R is the angle of memory. The result is #101=#102*SIN #103, which means that you can use this directly to find another triangle
One side length. Just like the previous instructions, you can write values directly after Q and R.
H32 COS Yuxuan function instruction: format G65 H32 P#101 Q#102 R#103; meaning #102 behind Q is the hypotenuse of triangle
The #103 memory behind R is the angle. The result is #101=#102*COS#103, which means that you can directly use this to find the triangle
Another side length. Just like the previous instructions, you can also write values directly after Q and R.
H33 and H34 should have been TAN and ATAN, but the number I used was not accurate, I hope someone who knows can tell me why?
Conditional transfer instruction
H81, H82, H83, H84, H85, H86, which are equal to the transferred H81; not equal to the transferred H82; less than the transferred H83; greater than the transferred H84; less than or equal to the transferred H85; greater than or equal to the transferred H86;
Format: G65 H8x P10 Q#101 R#102; compare the value in #101 with the value in #102, and bring it into H8x according to the code of H8x above, if the conditions are met, skip to the 10th program segment, If it does not match, continue to execute the following block.
Unconditional transfer instruction
H80; Format: G65 H80 P10; Jump directly to the 10th block
Square root instruction
H21; format G65 H21 P#101 Q#102; means that the value in #102 is square rooted and stored in #101.
|