summaryrefslogtreecommitdiff
path: root/nc_files/m70m72-demo.ngc
blob: 678e34c8a0b559c216d37cd835999622ae5b5228 (plain)
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 explicitely 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 (explicitely restore state)
;
(debug, back in main, state now:)
o<showstate> call
;
m2