The Fanuc Custom Macro language uses a variety of what are called VARIABLES in the language. Variables can perform a variety of chores in the language, their main job is to carry and gather data for use in the macro program.
A Variable always begins with the # sign, followed by a number. For example, #100 is a variable. In it's simplest form ( without getting into specifics of how that is done ... it will be covered later ), a variable is used to carry data. An example :
First Program Line : #100 = 2.00
Second Program Line : G01 G90 X#100 F10.0
In the above example, the macro program first defines the value of the variable #100 ... that value is 2.00 as defined in the First program line. The variable #100, carrying the value of 2.00, is called or used in the Second program line. To the control, the value of the Second program line is :
G01 G90 X2.00 F10.0
Once the variable is defined ( without getting into specifics of how that is done ... it will be covered later ) anytime the control sees the variable, it replaces it with it's defined value, in this case 2.00.
To take this just a step further ... remember anytime the control sees the variable #100 it will substitute it's defined numerical value, the following line :
G01 G90 X#100 F#100
would read to the control :
G01 G90 X2.00 F2.00
As mentioned, variables have other functions as well. The types of variables available will be discussed in more detail in various posts in our series.
Types of Variables
There are basically (3) different types of variables available ... the type to utilize is dependant on how you want the data to be transmitted.
Local Variables
( # 1 thru #33 )
Local variables are primarily used for data transfer and their value remains active only within the local program. When a sub-program is executed, the value of the Local Variable does not carry over into the sub-program. The value of a Local Variable is usually set using the G65 macro call command.
Common Variables
( # 100 thru #149 and #500 thru #509 )
The main difference between Common Variables and Local Variables are that Common Variable values are retained between programs. That means that the #100 used in one program is the same in every other program or sub-program called. The value of any Common Variable, even if arrived at via a mathematical instruction, is the same value in subsequent program use.
The value of variables #100 thru #149 are cleared at power off, while those of variables #500 thru #509 are retained, even after power off. However, these conditions may be altered via Parameter Settings.
System Variables
System Variables are normally used to obtain conditions, positions or values from areas within the CNC control. Some examples of the use of System Variables :
- To record an axis position at a certain time
- To record or adjust a tool offset value
- To record or adjust a work coordinate offset setting
- To generate s user defined alarm condition
- Suppress the single block, feed hold, feedrate override functions
- Read and record modal information
No comments:
Post a Comment