Enter Your Email Address Here

Programing standards for Variables

Now that we have defined functionality, we need to set some standards with regards to the macro programming. The first thing to consider is the variable table. You have four (4) types of variables:

Local Variables: These variables are local to the program. Normally used to transfer values to a cycle call, or as intermediate mathematical value holders. I hate using local variables because of one major issue with them. They are reset to null (not 0) when the control is reset or the program ends. While perfectly fine for use in transferring variables to canned cycles, etc. They can get you in trouble if you use them for other things. I, just by policy, never use them for anything. In Fanucese, these are typically #100-#499 (if you have that many available). Local variables are only available to the program in which they are used.

Global Variables: These variables, once set, remain set unless you change or reset them via macro or the control keyboard. Unlike local variables, global variables are available to any program in the control. I use gobal variables because they are retained, can be used in any program, and you can track what's going on if you have an issue. In Fanucese, these are typically #500-#999

System Variables: These variables are available to use in macro programming and allow you to write and retrieve information from the control itself, such as tool in the spindle, tool offset active, write and read offsets, check active codes, etc. Very handy indeed, BUT, these are _NOT_ standardized to a great extent. You will have to consult the macro programming portion of your control manuals to determine what these are.

String Variables: String variables are a group of characters interpreted as a single value. Typically defined with a $ symbol. String variables allow you to manipulate text and phrases etc. Not all controls support string functions.

I typically define my variable fields along the following lines:
#500-599 : Input variables to the macro
#600-799 : Mathmatical functions of the macro
#800-899 : Variables needed with regard to tooling, offsets and system variables.
#900-999 : Logic keep bits, counters, etc

Followers

Face book

Twitter Delicious Facebook Digg Stumbleupon Favorites More