Linking User M codes 101,etc to external switch
- microsprintbuilder
- Offline
- Elite Member
Less
More
- Posts: 163
- Thank you received: 4
26 Oct 2013 03:03 #40294
by microsprintbuilder
I have created some user m codes to open and close my chuck and move the tail-stock in and out. They work just fine. I would like to be able to use the existing switches on the control panel to do the same. The manual says you cannot have these pins in the hal file at all. So how can you control these items with a switch and a M-code?
Please Log in or Create an account to join the conversation.
26 Oct 2013 03:14 - 26 Oct 2013 03:14 #40295
by BigJohnT
Replied by BigJohnT on topic Linking User M codes 101,etc to external switch
Which pins? I think your confusing what the manual says.
Take a look at my Harding e configuration files, I have both M1xx and buttons for my collet closer.
JT
Take a look at my Harding e configuration files, I have both M1xx and buttons for my collet closer.
JT
Last edit: 26 Oct 2013 03:14 by BigJohnT.
The following user(s) said Thank You: microsprintbuilder
Please Log in or Create an account to join the conversation.
- microsprintbuilder
- Offline
- Elite Member
Less
More
- Posts: 163
- Thank you received: 4
26 Oct 2013 04:15 #40296
by microsprintbuilder
Replied by microsprintbuilder on topic Linking User M codes 101,etc to external switch
whats in your Mcode file?
Please Log in or Create an account to join the conversation.
26 Oct 2013 17:50 - 26 Oct 2013 17:57 #40306
by BigJohnT
Replied by BigJohnT on topic Linking User M codes 101,etc to external switch
A bit of info about the Hardinge collet solenoid, it is a toggle type ie. you energize one coil for a moment and the valve toggles to that position. You energize the other coil for a moment and the valve toggles to the other position. It does not need to be energized to stay open or closed.
M100
M101
JT
# External Collet Open/Close Buttons
net collet-open-btn or2.3.in0 <= hm2_5i20.0.gpio.027.in_not
net collet-close-btn or2.4.in0 <= hm2_5i20.0.gpio.025.in_not
net collet-open hm2_5i20.0.gpio.043.out <= or2.3.out
net collet-close hm2_5i20.0.gpio.041.out <= or2.4.out
M100
#!/bin/sh
# open the collet closer
halcmd setp or2.3.in1 1
sleep 0.25
halcmd setp or2.3.in1 0
sleep 0.5
exit 0
M101
#!/bin/sh
# close the collet closer
halcmd setp or2.4.in1 1
sleep 0.25
halcmd setp or2.4.in1 0
sleep 0.5
exit 0
JT
Last edit: 26 Oct 2013 17:57 by BigJohnT.
Please Log in or Create an account to join the conversation.
- microsprintbuilder
- Offline
- Elite Member
Less
More
- Posts: 163
- Thank you received: 4
26 Oct 2013 21:33 #40318
by microsprintbuilder
Replied by microsprintbuilder on topic Linking User M codes 101,etc to external switch
Thanks JT ,
how did you know that was going to be my next question. I changed my files and now get an error that says "or2.3 not found" I have
# Collet Closer
addf or2.3 servo-thread
addf or2.4 servo-thread
# --- COLLET-OPEN ---
net collet-open hm2_5i25.0.7i77.0.0.output-11 <= or2.3.out
# --- COLLET-CLOSE ---
net collet-close hm2_5i25.0.7i77.0.0.output-12 <= or2.4.out
# --- TAILSTOCK-OUT ---
net tailstock-out hm2_5i25.0.7i77.0.0.output-14
# --- TAILSTOCK-IN ---
net tailstock-in hm2_5i25.0.7i77.0.0.output-15
# external input signals
# --- TAILSTOCK-OUT ---
net tailstock-out <= hm2_5i25.0.7i77.0.0.input-20
# --- TAILSTOCK-IN ---
net tailstock-in <= hm2_5i25.0.7i77.0.0.input-21
# --- COLLET-OPEN ---
net collet-open-btn or2.3.in0 <= hm2_5i25.0.7i77.0.0.input-22
# --- COLLET-CLOSE ---
net collet-close-btn or2.4,in0 <= hm2_5i25.0.7i77.0.0.input-23
how did you know that was going to be my next question. I changed my files and now get an error that says "or2.3 not found" I have
# Collet Closer
addf or2.3 servo-thread
addf or2.4 servo-thread
# --- COLLET-OPEN ---
net collet-open hm2_5i25.0.7i77.0.0.output-11 <= or2.3.out
# --- COLLET-CLOSE ---
net collet-close hm2_5i25.0.7i77.0.0.output-12 <= or2.4.out
# --- TAILSTOCK-OUT ---
net tailstock-out hm2_5i25.0.7i77.0.0.output-14
# --- TAILSTOCK-IN ---
net tailstock-in hm2_5i25.0.7i77.0.0.output-15
# external input signals
# --- TAILSTOCK-OUT ---
net tailstock-out <= hm2_5i25.0.7i77.0.0.input-20
# --- TAILSTOCK-IN ---
net tailstock-in <= hm2_5i25.0.7i77.0.0.input-21
# --- COLLET-OPEN ---
net collet-open-btn or2.3.in0 <= hm2_5i25.0.7i77.0.0.input-22
# --- COLLET-CLOSE ---
net collet-close-btn or2.4,in0 <= hm2_5i25.0.7i77.0.0.input-23
Please Log in or Create an account to join the conversation.
26 Oct 2013 21:47 - 26 Oct 2013 21:48 #40319
by BigJohnT
Replied by BigJohnT on topic Linking User M codes 101,etc to external switch
Your missing in your hal file:
and change the or2.3's to or2.0 and or2.4's to or2.1, I have more than two or2's in my hal file.
linuxcnc.org/docs/html/man/man9/or2.9.html
linuxcnc.org/docs/html/hal/basic_hal.html
JT
loadrt or2 count=2
and change the or2.3's to or2.0 and or2.4's to or2.1, I have more than two or2's in my hal file.
linuxcnc.org/docs/html/man/man9/or2.9.html
linuxcnc.org/docs/html/hal/basic_hal.html
JT
Last edit: 26 Oct 2013 21:48 by BigJohnT.
Please Log in or Create an account to join the conversation.
- microsprintbuilder
- Offline
- Elite Member
Less
More
- Posts: 163
- Thank you received: 4
26 Oct 2013 22:10 #40320
by microsprintbuilder
Replied by microsprintbuilder on topic Linking User M codes 101,etc to external switch
Thanks, I did miss the loadrt count. I already have 3 so I changed it to 5. Now I get "and2.3.in1 does not exist". Is it not reading the user m code files?
Please Log in or Create an account to join the conversation.
- microsprintbuilder
- Offline
- Elite Member
Less
More
- Posts: 163
- Thank you received: 4
26 Oct 2013 22:22 #40323
by microsprintbuilder
Replied by microsprintbuilder on topic Linking User M codes 101,etc to external switch
I think and2 error has nothing to do with this. I must have changed something. I'll keep looking.
Please Log in or Create an account to join the conversation.
- microsprintbuilder
- Offline
- Elite Member
Less
More
- Posts: 163
- Thank you received: 4
26 Oct 2013 22:35 #40325
by microsprintbuilder
Replied by microsprintbuilder on topic Linking User M codes 101,etc to external switch
I changed the and2 count instead of the or2 count. It works! Thanks!
Please Log in or Create an account to join the conversation.
- microsprintbuilder
- Offline
- Elite Member
Less
More
- Posts: 163
- Thank you received: 4
26 Oct 2013 23:56 #40327
by microsprintbuilder
Replied by microsprintbuilder on topic Linking User M codes 101,etc to external switch
I also have a coolant switch (toggle on/ off) on the panel. what would be the best way to route that so it would override the control command. I was thinking classic ladder. or doing something like your pause/resume code.
Please Log in or Create an account to join the conversation.
Time to create page: 0.110 seconds