Variables in Parametric Programming
Local variables are "local" to the program that is currently executing. They can be set and read only in that program. As soon as control is passed to another program, such as when a subprogram is called, that program has its own set of local variables which can be set, read, etc. When control passes back to the original program, its set of local variables is restored. For instance, if you set variable #1 to 100 in the main program, then call a subprogram, var #1 is now empty. You can set and use var #1 in the sub without overwriting the value of #1 in the main. When you return to the main program, var #1 retains its original value of 100. This is useful because you can use local variables at will within subprograms without having to keep track of the local variables you are using in other programs for fear of overwriting them. If you watch the macro variable screen as programs execute, you can see the local variable sets change as control is passed from one program to another. You can pass a value to a local variable when calling a subprogram with the G65 command.
Common variables are "common" to all programs. Set the variable in one program and *all* of the other programs see the same value. They are retained even after program execution stops. They can be set within a program or by the operator on the macro variable screen. You can even create screen labels for some of them to make it easier for operators to set values. One of the things that we use them for is when we have a choice of profiles on a part. The operator can set variable 500, which may have a screen label of "PROFILE#", to the desired profile number and then the program uses this to select the correct tool, spindle, cutter comp and height offset.
System variables are special variables that represent values in various registers of the control. For instance, when you call H14, you are referring to offset register 14. The value of offset register 14 can be read or set by accessing system variable #2014. Some system variables are read only and cannot be set. There are system variables for reading the absolute X, Y, or Z position of the machine (read only). We sometimes use this set of variables to read the machine position if we need to come back to that exact same point after a series of calculated moves which may have introduced rounding errors when executed.
All of this should be in your operator manual. If you don't have one, get one! The book is not always clear in its descriptions, so write a lot of little test programs until it is clear just how things work. Always start out simple and work up to the complicated stuff.
From the original questioner:
Thanks for the information. That explained a lot. I do have the manual, but couldn't find an area that explained it to me. I now understand that the offset screen where I can alter numbers for height and depth offsets are actually variables under different numbers. Part of the problem is that I have never seen the macro variable screen you speak of. I will have to try and access that.
Are you sure that the Macros option is installed on your control? If you have the Macro option, you should have a screen somewhere to view variables.
The comments below were added after this Forum discussion was archived as a Knowledge Base article (add your comment).
Comment from contributor A:
Would you like to add information to this article?
Interested in writing or submitting an article?
Have a question about this article?
Have you reviewed the related Knowledge Base areas below?