M codes for eg. vacuum and air pressure drop

Post anything you want to discuss with others about the software.

M codes for eg. vacuum and air pressure drop

Postby PillyWilly » Mon Nov 20, 2017 4:26 pm

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
PillyWilly
 
Posts: 13
Joined: Wed Oct 25, 2017 6:29 pm

Re: M codes for eg. vacuum and air pressure drop

Postby ger21 » Mon Nov 20, 2017 4:37 pm

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.
Gerry
UCCNC 2017 Screenset - http://www.thecncwoodworker.com/2017.html
ger21
 
Posts: 1117
Joined: Sat Sep 03, 2016 2:17 am

Re: M codes for eg. vacuum and air pressure drop

Postby PillyWilly » Mon Nov 20, 2017 4:48 pm

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.?
PillyWilly
 
Posts: 13
Joined: Wed Oct 25, 2017 6:29 pm

Re: M codes for eg. vacuum and air pressure drop

Postby Robertspark » Mon Nov 20, 2017 6:07 pm

viewtopic.php?f=15&t=234

The uccnc toolbox thread holds a number of example macros.

The ones you are after are within the above link
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 898
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: M codes for eg. vacuum and air pressure drop

Postby cncdrive » Mon Nov 20, 2017 6:18 pm

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.
cncdrive
Site Admin
 
Posts: 2190
Joined: Tue Aug 12, 2014 11:17 pm

Re: M codes for eg. vacuum and air pressure drop

Postby PillyWilly » Mon Nov 20, 2017 9:21 pm

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?
PillyWilly
 
Posts: 13
Joined: Wed Oct 25, 2017 6:29 pm

Re: M codes for eg. vacuum and air pressure drop

Postby Robertspark » Mon Nov 20, 2017 9:25 pm

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
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 898
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: M codes for eg. vacuum and air pressure drop

Postby cncdrive » Fri Nov 24, 2017 11:23 am

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.
cncdrive
Site Admin
 
Posts: 2190
Joined: Tue Aug 12, 2014 11:17 pm

Re: M codes for eg. vacuum and air pressure drop

Postby Battwell » Fri Nov 24, 2017 12:33 pm

I want to be the first one to rum a macro m111111111
I didn't realise we had that many available :-)
Uc300eth on router and mill
If they say it can't be done- I find a way!
Battwell
 
Posts: 353
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: M codes for eg. vacuum and air pressure drop

Postby cncdrive » Fri Nov 24, 2017 1:12 pm

:)
cncdrive
Site Admin
 
Posts: 2190
Joined: Tue Aug 12, 2014 11:17 pm

Next

Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: Majestic-12 [Bot] and 4 guests