Linking a hal pin to the M code

More
04 Nov 2017 14:40 #101309 by Jake
I am back to working on my tool changer, I have been looking over the files in the VMC toolchange on GITHUB and the section of the manual, and I still have not been able to put the pieces together.

I am missing it where I am matching a pin to the M code

Like moving the tool changer arm into position, which mine is just a left/right slide.
This would be in the toolchange_index.hal
# Tool changer arm act, limit switches
net arm-in-act motion.ppmc.0.dout.10.out
net arm-out-act motion.ppmc.0.dout.11.out
net arm-in motion.ppmc.0.din.19.in
net arm-out motion.ppmc.0.din.20.in

Now for a section of my remapped M6 in toolchange.ngc

How does it know what hal pin is matched to the M66, Px and M64, Px ??
o<toolchange> sub

; M66
; P0 carosuel completed ???  <- what will signal carosuel complete
; P1 spindle-is-aligned
; P2 arm-in
; P3 arm-out
; P4  tool-locked
; P5  tool-released 

; M64 
; P1  arm-in-act
; P2  arm-out-act
; P3  release-tool

    M19 R0  ;align the spindle
    M66 P1 L3 Q5     ; wait for spindle-aligned = true
    O103 if [#5399 LT0]
        (abort, failed to orient spindle)
    O103

; 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. 

O100 IF [#<tool_in_spindle> GT 0]
    G53 G0 Z -4
    
    M63 P2 ; move arm in
    M66 P2 L3 Q5 ; wait for arm-in = true
    O104 if [#5399 LT 0]
        (abort, failed to move arm in)
    O104 endif

    M63 P3 ; release tool
    M66 P3 L3 Q2 ; wait for tool-released = true
    O105 if [#5399 LT 0]
        (abort, failed to release tool)
    O105 endif

O100 ENDIF

    G53 G0 Z0

O200 IF [#<selected_tool> GT 0]


    M68 E0 Q#<selected_pocket> ;set the carousel to move to the right pocket

    M64 P0 ; start carousel
    G4 P2
    M66 P0 L3 Q60 ; wait for carousel finished
    O107 if [#5399 LT 0]
        (abort, failed to align carousel)
    O107 endif
   
    O108 endif

    M63 P2 ; move arm in (might already be in)
    M66 P2 L3 Q5 ; wait for arm-in = true
    O109 if [#5399 LT 0]
        (abort, failed to move arm in)
    O109 endif

    G53 G0 Z-4 ; pick up the tool

O200 ENDIF 

M63 P3 ; clamp tool
M66 P3 L4 Q2 ; wait for tool-locked = true
O110 if [#5399 LT 0]
    (abort, failed to lock tool)
O110 endif

M65 P2 ; move arm back out
M66 P4 L3 Q5 ; wait for arm-out = true
O111 if [#5399 LT 0]
    (abort, failed to move arm out)
O111 endif


o<toolchange> endsub [1]


M2

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

More
05 Nov 2017 20:58 #101372 by BigJohnT
linuxcnc.org/docs/2.7/html/gcode/m-code.html#mcode:m62-m65

Px is mapped to motion.digital-out-xx so M62 P1 will turn on motion.digial-out-01

JT
The following user(s) said Thank You: Jake

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

More
06 Nov 2017 19:32 #101457 by andypugh

This would be in the toolchange_index.hal
# Tool changer arm act, limit switches
net arm-in-act motion.ppmc.0.dout.10.out

How does it know what hal pin is matched to the M66, Px and M64, Px ??


If the G-code uses M66 P2 then you need to add a line in the HAL file
net arm-in-act motion.digital-out-02

Or you could have both on one line:
net arm-in-act motion.ppmc.0.dout.10.out motion.digital-out-02

So the P-number refers to the NN in motion.digital-(in/out)-NN and the HAL file connects those to where they need to go.
The following user(s) said Thank You: Jake

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

More
07 Nov 2017 13:58 #101492 by Jake
thanks guys ! Hopefully ill work on it some tomorrow night!

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

Time to create page: 0.127 seconds
Powered by Kunena Forum