Hello Guest it is April 28, 2024, 06:24:15 PM

Author Topic: Using M2xx codes  (Read 1683 times)

0 Members and 1 Guest are viewing this topic.

Offline MDub

*
  •  26 26
    • View Profile
Using M2xx codes
« on: January 31, 2022, 02:39:48 PM »
I had a question in the plugins forum about "Parts Finished" and Alarm conditions but I'm realizing that it really isn't about ESS. The initial question was asking what event triggers a Parts Completed condition. Initial thoughts were an M2 or M30 in the Gcode but that didn't work. We wanted to send output to a Port/Pin when this condition was met.
However we found what seemed a clearer alternative, to use the M200 or M220 codes to trigger an Output condition, which we could tie to a pinout. But including an M200 or M220 S0 D200 in our GCode just prior to the final M30 does not turn on Output 0 on the Mach4 diagnostic screen. Neither does just entering either of these M codes in the MDI screen. We must be missing somethigs. Can someone help?
Re: Using M2xx codes
« Reply #1 on: January 31, 2022, 04:22:22 PM »
Hi,
so what are the m200 and m220 scripts. They are not standard Mach issue....so where did they come from and what do they do?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Using M2xx codes
« Reply #2 on: January 31, 2022, 04:52:58 PM »
This is taken from the parameters.ini file found in the Profile folder which should help set up the part counting with an mcode. There is also the output mc.OSIG_PRTSF for Parts Finished which may be of use..

[6700]
Desc=Setting to 1 only allows M code specified by #6710 to increment part count. (default 0)
Type=WORD
Value=0
[6710]
Desc=Set to a M code that will increment part counts with or without M02 and M30 according to #6700.
Type=WORD
Value=0
[6711]
Desc=R/W: Total number of parts.  Will change/reflect #3901 as well. (cleared on file load).
Type=DWORD
Value=130
[6712]
Desc=R/W: Total number of parts machined.
Type=DWORD
Value=131
[6713]
Desc=R/W: Number of required parts  Will change/reflect #3902 as well.
Type=DWORD
Value=0

Offline MDub

*
  •  26 26
    • View Profile
Re: Using M2xx codes
« Reply #3 on: January 31, 2022, 07:42:14 PM »
joeaverage, I got the info on the 2## scripts here. https://support.machmotion.com/books/software/page/mach4-advanced-m-code-reference. Not official Mach4 documentation but I assumed it was legit. Unfortunatley I couldn't get it to work/

Swifty, thanks for this additional info, I'll try it. This is getting pretty deep in the weeds so can you point me to the Mach4 documentation that covers these M code customizations?
Re: Using M2xx codes
« Reply #4 on: January 31, 2022, 08:11:20 PM »
The information you found is legit IF you are running MachMotion's custom profiles. The items described are not present in the standard Mach4 profiles from MachSupport.com installs.
Steve Stallings
www.PMDX.com

Offline MDub

*
  •  26 26
    • View Profile
Re: Using M2xx codes
« Reply #5 on: January 31, 2022, 08:16:09 PM »
It did seem just too easy....Thanks

Offline MDub

*
  •  26 26
    • View Profile
Re: Using M2xx codes
« Reply #6 on: January 31, 2022, 08:52:45 PM »
Swifty,

Using your example I changed 6700 to value=1 and 6710 value=100 (is MCode 100 ok?) and I understand that increments the parts completed by 1 but I'm unclear on the rest of your instructions to use mc.OSIC_PRTSF to indicate Parts Finished. I feel like I'm inching towards the finish line in getting an output pin to signal the end of a job but I'm just not there yet.  Where is mc.PRTSF and what do i do with it?

Thanks for all your help.
Re: Using M2xx codes
« Reply #7 on: January 31, 2022, 09:13:17 PM »
Hi,
those macros are Mach Motions and apply to their profile. They are however very simple macros for turning outputs on and off. You could replicated them if you need.
I think that SwiftyJ's post holds the most promise. Observing the mc.OSIG_PRTSF is the next thing. What you are looking for is some event or signal or condition in Mach that
reliably signifies that a part has finished.

Once you find a suitable event/signal/condition then turning on an output is trivial.

To facilitate the search why don't you temporarily make an on screen LED that reflects the state of mc.OSIG_PRTSF, and then run some parts. What you are hoping is that each time the Gcode file
completes (ie part is finished) then mc.OSIG_PRTSF will set. How long For? Don't know.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline MDub

*
  •  26 26
    • View Profile
Re: Using M2xx codes
« Reply #8 on: January 31, 2022, 09:44:23 PM »
Thanks Joe but you're way above my head.
What is a Mach Motion? I can't find it defined in any Mach documentation. Where do I find mc.OSIG.SFPRT?
I can create the on screen led but without understanding where mc.OSIG is and how to identify it as the led driver, I'm jammed.
Re: Using M2xx codes
« Reply #9 on: January 31, 2022, 11:26:12 PM »
Hi,
Mach Motion is a company, separate from NFS/Artsoft that make motion control products, including full machines. They have over the years contributed a number of important ideas, code,
plugins etc to the Mach community. For instance the Lathe Wizards found in Mach4 are Mach Motion code, and note that only the compiled code is available, Mach Motion quite rightly
hold the source code for themselves.

Mach has a whole bunch of signals, some like mc.OSIG_PTRSF, is an output signal, mc.ISIG_PROBE is an input signal....but there are many hundreds more, many of which are not documented and are for signalling between
Machs different modules and plugins which are neither inputs nor outputs but event signals between components.

In Mach4Hobby/Docs/MachCoreAPI.chm under the Mach Signals you will find a list of all the input signals ( mc.ISIG_*********) and output signals (mc.OSIG_*********) available for use by users.

I have attached a pic of the Edit Screen page. You will note that I have just plonked an LED, called led108, you can see it in the file tree and its representation in Spindle block, it was a convenient open space.
Note also that I have attached the LED to reflect the state of the Parts Finished output signal. Easy.

Now you can run some parts and see what happens to that LED. This should inform your decision as to whether it is an appropriate signal for your purposes.

Craig

'I enjoy sex at 73.....I live at 71 so its not too far to walk.'