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).
#1 – #33 are automatically
reset to zero when executing M99, regardless of where they were set.#100+, #500+) are not affected by this parameter.#1 – #33 are initialized
with their current values (or zeros if it’s the first run).M99, the controller checks the state of Bit 7 in #6001:
1 — all #1 – #33 are reset to 0.0 — values are retained for use after the return.; Bit7 = 1 (clear)
O1000
#1 = 50
M99
; After return #1 = 0
; Bit7 = 0 (retain)
O1000
#1 = 50
M99
; After return #1 = 50
Bit 7 of parameter #6001
in the System Parameters section to clearly see the difference
in variable behavior after M99.