Hello Guest it is December 26, 2024, 02:43:18 PM

Author Topic: M90 and M91, and parameters to M codes  (Read 23792 times)

0 Members and 1 Guest are viewing this topic.

Offline rcaffin

*
  •  1,066 1,066
M90 and M91, and parameters to M codes
« on: November 23, 2014, 04:25:20 AM »
Hi all

Three related questions:

Does anyone know whether Mach3 supports M90 output #n and M91 output #n calls? Some systems allow you to turn on and off an output #n this way.

Alternately, is it possible to pass a parameter to an M-call? eg M90 3 - which will be translated internally to ActivateSignal(output3) if I can figure out how to get the '3' into the string in an acceptable manner.

Finally, the Reset/Init string defined in Config - can one include an M-call in that string? All I ever see are g-codes.

Cheers

Offline BR549

*
  •  6,965 6,965
Re: M90 and M91, and parameters to M codes
« Reply #1 on: November 23, 2014, 02:20:44 PM »
You can create an Mcode to do about anything you want. User Mcodes  are M100 and higher.

You could create M100 M101 for instance.

YES you can pass up to 3 paramaters to an Mcode   M100 P# Q# R# .

It is all in the Mach programmers manua.

YES you can included Mcodes in the init stringl

Offline rcaffin

*
  •  1,066 1,066
Re: M90 and M91, and parameters to M codes
« Reply #2 on: November 23, 2014, 03:12:22 PM »
Hi Terry
Quote
You can create an Mcode to do about anything you want. User Mcodes  are M100 and higher.
Yes, I knew that. Actually, some references say M90 - M99 are reserved for users as well.

Quote
YES you can pass up to 3 paramaters to an Mcode   M100 P# Q# R# .
It is all in the Mach programmers manua.
Wonderful, thank you.
I am sure it is in the manual, but I could not find it. Would you know the page number by any chance?

Quote
YES you can included Mcodes in the init stringl
Thanks. I thought so, but right now I am rebuilding the entire electronics part of my CNC and I can't test Init strings right now ...

Cheers
Roger


Offline BR549

*
  •  6,965 6,965
Re: M90 and M91, and parameters to M codes
« Reply #3 on: November 23, 2014, 04:22:34 PM »
Better that that because the manual is kinda vauge I can give you an example. Create this example as M123 then call teh M123 P# Q# R# and the values will appear in the status bar in mach3.

'M123 example Macro Parameter call

Test1 = param1()
Test2 = param2()
Test3 = param3()

Message "" &Test1 &" , " &Test2 &" ," &Test3

End

Offline BR549

*
  •  6,965 6,965
Re: M90 and M91, and parameters to M codes
« Reply #4 on: November 23, 2014, 04:25:35 PM »
Actually I think you can use ANY mcode # that is not already used by mach3. The range of m100 --> up was to keep OEM codes and USER codes seperated

Just a thought, (;-)

Offline rcaffin

*
  •  1,066 1,066
Re: M90 and M91, and parameters to M codes
« Reply #5 on: November 23, 2014, 05:15:16 PM »
Hi Terry

I still can't find where that was in the manual, although I seem to have a vague memory of seeing it once. Oh Well.
Interesting discovery: the values are persistent. So missing out on one parameter in a call can give variable results.

Using your example:
M123 P1 Q2 R3 gives the expected 1,2,3 reply.
M123 P4 may give 4,-1,0 if it is the first call, or sometimes 4,-1,-1, but if it follows the previous example you get 4,2,3 . This can be problematic.

I tried using isnull(), but once the variable has been used once it is no longer null. So far I can see no way of releasing a variable name after use.

Cheers, and thanks
Roger

Offline BR549

*
  •  6,965 6,965
Re: M90 and M91, and parameters to M codes
« Reply #6 on: November 23, 2014, 05:37:54 PM »
Customizing Mach2 Manual , Page 4-7

As you have noticed there are some quircks that were never fixed (;-)

Normally you ONLY specify Params that you are going to use in your routine. and IF you are not going to use a specific param all the time then do a

M123 P0 Q10    to zero out the unneeded values

Offline BR549

*
  •  6,965 6,965
Re: M90 and M91, and parameters to M codes
« Reply #7 on: November 23, 2014, 05:50:56 PM »
I looked it up in the oldM3  notes and you USED to be able to Zero the Param values in CB with

Code"P0 Q0 R0 "

The R still works BUT the P Q are broken (;-(

(;-) TP

Offline rcaffin

*
  •  1,066 1,066
Re: M90 and M91, and parameters to M codes
« Reply #8 on: November 23, 2014, 06:44:16 PM »
Hi Terry

I never looked at the Mach2 manuals ... on the ASSUMPTION that all the info needed would be in the Mach3 manuals. Sigh :-)
I have downloaded some of the older Mach2 docs and will read through them. Thanks!

> The R still works BUT the P Q are broken
Yeah, I have found differences in the responses for Q and R already. Fuzz-testing.

Anyhow, given what you have told me, I can work around it. Shouldn't be too ugly.

Back to the rebuild.

Cheers
Roger

Offline rcaffin

*
  •  1,066 1,066
Re: M90 and M91, and parameters to M codes
« Reply #9 on: November 30, 2014, 05:35:42 AM »
Hi Terry

PQR work fine for my needs. Machine now rebuilt and running well.
Thanks.

Cheers
Roger