How do I make the connection between M-codes and parport pins?
28 Jun 2017 12:29 #95103
by helig
I'm using a breakout board connected to the parallel port. I'm stuck in the attempt to configure my machine to switch relays. I want the two relays on my board, controlled by parport pins 0 and 14, to respond to M-codes in my gcode, preferrably to M3/M5 (spindle) and M8/M9.
I understand I do a part of the job using a net-command in the hal file to e.g. link pin14 to the motion.spindle-on signal.
On the other hand I have not found the piece of documentation that explains the connection between the M3-command in gcode and the spindle-on signal. Neither did I find out what is a suitable signal to make the connection between M8/m9 and pin1. Actually by editing machine.hal I managed to make the spindle-pin respond the the spindle-button in axis GUI, but not to M3/M5 in gcode.
Can anybody help me with a hint to the relevant parts of documentation?
Thanks in advance
Volker
I understand I do a part of the job using a net-command in the hal file to e.g. link pin14 to the motion.spindle-on signal.
On the other hand I have not found the piece of documentation that explains the connection between the M3-command in gcode and the spindle-on signal. Neither did I find out what is a suitable signal to make the connection between M8/m9 and pin1. Actually by editing machine.hal I managed to make the spindle-pin respond the the spindle-button in axis GUI, but not to M3/M5 in gcode.
Can anybody help me with a hint to the relevant parts of documentation?
Thanks in advance
Volker
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
Less
More
- Posts: 4978
- Thank you received: 1377
28 Jun 2017 14:37 - 28 Jun 2017 14:46 #95106
by Todd Zuercher
Replied by Todd Zuercher on topic How do I make the connection between M-codes and parport pins?
You have to specify a spindle speed with an S code before the spindle will turn on with an M3 or M4.
It is really quite simple. M3/M5 and M8/M9 already have hal pins that they control directly. All you need to do is use a "net" command to connect those pins to your parallel port's hal pins.
The m3/m5 pin is:
motion.spindle-on
The m8/m9 pin is:
iocontrol.0.coolant-flood
The m7/m9 pin is:
iocontrol.0.coolant-mist
(M9 turns off both flood and mist.)
So if if 14 is the spindle for example you could connect them with a hal line like this:
net spindle-on <= motion.spindle-on => parport.0.pin-14-out
If pin 1 (parallel port pins are numbered 1-17, there is no pin 0) is the coolant flood.
net flood <= iocontrol.0.coolant-flood => parport.0.pin-01-out
It does seem that the documentation fails to explicitly state the relationship of those M-codes to those pins.
linuxcnc.org/docs/html/man/man9/motion.9.html
linuxcnc.org/docs/html/man/man1/iocontrol.1.html
It is really quite simple. M3/M5 and M8/M9 already have hal pins that they control directly. All you need to do is use a "net" command to connect those pins to your parallel port's hal pins.
The m3/m5 pin is:
motion.spindle-on
The m8/m9 pin is:
iocontrol.0.coolant-flood
The m7/m9 pin is:
iocontrol.0.coolant-mist
(M9 turns off both flood and mist.)
So if if 14 is the spindle for example you could connect them with a hal line like this:
net spindle-on <= motion.spindle-on => parport.0.pin-14-out
If pin 1 (parallel port pins are numbered 1-17, there is no pin 0) is the coolant flood.
net flood <= iocontrol.0.coolant-flood => parport.0.pin-01-out
It does seem that the documentation fails to explicitly state the relationship of those M-codes to those pins.
linuxcnc.org/docs/html/man/man9/motion.9.html
linuxcnc.org/docs/html/man/man1/iocontrol.1.html
Last edit: 28 Jun 2017 14:46 by Todd Zuercher. Reason: Added S code requirement
Please Log in or Create an account to join the conversation.
28 Jun 2017 16:44 #95114
by helig
Replied by helig on topic How do I make the connection between M-codes and parport pins?
I used to be aware of the spindle speed thing, but forgot this time
Otherwise M3/M5 would have worked. Generally I was not clear about the notion of "pin" and "signal" in linuxcnc, but you made it clear in your hints. Thanks for the quick response, this does help very much.
Regards, Volker
![;-) ;-)](/media/kunena/emoticons/wink.png)
Regards, Volker
Please Log in or Create an account to join the conversation.
Time to create page: 0.139 seconds