thanks guys for the awesome replies! your all amazing i ended up working it out after finding this on the forum worked a treat and i am happy as
https://forum.linuxcnc.org/38-general-linuxcnc-questions/31909-custom-m-code copy and pasted this guys stuff. he saved my bacon so anyone knows who made this i am would love to say thanks" "With the provided help I got this working. I took the approach of creating a remapped m code. I decided to define a m code of m300 to take the place of the standard m30 code. Initially I was going to simply remap m30, but linuxcnc does not support remapping m code in group 4. To start with I created a ngc subroutine named m300.ngc and placed this in the linuxcnc/nc_files folder. You can place it in other folders as long as you specify the folder's path in your ini file. My m300.ngc file consisted of the following: o<m300> sub G91 G28 Z0.0 G91 G28 Y0.0 G91 G28 X0.0 G91 G28 m30 o<m300> endsub Initially I missed the fact that that the first and last lines needed the "<m300>" with the brackets. I thought the brackets in the examples were there for highlighting the words. Also if you want your axis to return to home in a different order, you simply need to change around the g code commands in the m300.ngc file. Once the subroutine was created and defined, I had to reference it in the ini file. The input in the ini file was as follows: [RS274NGC] PARAMETER_FILE = linuxcnc.var USER_M_PATH = /home/shop/linuxcnc/nc_files SUBROUTINE_PATH = /home/shop/linuxcnc/nc_files REMAP=M300 modalgroup=10 ngc=m300 The subroutine_path statement defines the folder where my subroutines will be stored, and the remap statement tells linuxcnc that when a m300 command is found, go run the m300.ngc file. Depending upon what m or g code you are remapping, every m and g code is organized in one of 10 modal groups. If you are using undefined m codes, like my m300, it is a modal group = 10. If I wanted to simply remap the m30 code itself, it would have been a modal group 4, but unfortunately linuxcnc does not support remapping of modal group 4. With these items complete and linuscnc restarted, issuing a m300 command in mdi would move the z axis to home, the y axis to home, the x axis to home, and then the a axis to home, and then if the machine was running a program, stop and rewind the program just like a m30 code would do. I did take this remapping one step further by defining a gladevcp button on my gui which would execute this entire return to home process. To do this I followed the "adding custom mdi buttons" tutorial in the linuxcnc knowledge base. In my hal file I included the following lines #Define action for retract and home all buttons net software-retract halui.mdi-command-00 gladevcp.retract net software-homeall halui.mdi-command-01 gladevcp.home_all These statement associate pressing the "retract" and "home_all" buttons in my gladevcp with mdi commands of 00 and 01 defined in the halui section of my ini file. In my ini file I included the lines of [HALUI] MDI_COMMAND = G91 G28 Z0.0 MDI_COMMAND = M300 The first mdi_command line define a mdi command that will retract the z axis, and the second mdi_command defines a mdi command to run my newly remapped m300 command. The statements in my hal file refer to halui.mdi.command-00 and halui.mdi.command-01 which refer to the first and second mdi commands listed in the ini file. You do not actually number the mdi commands in your ini file so one need to be able to count. That concludes how I was able to define a single m300 g code command which will return all my axis to their home position and how I can use that command in the mdi interface, in a regular ngc program, and also how I referenced that command using a gladevcp button on my gui." On Tue, Mar 1, 2022 at 12:03 PM Nicklas SB Karlsson <n...@nksb.eu> wrote: > Den 2022-02-28 kl. 11:47, skrev andrew beck: > > Hey guys > > > > I want to issue a m102 > > > > And get this code run > > > > S5m3 > > Halcmd setp hm2 7i77etc pin output on > Motion module have digital outputs. > > > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users > _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users