I know little about macro variables but M2 is a Program End where M30 is Program End and Rewind back to the beginning of the program.
On my 0i Mate TC both are apparently same, causing program end as well as RESET which clears all the local and common variables. I thought M02 will not clear the variables, but it does clear.
Then what is the difference between M02 and M30?
Is it MTB dependent?
Thanks in advance for your kind help.
I know little about macro variables but M2 is a Program End where M30 is Program End and Rewind back to the beginning of the program.
Toby D.
"Imagination and Memory are but one thing, but for divers considerations have divers names"
Schwarzwald
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
www.refractotech.com
I also heard the same. But on my machine M02 also causes rewind. I am not able to figure out any difference between M02 and M30.
What kind of control are you using? There might be a parameter setting that will not allow rewind of the program when using M2. This could also be built into the ladder by the MTB that it sees the rewind when executing a M2.
I am not 100% but I have never come across a Fanuc control that did not clear the local variables (#1-#33) when program end or reset was used. Now if your common variables (#100-#199) there should be a setting for so they do not clear at program end or reset, they will however clear to null at power down. Variables #500-#999 should never clear until they are programmed to clear or you change them via MDI.
Stevo
You might want to check #3404 bit 5. On the 0iTC, this parameter controls whether M02 searches for the head of the program.
I referred to the parameter manual of 0i C.
As per the given information (and as I have interpreted it), M30 and M02 can be made to behave differently or in the same manner. The difference is of REWIND.
Parameter 3404#4 = 1 rewinds after M30.
Parameter 3404#5 = 1 rewinds after M02.
So, both cause system reset, but rewind depends on the respective parameter settings.
Incidently, if you set 6001#7 = 1, local variables are not cleared by reset.
Similarly, if you set 6001#6 = 1, common variables are not cleared by reset.
This, however, may not be considered a safe programming practice, because everybody believes that local and common variables start with null values. This also means that a variable should preferably be made null, before using it. Otherwise, be prepared for surprises, at least occasionally.
I have not worked on an Oi control before so this is the first that I have seen a parameter setting to allow or disallow the clearing of the local variables. I have seen the option for the common variables but only for power down not for program end or reset button. There is no setting for the permanent common variables (unless on newer controls). I have never assumed that local variables #100-#199 are cleared to null when starting. I only believed this if a power cycle was preformed.
I agree that I would not want to leave data in the local variables. I would not care either way if the common variables #100-#199 cleared at program end. I use my locals for things like number or holes or bolt circles etc. Then use the common for calculations and cutting parameters. Onto the permanent common variables for clearance planes, crash protection, tool data etc. So the commons don’t make much difference to me.
I am curious as to why there would be a parameter setting to allow M2 to act like M30. If you wanted the program to rewind then use M30 if not use M2. Does anyone have a scenario where you would want this setting? Is this something so postprocessors don’t need to be changed?
Good info to know.
Stevo
Some MTB use M30 to "Auto POWER OFF". And they work with to M30 or M02 in ladder program to RESET (G8.6 and G8.7). Some MTB´s use the same to reset the program. (variables and rewind)
Daniel
The difference between M30 and M02 dates back to the old days of paper tape readers. M02 is a "Program end" and that output signal is usually wired to the remote reset input signal (ERS). An M02 reset is just going to stop the program. The M30 output was tied to the "reset-rewind" input signal (RRW) which not only resets the CNC, but also sends a "rewind" command to the paper tape reader. The tape reader is supposed to wind the tape backwards until it gets to the "rewind stop" or percent sign, and while the tape is rewinding, the control is inhibited from cycle starting again. On the older controls with tape readers that have reels, you will see that the tape reader will run in reverse after an M30 only if you are in TAPE mode. In MEMORY mode, the tape reader does nothing at all, but the memory resets to the begining. On the old controls with tape readers, we used to make two kinds of tapes. Very long tapes went on the reels, and ended in an M30. Shorter tapes we just spliced into a loop-tape. Those tapes ended with an M02 so that the tape reader would not try to rewind. We used loop tapes when possible because we could cycle start almost immediately after the program finished instead of waiting for the tape to rewinds.
Since tape readers are passe nowadays, there is no practical difference between the ERS (reset) input and the RRW (Reset-rewind) input. They both stop the control, reset any variables, and set the program back to the beginning. There are parameters that determine whether or not many of the modal G-codes are set back to their power-up (Clear) states when a Reset is performed.
I'm starting to feel like a CNC historian.
Toby D.
"Imagination and Memory are but one thing, but for divers considerations have divers names"
Schwarzwald
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
www.refractotech.com
I find it fascinating how the archaic terminology is still active; M30 program stop and rewind.
You make a good CNC historian and I find it very interesting. I almost got involved in CNC in 1979 but the company I was working for went bankrupt. My next exposure to CNC was in 1999 and there were lot of changes; your 'history' gives interesting background.
An open mind is a virtue...so long as all the common sense has not leaked out.
Toby D.
"Imagination and Memory are but one thing, but for divers considerations have divers names"
Schwarzwald
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
www.refractotech.com