按规划持续工作

This commit is contained in:
2026-06-09 06:13:28 +08:00
parent 902c6ecaea
commit 2658ee3b72
255 changed files with 12487 additions and 150 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
; recursive function example
; factorial
o<factorial> sub
o<factorialif> if [[#1] EQ 0]
o<factorial> return [1]
o<factorialif> else
o<factorial> call [[#1] - 1]
o<factorial> return [#<_value> * #1]
o<factorialif> endif
o<factorial> endsub
m2

View File

@@ -0,0 +1,12 @@
; drill a bolt hole circle for 6 bolts at diameter 3 inches
G20 G17 G90
; position over first hole, establishing our radius of 1.5
; an equivalent command would be G0 @1.5 ^0 Z0
G0 X1.5 Y0 Z0
; drill six holes, incrementing 60 degrees each time
G91 G81 R.1 Z-.5 ^60 L6 F10
M2

View File

@@ -0,0 +1,88 @@
; This demonstrates doing an M6 remapped to a named oword sub
;
; to activate, incantate as follows in the INI file:
;
; [RS274NGC]
; # remap M6 to a named oword subroutine.
; M6_COMMAND=o<m6demo>call
;
; parameter #1: the current tool-in-spindle
; parameter #2: the tool number requested in the last T (prepare) command
; parameter #3: pocket of new tool
;
;
;
O<m6demo> sub
;
(DEBUG, executing M6 O-word sub, tool-in-spindle=#1 prepared=#2 pocket=#3)
;
M66 P2 L0
;(debug, digital-input-02=#5399)
#<tool_change_with_spindle_on> = 0
#<tool_change_quill_up> = 0
#<tool_change_at_g30> = 0
; number of seconds to wait for 'tool-changed' equivalent
#<timeout> = 9999
;
O<m6demo_spindle_off> if [#<tool_change_with_spindle_on> EQ 0]
M5
O<m6demo_spindle_off> endif
O<m6demo_quill_up> if [#<tool_change_quill_up> NE 0]
G0 G53 Z0
O<m6demo_quill_up> endif
O<m6demo_tc_at_g30> if [#<tool_change_at_g30> NE 0]
G30
O<m6demo_tc_at_g30> endif
; set analog output pin #2 to signal the pocket number
; iocontrol.tool-number becomes motion.analog-out-02
M68 E2 Q[#2]
;(DEBUG, set current tool number on motion.analog-out-02: #2)
;
; assert the equivalent of the iocontrol.tool-change pin
; which is now motion.digital-out-01
M64 P1
;(DEBUG, motion.digital-out-01 set high, waiting for motion.digital-in-01)
; wait for the equivalent of the iocontrol.tool-changed pin to go high
; we use motion.digital-in-01
;
M66 P1 L3 Q#<timeout>
;
; if we waited too long, fail change and abort.
;
O<m6demo_timeout> if [#5399 EQ -1]
(DEBUG, timeout waiting for digital-in-01 to become true - failing change )
O<m6demo> return [-1]
O<m6demo_timeout> endif
; retract iocontrol.tool-change equivalent
;(DEBUG, deasserting motion.digital-out-01)
M65 P1
;
; test fail-change line from gladevcp
M66 P2 L0
; (debug, digital-input-02=#5399)
O<m6demo_change_fail> if [#5399 EQ 1]
(DEBUG, returning -1 to fail change)
O<m6demo> return [-1]
O<m6demo_change_fail> else
(debug, change ok, returning +1 to commit change)
; a positive return value commits the tool change
O<m6demo> return [1]
O<m6demo_change_fail> endif
;
; return a positive value commit the change.
; a negative return value will fail the change and
; abort the interpreter with a message like
; "M6 failed (<return value>)"
;
O<m6demo> endsub
m2