G-Code Variables
NC Side G-Code Variables
These variables reside on the PC side for use in G-Code programs and macros (e.g., a tool changer)
#0 - NULL / Empty
- This is used for determining if a variable has been written to or not before
- This is especially useful for parameter passing to program calls
- See: M98 Sub Program Calls M98 Sub-Program Calls
#1 to #199 Local Variables
- These variables are local to the current function call on the call stack
- These allow a program to have guaranteed local storage of variables
#200 to #99999 Global Variables
- Available and accessible for all G-Code programs to access and use
PLC & NC Shared Variables
- Reading and writing to these variables causes lookahead buffers to be flushed
- This means that motion may come to a brief stop on reading/writing to them
- This guarantees synchronization between the NC and PLC side during execution
- If these variables are to be accessed frequently, a locally stored copy should be made in an NC variable (i.e., a Local/Global Variable), and refreshed as necessary
General Shared Variables
- Accessed via
PLC.prefix - Available variables include:
-
PLC.DINTS[0-99]- Array of 100 DINT type data variables -
PLC.LREALS[0-99]- Array of 100 LREAL type data variables -
PLC.BOOLS[0-99]- Array of 100 BOOL type data variables - Example:
#100 = PLC.DINTS[5]reads the 6 th DINT variable from the PLC - See PLC Data Structures PLC Data Structures for complete details