M66 IF Request in Subroutine
21 Nov 2023 20:44 #286194
by CNC_ANDI
M66 IF Request in Subroutine was created by CNC_ANDI
Hello, I'm currently trying to do security queries in the subrotines. This is mainly about the M66 query. So I'm trying to make 2 M66 queries in a subrotine that I want to query with an If statement. The first m66 query with if statement always works but with the second m66 query with if statement it fails because it doesn't write the value to the var
How can i do that?
M64 P07 ; open Drawbar
M66 P31 L3 Q1 ; wait for drawbar open
O104 if [#5399 LT 0]
(abort, failed to open drawbar)
O104 endif
G1 G53 F2500 Z-100
M65 P07
G4 P0.5
M66 P29 L3 Q1 ; check for tool
O105 if [#5399 LT 0]
(abort, failed tool not clamped)
O105 endif
G0 G53 Z0
How can i do that?
M64 P07 ; open Drawbar
M66 P31 L3 Q1 ; wait for drawbar open
O104 if [#5399 LT 0]
(abort, failed to open drawbar)
O104 endif
G1 G53 F2500 Z-100
M65 P07
G4 P0.5
M66 P29 L3 Q1 ; check for tool
O105 if [#5399 LT 0]
(abort, failed tool not clamped)
O105 endif
G0 G53 Z0
Please Log in or Create an account to join the conversation.
22 Nov 2023 22:54 #286281
by rmu
Replied by rmu on topic M66 IF Request in Subroutine
That looks correct. Are you sure your signal routing is correct?
Please Log in or Create an account to join the conversation.
23 Nov 2023 06:14 - 23 Nov 2023 06:25 #286303
by CNC_ANDI
Replied by CNC_ANDI on topic M66 IF Request in Subroutine
Yes for sure. When i check this two if statements selfly than it works
I will try a return[] next time.
I will try a return[] next time.
Last edit: 23 Nov 2023 06:25 by CNC_ANDI.
Please Log in or Create an account to join the conversation.
23 Nov 2023 08:32 #286308
by rmu
Replied by rmu on topic M66 IF Request in Subroutine
This is how I do it and contrary to some comments in another thread this code actually works.
github.com/rmu75/rover-342-retrofit/blob...ines/rack_change.ngc
github.com/rmu75/rover-342-retrofit/blob...ines/rack_change.ngc
Please Log in or Create an account to join the conversation.
23 Nov 2023 15:28 #286331
by CNC_ANDI
Replied by CNC_ANDI on topic M66 IF Request in Subroutine
i have tried this too
O104 if [#5399 LT 0]
M65 P07
(abort, failed to open drawbar)
O104 endif
dont work
O104 if [#5399 LT 0]
M65 P07
(abort, failed to open drawbar)
O104 endif
dont work
Please Log in or Create an account to join the conversation.
23 Nov 2023 16:07 #286338
by rmu
Replied by rmu on topic M66 IF Request in Subroutine
try single-stepping the file and keep halshow open.
Please Log in or Create an account to join the conversation.
23 Nov 2023 16:32 #286340
by MaHa
Replied by MaHa on topic M66 IF Request in Subroutine
g4 does only prevent axes from movement, for other, there is no effect. If you need a delay and increasing timeout does not work maybe try mcode,like:
#!/bin/bash
sleep .5
exit 0
Please Log in or Create an account to join the conversation.
23 Nov 2023 17:33 #286345
by CNC_ANDI
Replied by CNC_ANDI on topic M66 IF Request in Subroutine
My G4 P0.5 Works correct... the problem is the second if statement
Please Log in or Create an account to join the conversation.
23 Nov 2023 18:21 #286353
by rmu
Replied by rmu on topic M66 IF Request in Subroutine
so you say if you enter those commands in MDI it works but executing in one file it doesn't?
Please Log in or Create an account to join the conversation.
23 Nov 2023 19:15 - 23 Nov 2023 19:18 #286359
by CNC_ANDI
Replied by CNC_ANDI on topic M66 IF Request in Subroutine
M66 P31 L3 Q1 ; check for drawbar
O104 if [#5399 LT 0]
(abort, failed drawbar not open)
O104 endif
M66 P29 L3 Q1 ; check for tool
O105 if [#5399 LT 0]
(abort, failed tool not clamped)
O105 endif
does not work. O105 dont write the parameter 5399 new
M66 P29 L3 Q1 ; check for tool
O105 if [#5399 LT 0]
(abort, failed tool not clamped)
O105 endif
In a single file it works
M66 P31 L3 Q1 ; check for drawbar
O104 if [#5399 LT 0]
(abort, failed drawbar not open)
O104 endif
In a single file it works
O104 if [#5399 LT 0]
(abort, failed drawbar not open)
O104 endif
M66 P29 L3 Q1 ; check for tool
O105 if [#5399 LT 0]
(abort, failed tool not clamped)
O105 endif
does not work. O105 dont write the parameter 5399 new
M66 P29 L3 Q1 ; check for tool
O105 if [#5399 LT 0]
(abort, failed tool not clamped)
O105 endif
In a single file it works
M66 P31 L3 Q1 ; check for drawbar
O104 if [#5399 LT 0]
(abort, failed drawbar not open)
O104 endif
In a single file it works
Last edit: 23 Nov 2023 19:18 by CNC_ANDI.
Please Log in or Create an account to join the conversation.
Time to create page: 0.155 seconds