-

Accessing External Variables from G-Code Programs

Accessing External Variables from G Code Programs
  1. Data for each axis (status, position, velocity, etc.)
  2. An array of 100 for DINT type data variables
  3. An array of 100 for LREAL type data variables
  4. An array of 100 for BYTE type data variables
  5. A struct for G31 Skip Move data.
95d36c5e-8d6f-410f-a8ff-1119c38ee38d.png
d07e9131-a69b-47f2-8f8a-83ca717849ac.png
Image

This completes the variable assignment setup on the PLC side.

  1. In the sample G-code tool changer file, at the start of the file the current machine position has to be recorded to command the motion back to the same position after the tool changing sequence was complete:

    • At the start of the file the current axes positions are being read from the PLC and saving them to a set of local variables:

      535ae16a-b0e0-45d4-8cce-15f32f065750.png
    • At the end of the file, the motion back to the same positions is being commanded:

      dd80cb0c-2f08-40c0-a6da-e3b2e1aee8f1.png
  2. During the cycle, the status of various sensors has to be checked. A Spindle Loaded sensor is used in this example:

 


This is the latest version of Compass Online help and the content may refer to features not available in previously released versions of Compass.

Copyright © 2026 YASKAWA America, Inc.