About the NCPlayer Service:
File Menu
Edit Menu
View Menu
Formatting Menu
Tools Menu
Machine Configuration Menu
Collaboration

Updating System Parameters


The Clear Locals on M99 function controls the controller’s behavior when returning from a subprogram via the M99 command — specifically, whether local variables #1 – #33 should be cleared after the return. This mode is enabled or disabled via Bit 7 of the system parameter PV_CM2 (#6001).

What the function does

  • When the bit is ON (1) — all local variables #1 – #33 are automatically reset to zero when executing M99, regardless of where they were set.
  • When the bit is OFF (0) — local variables retain their values after returning from the subprogram and can be used by the calling program.
  • Other groups of variables (#100+, #500+) are not affected by this parameter.

How it works

  1. Upon entering a subprogram, local variables #1 – #33 are initialized with their current values (or zeros if it’s the first run).
  2. During the execution of the subprogram, they can be modified.
  3. When executing M99, the controller checks the state of Bit 7 in #6001:
    • If the bit = 1 — all #1 – #33 are reset to 0.
    • If the bit = 0 — values are retained for use after the return.

Example

; Bit7 = 1 (clear)
O1000
#1 = 50
M99

; After return #1 = 0

; Bit7 = 0 (retain)
O1000
#1 = 50
M99

; After return #1 = 50

When to use

  • To isolate subprograms so their local variables do not affect the calling program.
  • To simplify debugging and prevent “leakage” of values between subprograms.
  • When it’s important to retain variables between subprograms — turn this bit OFF.
Tip: In NCPlayer, you can test changing Bit 7 of parameter #6001 in the System Parameters section to clearly see the difference in variable behavior after M99.
CNCPassport © MEBLEOS © 2026 · Ver 1.0 · Terms & Conditions | Privacy Policy | Cookie Policy | Refund Policy Legal information | Privacy Policy