VMC related HAL questions.

More
6 years 10 months ago #151870 by CNCDoc
Replied by CNCDoc on topic VMC related HAL questions.

andypugh wrote: The error message you show is from here:

Code:
(MSG, Checking MagPos 02) M66 P5 L0 ; Check if mag pos is empty? o103 if [#5399 EQ 0] (abort, Tool in Magazine! 03) o103 endif (MSG, Moving arm 04)

So you see the error message because G-code digital input 5 is true.

So, why is that? Is it true?



Because there is a tool holder there. the tool change sequence is read when i load g code?

Attachment not found

Please Log in to join the conversation.

More
6 years 10 months ago #151871 by andypugh
Replied by andypugh on topic VMC related HAL questions.
Your remap may need to detect whether it is running or previewing.

linuxcnc.org/docs/2.8/html/remap/remap.h...apped-code-execution

Please Log in to join the conversation.

More
6 years 10 months ago #151892 by CNCDoc
Replied by CNCDoc on topic VMC related HAL questions.
Something like this?
Code:
o<toolchange> sub ; only unload the tool if there is a tool in the spindle ; This assumes that the carousel is already aligned correctly. ; It is important to unload the tool before shutting down the machine. ; we must execute this only in the milltask interpreter ; or preview will break, so test for '#<_task>' which is 1 for ; the milltask interpreter and 0 in the UI's O999 if [[#<_task> GT 0]] o900 IF [#<tool_in_spindle> EQ 0] (MSG, Dual orient) M19 R180 P1 M19 R0 P1 o900 ENDIF (MSG, orienting) ;M3 S1 ;slow down spindle before orient ;G4 P3 ;dwell M19 R0 ;align the spindle M66 P6 L3 Q15 ; Check if spindel is oriented? o102 if [#5399 EQ -1] (abort, Spindel not oriented 01) o102 endif o100 IF [#<tool_in_spindle> GT 0] ;If there is a tool in the spindle then unload (MSG, MovingToLowerTC-Pos 01) G53 G0 Z-109.166 (MSG, Checking MagPos 02) M66 P5 L0 ; Check if mag pos is empty? o103 if [#5399 EQ 0] (abort, Tool in Magazine! 03) o103 endif (MSG, Moving arm 04) M64 P2 ; move arm in (MSG, Waiting for arm 05) M66 P2 L3 Q5 ; wait for arm-in = true o104 if [#5399 EQ -1] (abort, failed to move arm in 06) o104 endif G4 P1 (MSG, Starting pump 07) M64 P3 ;Start Pump "release tool" G4 P1.5 (MSG, Spindle air on 08) M64 P5 ;Spindle air on (MSG, Wating for toolrelease signal 09) M66 P3 L3 Q2 ; wait for tool-released = true o105 if [#5399 EQ -1] (abort, failed to release tool 10) o105 endif (MSG, Air off 12) M65 P5 ;Turn off Spindle Air o100 ENDIF (MSG, Moving up 13) G53 G0 Z7 (MSG, Pump off 11) M65 P3 ;Turn off Pump o200 IF [#<selected_tool> GT 0] (MSG, Unlock car 14) M64 P1 ; unlock carousel (MSG, Wait for unlock 15) M66 P1 L4 Q2 ; wait for unlock "LOW signal" o106 if [#5399 EQ -1] (abort, failed to unlock carousel 16) o106 endif (MSG, starting car 17) M68 E0 Q#<selected_pocket> ; Start "hal file" set the carousel to move to the right pocket M64 P0 ; start carousel G4 P2 (MSG, waiting for car 18) M66 P0 L3 Q20 ; wait for carousel finished o107 if [#5399 EQ -1] (abort, failed to align carousel 19) o107 endif (MSG, stopping car 20) M65 P0 ;stop carousel (MSG, locking car 21) M65 P1 ;lock carousel (MSG, waiting for lock 22) ;G4 P5 M66 P1 L3 Q5 ;wait for locked=true o108 if [#5399 EQ -1] (Abort, failed to lock carousel 23) o108 endif (MSG, move arm in if not already 24) M64 P2 ; move arm in (might already be in) (MSG, waiting for arm 25) M66 P2 L3 Q5 ; wait for arm-in = true o109 if [#5399 EQ -1] (abort, failed to move arm in 26) o109 endif M64 P3 ;OpenDrawbar M66 P3 L3 Q10 ; wait for tool-released = true o112 if [#5399 EQ -1] (abort, Failed to activate drawbar! 27) o112 endif (MSG, MovingDownForAirBlast 28) G53 G0 Z-80 ;prepForAirBlast (MSG, AirBlast ON 29) M64 P5 ;Spindle air on (MSG, moving down 30) G53 G0 Z-109.166 ;pick up the tool M65 P3 ;TurnOffPump (MSG, AirBlast OFF 31) M65 P5 ;Turn off Spindle Air o200 ENDIF (MSG, Turn off Pump clamp tool 32) M65 P3 ;Turn off Pump;clamp tool (MSG, waiting for toolLocked 33) M66 P3 L4 Q5 ; wait for tool-released = false O110 if [#5399 EQ -1] (abort, failed to clamp tool 34) O110 endif M65 P4 (MSG, move arm out 35) M65 P2 ; move arm back out (MSG, waiting for arm 36) M66 P4 L3 Q20 ; wait for arm-out = true O111 if [#5399 EQ -1] (abort, failed to move arm out 37) O111 endif (MSG, Stopp spindel orient) M5 ; Stopp spindel orient o<toolchange> endsub [1] M2 O999 endif

Please Log in to join the conversation.

More
6 years 10 months ago #151897 by andypugh
Replied by andypugh on topic VMC related HAL questions.
Something like that.
Not sure about the M2, and whether it belongs in the IF.
Code:
O999 IF [#<_task> GT 0] O<toolchange> RETURN O999 ENDIF

Might be easier to keep track of and more obvious.

Please Log in to join the conversation.

More
6 years 10 months ago #151961 by CNCDoc
Replied by CNCDoc on topic VMC related HAL questions.
I have to do something wrong, it does not work
Code:
o999 IF [#<_task> GT 0] o<toolchange> RETURN o999 ENDIF o<toolchange> sub ; only unload the tool if there is a tool in the spindle ; This assumes that the carousel is already aligned correctly. ; It is important to unload the tool before shutting down the machine. o900 IF [#<tool_in_spindle> EQ 0] (MSG, Dual orient) M19 R180 P1 M19 R0 P1 o900 ENDIF (MSG, orienting) ;M3 S1 ;slow down spindle before orient ;G4 P3 ;dwell M19 R0 ;align the spindle M66 P6 L3 Q15 ; Check if spindel is oriented? o102 if [#5399 EQ -1] (abort, Spindel not oriented 000) o102 endif M64 P1 ;lock carousel (MSG, waiting for lock 22) ;G4 P5 M66 P1 L3 Q5 ;wait for locked=true o115 if [#5399 EQ -1] (Abort, failed to lock carousel 00) o115 endif o100 IF [#<tool_in_spindle> GT 0] ;If there is a tool in the spindle then unload (MSG, MovingToLowerTC-Pos 01) G53 G0 Z-112.357 (MSG, Checking MagPos 02) M66 P5 L0 ; Check if mag pos is empty? o103 if [#5399 EQ 0] (abort, Tool in Magazine! 03) o103 endif (MSG, Moving arm 04) M64 P2 ; move arm in (MSG, Waiting for arm 05) M66 P2 L3 Q5 ; wait for arm-in = true o104 if [#5399 EQ -1] (abort, failed to move arm in 06) o104 endif G4 P1 (MSG, Starting pump 07) M64 P3 ;Start Pump "release tool" G4 P1.5 (MSG, Spindle air on 08) M64 P5 ;Spindle air on (MSG, Wating for toolrelease signal 09) M66 P3 L3 Q2 ; wait for tool-released = true o105 if [#5399 EQ -1] (abort, failed to release tool 10) o105 endif (MSG, Air off 12) M65 P5 ;Turn off Spindle Air o100 ENDIF (MSG, Moving up 13) G53 G0 Z7 o200 IF [#<selected_tool> GT 0] (MSG, Unlock car 14) M65 P1 ; unlock carousel (MSG, Wait for unlock 15) M66 P1 L4 Q2 ; wait for unlock "LOW signal" o106 if [#5399 EQ -1] (abort, failed to unlock carousel 16) o106 endif (MSG, starting car 17) M68 E0 Q#<selected_pocket> ; Start "hal file" set the carousel to move to the right pocket M64 P0 ; start carousel G4 P2 (MSG, waiting for car 18) M66 P0 L3 Q20 ; wait for carousel finished o107 if [#5399 EQ -1] (abort, failed to align carousel 19) o107 endif (MSG, stopping car 20) M65 P0 ;stop carousel (MSG, locking car 21) M64 P1 ;lock carousel (MSG, waiting for lock 22) ;G4 P5 M66 P1 L3 Q5 ;wait for locked=true o108 if [#5399 EQ -1] (Abort, failed to lock carousel 23) o108 endif (MSG, move arm in if not already 24) M64 P2 ; move arm in (might already be in) (MSG, waiting for arm 25) M66 P2 L3 Q5 ; wait for arm-in = true o109 if [#5399 EQ -1] (abort, failed to move arm in 26) o109 endif M64 P3 ;OpenDrawbar M66 P3 L3 Q10 ; wait for tool-released = true o112 if [#5399 EQ -1] (abort, Failed to activate drawbar! 27) o112 endif (MSG, MovingDownForAirBlast 28) G53 G0 Z-80 ;prepForAirBlast (MSG, AirBlast ON 29) M64 P5 ;Spindle air on (MSG, moving down 30) G53 G0 Z-112.357 ;pick up the tool M65 P3 ;TurnOffPump (MSG, AirBlast OFF 31) M65 P5 ;Turn off Spindle Air o200 ENDIF (MSG, Turn off Pump clamp tool 32) M65 P3 ;Turn off Pump;clamp tool (MSG, waiting for toolLocked 33) M66 P3 L4 Q5 ; wait for tool-released = false O110 if [#5399 EQ -1] (abort, failed to clamp tool 34) O110 endif M65 P4 (MSG, move arm out 35) M65 P2 ; move arm back out (MSG, waiting for arm 36) M66 P4 L3 Q20 ; wait for arm-out = true O111 if [#5399 EQ -1] (abort, failed to move arm out 37) O111 endif (MSG, Stopp spindel orient 38) M5 ; Stopp spindel orient M65 P1 ; unlock carousel (MSG, Wait for unlock 39) M66 P1 L4 Q2 ; wait for unlock "LOW signal" o113 if [#5399 EQ -1] (abort, failed to unlock carousel 40) O113 endif o<toolchange> endsub [1] M2

Please Log in to join the conversation.

More
6 years 10 months ago #151965 by andypugh
Replied by andypugh on topic VMC related HAL questions.
The if/return/endif needs to be inside the o<toolchange>sub / o<toolchange> endsub tags.

Please Log in to join the conversation.

More
6 years 10 months ago #151973 by CNCDoc
Replied by CNCDoc on topic VMC related HAL questions.
Now I get the following error

Attachment not found



Code:
o<toolchange> sub O999 IF [#<_task> GT 0] o<toolchange> RETURN ; only unload the tool if there is a tool in the spindle ; This assumes that the carousel is already aligned correctly. ; It is important to unload the tool before shutting down the machine. o900 IF [#<tool_in_spindle> EQ 0] (MSG, Dual orient) M19 R180 P1 M19 R0 P1 o900 ENDIF (MSG, orienting) ;M3 S1 ;slow down spindle before orient ;G4 P3 ;dwell M19 R0 ;align the spindle M66 P6 L3 Q15 ; Check if spindel is oriented? o102 if [#5399 EQ -1] (abort, Spindel not oriented 000) o102 endif M64 P1 ;lock carousel (MSG, waiting for lock 22) ;G4 P5 M66 P1 L3 Q5 ;wait for locked=true o115 if [#5399 EQ -1] (Abort, failed to lock carousel 00) o115 endif o100 IF [#<tool_in_spindle> GT 0] ;If there is a tool in the spindle then unload (MSG, MovingToLowerTC-Pos 01) G53 G0 Z-112.357 (MSG, Checking MagPos 02) M66 P5 L0 ; Check if mag pos is empty? o103 if [#5399 EQ 0] (abort, Tool in Magazine! 03) o103 endif (MSG, Moving arm 04) M64 P2 ; move arm in (MSG, Waiting for arm 05) M66 P2 L3 Q5 ; wait for arm-in = true o104 if [#5399 EQ -1] (abort, failed to move arm in 06) o104 endif G4 P1 (MSG, Starting pump 07) M64 P3 ;Start Pump "release tool" G4 P1.5 (MSG, Spindle air on 08) M64 P5 ;Spindle air on (MSG, Wating for toolrelease signal 09) M66 P3 L3 Q2 ; wait for tool-released = true o105 if [#5399 EQ -1] (abort, failed to release tool 10) o105 endif (MSG, Air off 12) M65 P5 ;Turn off Spindle Air o100 ENDIF (MSG, Moving up 13) G53 G0 Z7 o200 IF [#<selected_tool> GT 0] (MSG, Unlock car 14) M65 P1 ; unlock carousel (MSG, Wait for unlock 15) M66 P1 L4 Q2 ; wait for unlock "LOW signal" o106 if [#5399 EQ -1] (abort, failed to unlock carousel 16) o106 endif (MSG, starting car 17) M68 E0 Q#<selected_pocket> ; Start "hal file" set the carousel to move to the right pocket M64 P0 ; start carousel G4 P2 (MSG, waiting for car 18) M66 P0 L3 Q20 ; wait for carousel finished o107 if [#5399 EQ -1] (abort, failed to align carousel 19) o107 endif (MSG, stopping car 20) M65 P0 ;stop carousel (MSG, locking car 21) M64 P1 ;lock carousel (MSG, waiting for lock 22) ;G4 P5 M66 P1 L3 Q5 ;wait for locked=true o108 if [#5399 EQ -1] (Abort, failed to lock carousel 23) o108 endif (MSG, move arm in if not already 24) M64 P2 ; move arm in (might already be in) (MSG, waiting for arm 25) M66 P2 L3 Q5 ; wait for arm-in = true o109 if [#5399 EQ -1] (abort, failed to move arm in 26) o109 endif M64 P3 ;OpenDrawbar M66 P3 L3 Q10 ; wait for tool-released = true o112 if [#5399 EQ -1] (abort, Failed to activate drawbar! 27) o112 endif (MSG, MovingDownForAirBlast 28) G53 G0 Z-80 ;prepForAirBlast (MSG, AirBlast ON 29) M64 P5 ;Spindle air on (MSG, moving down 30) G53 G0 Z-112.357 ;pick up the tool M65 P3 ;TurnOffPump (MSG, AirBlast OFF 31) M65 P5 ;Turn off Spindle Air o200 ENDIF (MSG, Turn off Pump clamp tool 32) M65 P3 ;Turn off Pump;clamp tool (MSG, waiting for toolLocked 33) M66 P3 L4 Q5 ; wait for tool-released = false O110 if [#5399 EQ -1] (abort, failed to clamp tool 34) O110 endif M65 P4 (MSG, move arm out 35) M65 P2 ; move arm back out (MSG, waiting for arm 36) M66 P4 L3 Q20 ; wait for arm-out = true O111 if [#5399 EQ -1] (abort, failed to move arm out 37) O111 endif (MSG, Stopp spindel orient 38) M5 ; Stopp spindel orient M65 P1 ; unlock carousel (MSG, Wait for unlock 39) M66 P1 L4 Q2 ; wait for unlock "LOW signal" o113 if [#5399 EQ -1] (abort, failed to unlock carousel 40) O113 endif O999 ENDIF o<toolchange> endsub [1] M2

Please Log in to join the conversation.

More
6 years 10 months ago #151974 by andypugh
Replied by andypugh on topic VMC related HAL questions.
The O999 ENDIF belongs directly after the RETURN.

Please Log in to join the conversation.

More
6 years 10 months ago #151977 by CNCDoc
Replied by CNCDoc on topic VMC related HAL questions.
With this code I get the following error message when I load g-code

Attachment not found



And this one when I try to change the tool

Attachment not found



Code:
o<toolchange> sub O999 IF [#<_task> GT 0] o<toolchange> RETURN O999 ENDIF ; only unload the tool if there is a tool in the spindle ; This assumes that the carousel is already aligned correctly. ; It is important to unload the tool before shutting down the machine. o900 IF [#<tool_in_spindle> EQ 0] (MSG, Dual orient) M19 R180 P1 M19 R0 P1 o900 ENDIF (MSG, orienting) ;M3 S1 ;slow down spindle before orient ;G4 P3 ;dwell M19 R0 ;align the spindle M66 P6 L3 Q15 ; Check if spindel is oriented? o102 if [#5399 EQ -1] (abort, Spindel not oriented 000) o102 endif M64 P1 ;lock carousel (MSG, waiting for lock 22) ;G4 P5 M66 P1 L3 Q5 ;wait for locked=true o115 if [#5399 EQ -1] (Abort, failed to lock carousel 00) o115 endif o100 IF [#<tool_in_spindle> GT 0] ;If there is a tool in the spindle then unload (MSG, MovingToLowerTC-Pos 01) G53 G0 Z-112.357 (MSG, Checking MagPos 02) M66 P5 L0 ; Check if mag pos is empty? o103 if [#5399 EQ 0] (abort, Tool in Magazine! 03) o103 endif (MSG, Moving arm 04) M64 P2 ; move arm in (MSG, Waiting for arm 05) M66 P2 L3 Q5 ; wait for arm-in = true o104 if [#5399 EQ -1] (abort, failed to move arm in 06) o104 endif G4 P1 (MSG, Starting pump 07) M64 P3 ;Start Pump "release tool" G4 P1.5 (MSG, Spindle air on 08) M64 P5 ;Spindle air on (MSG, Wating for toolrelease signal 09) M66 P3 L3 Q2 ; wait for tool-released = true o105 if [#5399 EQ -1] (abort, failed to release tool 10) o105 endif (MSG, Air off 12) M65 P5 ;Turn off Spindle Air o100 ENDIF (MSG, Moving up 13) G53 G0 Z7 o200 IF [#<selected_tool> GT 0] (MSG, Unlock car 14) M65 P1 ; unlock carousel (MSG, Wait for unlock 15) M66 P1 L4 Q2 ; wait for unlock "LOW signal" o106 if [#5399 EQ -1] (abort, failed to unlock carousel 16) o106 endif (MSG, starting car 17) M68 E0 Q#<selected_pocket> ; Start "hal file" set the carousel to move to the right pocket M64 P0 ; start carousel G4 P2 (MSG, waiting for car 18) M66 P0 L3 Q20 ; wait for carousel finished o107 if [#5399 EQ -1] (abort, failed to align carousel 19) o107 endif (MSG, stopping car 20) M65 P0 ;stop carousel (MSG, locking car 21) M64 P1 ;lock carousel (MSG, waiting for lock 22) ;G4 P5 M66 P1 L3 Q5 ;wait for locked=true o108 if [#5399 EQ -1] (Abort, failed to lock carousel 23) o108 endif (MSG, move arm in if not already 24) M64 P2 ; move arm in (might already be in) (MSG, waiting for arm 25) M66 P2 L3 Q5 ; wait for arm-in = true o109 if [#5399 EQ -1] (abort, failed to move arm in 26) o109 endif M64 P3 ;OpenDrawbar M66 P3 L3 Q10 ; wait for tool-released = true o112 if [#5399 EQ -1] (abort, Failed to activate drawbar! 27) o112 endif (MSG, MovingDownForAirBlast 28) G53 G0 Z-80 ;prepForAirBlast (MSG, AirBlast ON 29) M64 P5 ;Spindle air on (MSG, moving down 30) G53 G0 Z-112.357 ;pick up the tool M65 P3 ;TurnOffPump (MSG, AirBlast OFF 31) M65 P5 ;Turn off Spindle Air o200 ENDIF (MSG, Turn off Pump clamp tool 32) M65 P3 ;Turn off Pump;clamp tool (MSG, waiting for toolLocked 33) M66 P3 L4 Q5 ; wait for tool-released = false O110 if [#5399 EQ -1] (abort, failed to clamp tool 34) O110 endif M65 P4 (MSG, move arm out 35) M65 P2 ; move arm back out (MSG, waiting for arm 36) M66 P4 L3 Q20 ; wait for arm-out = true O111 if [#5399 EQ -1] (abort, failed to move arm out 37) O111 endif (MSG, Stopp spindel orient 38) M5 ; Stopp spindel orient M65 P1 ; unlock carousel (MSG, Wait for unlock 39) M66 P1 L4 Q2 ; wait for unlock "LOW signal" o113 if [#5399 EQ -1] (abort, failed to unlock carousel 40) O113 endif o<toolchange> endsub [1] M2

Please Log in to join the conversation.

More
6 years 10 months ago #151978 by andypugh
Replied by andypugh on topic VMC related HAL questions.
Code:
o<toolchange> sub O999 IF [#<_task> EQ 0] o<toolchange> RETURN [1] O999 ENDIF

Please Log in to join the conversation.

Time to create page: 0.129 seconds
Powered by Kunena Forum