User Tools

Site Tools


Table of Contents

Macro Language

  • # - All variables in Macro language started from # symbol and have number (address) in range 0…16000. However variables address higher than 1000 are considered as System Global Variables. It's possible to read an write to Global Variables but User should understand this may change system behavior. Variables in range 1…999 are User space variables. This variables are not changer by CNC control, modifying this variables does not affect system work
  • = - Symbol = is ued to assign value to Variable
  • Operators
    • + addition
    • - subtraction
    • * multiplication
    • / division
    • % modulo
  • Logic operators
    • GT - greater than
    • GE - greater or equal than
    • LT - less than
    • LE - less or equal than
  • [] - Square brackets are used to change operation priority (instead of round brackets which are used in g-code language as Comment).

Repeat Test

G10 L80 P5521 Q1 (Disable Software Limits)
G10 L80 P5525 Q1 (Disable Hardware Limits)
#10=1 (Initialize register value)
M88 L1 P14(Soft stop when sensor triggered)
G91 G0 Y   10.6 F   600.00 (Move to sensor)
G04 P0.2 (Pause)
M220 (Check coordinate, print it)
G90 G0 Y   -10.0000 F   600.00
#10=#10+1 (Increment register)
if [ #10 LT 100 ] 20 (Repeat 100 times)

PLC procedure to print current “Y” position to message widget

  y=gvarget(5022); (Read machine current Y position)
  gvarset(20001,y); (Print position in myCNC Message widget)
  if (y>3000) (If Position more that 3000 pulses)
   message=PLCCMD_MOTION_BREAK;	//(Stop running)
mycnc/macro_language.txt · Last modified: 2018/04/23 14:57 by skirillov