VMC related HAL questions.

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



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
Last edit: 6 years 10 months ago by CNCDoc.

Please Log in or Create an account 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 or Create an account 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


And this one when I try to change the tool


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 or Create an account to join the conversation.

More
6 years 10 months ago - 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
Last edit: 6 years 10 months ago by andypugh.

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

More
6 years 10 months ago - 6 years 10 months ago #152000 by CNCDoc
Replied by CNCDoc on topic VMC related HAL questions.
It seems to work now. What makes 1 do the difference?
Last edit: 6 years 10 months ago by CNCDoc.

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

More
6 years 10 months ago #152005 by andypugh
Replied by andypugh on topic VMC related HAL questions.
There were two things. Your check was back to front (only run the tool changer if the system _is_ in preview) and the calling code was expecting a return value, so one needed to be added to the return command. (as is the case with the other return in the remap)
The following user(s) said Thank You: CNCDoc

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

Time to create page: 0.473 seconds
Powered by Kunena Forum