In our production process, every time we finish processing a workpiece, the system will automatically accumulate a number of pieces, which is convenient for us to plan production, but the plan is not as fast as the change, and sometimes some other workpieces are inserted, so that our previous counting is not To be accurate, some CNC systems can be reset directly, so that we can easily set the number of pieces through a few steps.
However, some systems can only be cleared and cannot be reset. If we have to set the number of pieces, the most stupid way is to edit a m30 block, and then repeatedly press the cycle start key until the number we need is reached. This is a bit too troublesome, the efficiency is also very low, and it will shorten the service life of the keys. Today, I will share with you a method of setting the number of processed pieces with a macro program.
You can use B macro if you support B macro, and you can use A macro if you don't support B macro. Both methods are fine. Note that the number of pieces is cleared before running the program. Then press the reset button (this is very important). Also, when running, choose to start execution from the N1 section (this is also very important, otherwise the program will not run normally)
Let me talk about B macro
O0001 (program number)
IF[#1EQ#2]GOTO3
GOTO2
N1 #1=0 (initial piece count, program start line)
#2=345 (The number of pieces that 345 needs to reach, this is set according to the actual situation)
#2=#2-1
N2 #1=#1+1
M99
N3
M30 (End of program)
Let's talk about A macro
O0002 (program number)
G65 H81 P3 Q#1 R#2
G65 H80 P2
N1
G65 H01 P#1 Q0 (Initial piece count, program start line)
G65 H01 P#2 Q345 (345 is the number of pieces to be set, this is set according to the actual situation)
G65 H03 P#2 Q#2 R1
N2 G65 H02 P#1 Q#1 R1
M99
N3
M30 (End of program)
Tips: The system that supports B macro can also directly use the system variable 3901 to quickly set the number of pieces
|