Page 1 of 2
M codes for eg. vacuum and air pressure drop
Posted:
Mon Nov 20, 2017 4:26 pm
by PillyWilly
Hi
I´m new to the UCCNC software, therefore this is a newbie question.
Is there a way I can program a M code, that vill enable eg a vacuum or air pressure valve/switch. I do not find an M code for this.
Is there "user M codes" I can use to look for a signal on a specific port and pin?
Regards
Re: M codes for eg. vacuum and air pressure drop
Posted:
Mon Nov 20, 2017 4:37 pm
by ger21
The simplest method is to use the coolant codes, M7 and M8, if you aren't using them.
Otherwise, you can create your own M codes by writing a C# macro.
Re: M codes for eg. vacuum and air pressure drop
Posted:
Mon Nov 20, 2017 4:48 pm
by PillyWilly
ger21 wrote:The simplest method is to use the coolant codes, M7 and M8, if you aren't using them.
Otherwise, you can create your own M codes by writing a C# macro.
I am using the M7 and M8 for flood and mist.
Can anyone tell a little about how to write a C# macro.?
Re: M codes for eg. vacuum and air pressure drop
Posted:
Mon Nov 20, 2017 6:07 pm
by Robertspark
viewtopic.php?f=15&t=234The uccnc toolbox thread holds a number of example macros.
The ones you are after are within the above link
Re: M codes for eg. vacuum and air pressure drop
Posted:
Mon Nov 20, 2017 6:18 pm
by cncdrive
Rob's document is a good point to start with.
You can also check the UCCNC/Documentation folder.
And another advice is to study the existing UCCNC macros, just open them with a text editor (e.g. the Windows notepad) from the UCCNC/Profile/Macro_yourprofile/ folder.
And you can also google "C# programming tutorial" if you are not yet familiar with the C# programming language, it is a very popular language, so you will find lots of tutorials online.
And to write a macro and to test it you can try to run them any time using the UCCNC, e.g. with typing in the macro number in the MDI.
You simply have to create the same Mxxx.txt file and then type in the Mxxx number in the MDI to see if the macro runs.
And if the macro has an error then you get an error message in the UCCNC status box and you can check the Errorlog.txt file in the UCCNC/Profile/Macro_yourprofile/ folder, that file contains the latest macro compiler error message. So if you check that file after a macro compile error then you can get an idea about what is the error in the macro code.
Re: M codes for eg. vacuum and air pressure drop
Posted:
Mon Nov 20, 2017 9:21 pm
by PillyWilly
cncdrive wrote:Rob's document is a good point to start with.
You can also check the UCCNC/Documentation folder.
And another advice is to study the existing UCCNC macros, just open them with a text editor (e.g. the Windows notepad) from the UCCNC/Profile/Macro_yourprofile/ folder.
And you can also google "C# programming tutorial" if you are not yet familiar with the C# programming language, it is a very popular language, so you will find lots of tutorials online.
And to write a macro and to test it you can try to run them any time using the UCCNC, e.g. with typing in the macro number in the MDI.
You simply have to create the same Mxxx.txt file and then type in the Mxxx number in the MDI to see if the macro runs.
And if the macro has an error then you get an error message in the UCCNC status box and you can check the Errorlog.txt file in the UCCNC/Profile/Macro_yourprofile/ folder, that file contains the latest macro compiler error message. So if you check that file after a macro compile error then you can get an idea about what is the error in the macro code.
Thank you so much, all of you.
The M code Numbers must be between 20000 and 21999 right?
Re: M codes for eg. vacuum and air pressure drop
Posted:
Mon Nov 20, 2017 9:25 pm
by Robertspark
Only if they are screenset buttons
Otherwise you can have any other numbers (but don't have two the same...), Not sure what the maximum number is but I think it's probably 20,000
Re: M codes for eg. vacuum and air pressure drop
Posted:
Fri Nov 24, 2017 11:23 am
by cncdrive
The limit for M code numbers is the integer type's maximum value, which is 2147483647.
The 20000 to 21999 is the range for button call macros. The macros in this range are directly called and executed when the same buttonnumber macro is pressed on the screen. So, this is a special range of macro numbers.
Re: M codes for eg. vacuum and air pressure drop
Posted:
Fri Nov 24, 2017 12:33 pm
by Battwell
I want to be the first one to rum a macro m111111111
I didn't realise we had that many available
Re: M codes for eg. vacuum and air pressure drop
Posted:
Fri Nov 24, 2017 1:12 pm
by cncdrive