M66 not waiting on input

More
30 Apr 2021 23:21 #207509 by rogerxue
Hi I want the spindle to wait before it confirms the tool is in the spindle

but the M66 seems does not wait at all, and I checked the pin does change based on whether the tool is in the spindle or not.

The HAL is
# --- spindle tool signal ---
net spindle-tool-secured and2.10.in0 motion.digital-in-00 <= hm2_5i25.0.7i76.0.0.input-24
net spindle-tool-open motion.digital-in-01 <= hm2_5i25.0.7i76.0.0.input-25

The ini :
# ===============
# rack tool changer
[TC]
# this is not named TOOL_CHANGE_POSITION on purpose - canon uses it and will
# interfere

X = 3.0
Y = 3.0
Z = -5.0

X_CLEAR_DELTA = 5.0
Y_CLEAR_DELTA = 0.0
Z_CLEAR = 0.0

#tool slot delta
X_DELTA = 0.0
Y_DELTA = 3.0
Z_DELTA = 0.0

RELEASE_DELAY = 0.5
CAPTURE_DELAY = 1.0
SIGNAL_DELAY = 0.5
TOOL_CONFIRM_DELAY = 20

# motion.digital-out-NN pins power draw bar
PDB = 0
TOOL_IN_SPINDLE = 0
DB_RELEASED = 1

the sub:
; parameter: current tool
o<get_tool> sub  
G90
; value of this pin read is stored in #5399
M66 P#<_ini[TC]TOOL_IN_SPINDLE> L0
o100 if [EXISTS[#<_ini[TC]X>] AND [#5399 EQ 0]]
     g53 g0 Z #<_ini[TC]Z_CLEAR>
     g53 g0 X [#<_ini[TC]X> + #1 * #<_ini[TC]X_DELTA>] Y [#<_ini[TC]Y> + #1 * #<_ini[TC]Y_DELTA>]
     
     ;release tool and confirm
     M64 P#<_ini[TC]PDB> 
     M66 P#<_ini[TC]DB_RELEASED> L3 Q#<_ini[TC]TOOL_CONFIRM_DELAY> 
     M66 P#<_ini[TC]TOOL_IN_SPINDLE> L4 Q#<_ini[TC]TOOL_CONFIRM_DELAY> 
     G4 P#<_ini[TC]SIGNAL_DELAY> 
     
     g53 g0 Z [#<_ini[TC]Z> + #1 * #<_ini[TC]Z_DELTA>]
     
     ;capture tool and wait for confirmation
     M65 P #<_ini[TC]PDB> 
     M66 P#<_ini[TC]DB_RELEASED> L4 Q#<_ini[TC]TOOL_CONFIRM_DELAY> 
     M66 P#<_ini[TC]TOOL_IN_SPINDLE> L3 Q#<_ini[TC]TOOL_CONFIRM_DELAY> 
     G4 P #<_ini[TC]SIGNAL_DELAY> 
     
     g53 g0 X [#<_ini[TC]X> + #1 * #<_ini[TC]X_DELTA> + #<_ini[TC]X_CLEAR_DELTA>]
     g53 g0 Y [#<_ini[TC]Y> + #1 * #<_ini[TC]Y_DELTA> + #<_ini[TC]Y_CLEAR_DELTA>]
     g53 g0 Z #<_ini[TC]Z_CLEAR>

o100 endif
o<get_tool> endsub  

m2

Please Log in or Create an account to join the conversation.

More
01 May 2021 22:14 #207583 by andypugh
Replied by andypugh on topic M66 not waiting on input
Try adding (DEBUG, delay is #<_ini[TC]TOOL_CONFIRM_DELAY> ) to the G-code to check that the delay is being read as a nonzero value.

Are you absolutely sure that the digital input isn't already high when the code runs?

Please Log in or Create an account to join the conversation.

More
01 May 2021 22:18 #207584 by rogerxue
Replied by rogerxue on topic M66 not waiting on input
I monitored the digital input and did oscilloscope on it, it was never high.

I'll try debug on Monday

thanks for the help

Please Log in or Create an account to join the conversation.

More
05 May 2021 00:57 #207919 by rogerxue
Replied by rogerxue on topic M66 not waiting on input
It turns out the signal is very bouncy, afterI added a debounce of 300, it worked

Please Log in or Create an account to join the conversation.

Time to create page: 0.239 seconds
Powered by Kunena Forum