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: 76
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 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2663
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: 76
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
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

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: 4695
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: 76
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
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

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: 4695
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.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 819
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: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Next

Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: TReischl and 5 guests