Implementation of M code control executable program

More
5 years 3 months ago #216009 by chen1234
Use an executable program in a shell script and name the script M3. Can it be executed on linuxcnc? Or how can I use this executable program to make it an M code.

Please Log in to join the conversation.

More
5 years 3 months ago #216010 by chen1234
The M code uses an executable program to control the laser switch. The executable program is implemented by the laser control api. I want the M code to call this program. How should the M code be written?

Please Log in to join the conversation.

More
5 years 3 months ago #216024 by rodw
Whats wrong with using spindle.0.on? It triggers on with M3 and off with M5

Please Log in to join the conversation.

More
5 years 3 months ago #216025 by chen1234
Thank you for your reply. I want to use M3 to complete the laser turn on, and M5 to complete the laser turn off, but it cannot be achieved on Linuxcnc. What do I need to do? There is no M3 in Remappable Codes ( linuxcnc.org/docs/2.8/html/remap/remap.h...map:remappable-codes ), what should I do?
thanks,
chen

Please Log in to join the conversation.

More
5 years 3 months ago #216030 by tommylight
M3 will turn laser/spindle/plasma/nuke and M5 will turn them off ( maybe not the last one :) ), ther is just the way it was set up:
If setup to use PWM it will require alsoan S value, whatever value from 1 to nnnn.
It has to be wired in hal to spinle.on, not to spindle.forward or spindle.reverse.

Please Log in to join the conversation.

More
5 years 3 months ago #216035 by Aciera
You can use shell script in a remap. Here is an example file called 'M234' for a remap of M234:

Code:
#!/usr/bin/tclsh # your tclsh-script here!


The code will of course need to be adapted to your api.
This file is in a folder named 'mcodes' inside your machine config folder

Then you need to add this to the [RS274NGC] section of your INI file:
Code:
 USER_M_PATH = ./mcodes


You can also use python for remap.

If you want to use M3 in your gcode you might have to call your custom M-code remap by connecting an MDI-command to the spindle.0.on pin:
Code:
net spindle-enable <= spindle.0.on => halui.mdi-command-00
and add this to the [HALUI]-section of your INI:

Code:
MDI_COMMAND = M234 ( the first MDI_COMMAND entry in the [HALUI]-section corresponds to halui.mdi-command-00 )
 

Please Log in to join the conversation.

More
5 years 3 months ago #216047 by bevins
I thought M100 - M199 were not suppose to be remapped. I'm pretty sure that is in the docs somewhere.

Please Log in to join the conversation.

More
5 years 3 months ago #216048 by Aciera
Thanks bevins, I changed the number.

Please Log in to join the conversation.

More
5 years 2 months ago #216538 by andypugh
Just to throw something else into the mix: It is probably possible to use M3/M5 as normal, but feed the spindle.N.on HAL pin into a custom HAL component that uses the Laser API to switch it on and off.

Please Log in to join the conversation.

Time to create page: 0.092 seconds
Powered by Kunena Forum