File: m70m72-demo.ngc

package info (click to toggle)
linuxcnc 1%3A2.9.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 285,604 kB
  • sloc: python: 202,568; ansic: 109,036; cpp: 99,239; tcl: 16,054; xml: 10,631; sh: 10,303; makefile: 1,255; javascript: 138; sql: 72; asm: 15
file content (41 lines) | stat: -rw-r--r-- 778 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
; Demonstrate saving and explicitly restoring the global state around
; a subroutine call using  M70 - save state and M72 - restore state
;
; note that the subroutine itself is not aware of the M7x features

O<showstate> sub
(DEBUG, imperial=#<_imperial> absolute=#<_absolute> feed=#<_feed> rpm=#<_rpm>)
O<showstate> endsub

O<imperialsub> sub
;
g20 (imperial)
g91 (relative mode)
F5 (low feed)
S300 (low rpm)
;
(debug, in subroutine, state now:)
o<showstate> call
;
O<imperialsub> endsub


; main program
g21 (metric)
g90 (absolute)
f200 (fast speed)
S2500 (high rpm)
;
(debug, in main, state now:)
o<showstate> call
;;
M70 (save caller state in at global level)
;
O<imperialsub> call
;
M72 (explicitly restore state)
;
(debug, back in main, state now:)
o<showstate> call
;
m2