Implementation of M code control executable program

More
27 Jul 2021 03:00 #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 or Create an account to join the conversation.

More
27 Jul 2021 03:17 #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 or Create an account to join the conversation.

More
27 Jul 2021 07:44 #216024 by rodw
Whats wrong with using spindle.0.on? It triggers on with M3 and off with M5
The following user(s) said Thank You: chen1234

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

More
27 Jul 2021 08:05 #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 or Create an account to join the conversation.

More
27 Jul 2021 10:56 #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.
The following user(s) said Thank You: chen1234

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

More
27 Jul 2021 11:40 - 27 Jul 2021 13:10 #216035 by Aciera
You can use shell script in a remap. Here is an example file called 'M234' for a remap of M234:

#!/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:
 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:
net spindle-enable <= spindle.0.on => halui.mdi-command-00
and add this to the [HALUI]-section of your INI:

MDI_COMMAND = M234 ( the first MDI_COMMAND entry in the [HALUI]-section corresponds to halui.mdi-command-00 )
 
Last edit: 27 Jul 2021 13:10 by Aciera. Reason: changed M code number
The following user(s) said Thank You: chen1234

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

More
27 Jul 2021 12:54 #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 or Create an account to join the conversation.

More
27 Jul 2021 13:10 #216048 by Aciera
Thanks bevins, I changed the number.

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

More
01 Aug 2021 00:17 #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 or Create an account to join the conversation.

Time to create page: 0.094 seconds
Powered by Kunena Forum