M200 G code yes no

_______________________________________________________














LOGIN below to POST your questions and comments on AjaxCNC products.

Moderator: cnckeith

Post Reply
bakeng
Posts: 47
Joined: Wed Nov 16, 2011 5:50 pm
Allin1DC CNC Controller: No
MPU11 & GPIO4D -w/ 3rd Party Drives: Yes
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: Yes
System Serial Number: none

M200 G code yes no

Post by bakeng » Wed Feb 07, 2018 3:43 pm

I need to add a pause and ask a question to my g code. Based on the user answer jump to a certain point in my program.
I tried M200 but could never get it to work.
Basiclly I just want to ask the machine operator if a hole needs to be drilled. If not skip that part of the code.

cncsnw
Posts: 355
Joined: Wed Mar 24, 2010 5:48 pm

Re: M200 G code yes no

Post by cncsnw » Wed Feb 07, 2018 4:44 pm

That would be M224.

You will have to phrase your question so it takes a numeric answer. E.g.

Code: Select all

M224 #101 "Enter 1 to drill the hole, or enter 0 to skip"
IF [#101 != 1] THEN GOTO 20
  ; drill the hole...
N20

bakeng
Posts: 47
Joined: Wed Nov 16, 2011 5:50 pm
Allin1DC CNC Controller: No
MPU11 & GPIO4D -w/ 3rd Party Drives: Yes
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: Yes
System Serial Number: none

Re: M200 G code yes no

Post by bakeng » Wed Feb 07, 2018 4:55 pm

I will give it a try.
Thanks

cnc_smith
Posts: 12
Joined: Mon Nov 20, 2017 10:13 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
MPU11 & GPIO4D -w/ 3rd Party Drives: No
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: No
System Serial Number: none
Location: Frenchville, PA

Re: M200 G code yes no

Post by cnc_smith » Wed Feb 07, 2018 5:28 pm

Here is another way to right the G-code with the M224. This one has a GOTO to go back to ask the question again if they do not answer 1 or 2. This way if they fat finger a number besides 1 or 2 it does not go through and do any part of the program.


download/file.php?mode=view&id=1783&sid ... 35d8fb72ad
Attachments
M224 - Y or N.txt
M224 Asking question
(387 Bytes) Downloaded 9 times

bakeng
Posts: 47
Joined: Wed Nov 16, 2011 5:50 pm
Allin1DC CNC Controller: No
MPU11 & GPIO4D -w/ 3rd Party Drives: Yes
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: Yes
System Serial Number: none

Re: M200 G code yes no

Post by bakeng » Thu Feb 08, 2018 9:19 am

Thanks guys. I will try these today.
Seems odd you cant look for a Y or N instead of a number.
Can the #300 variables be used? It looks like they are for text (string) format.

cnc_smith
Posts: 12
Joined: Mon Nov 20, 2017 10:13 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
MPU11 & GPIO4D -w/ 3rd Party Drives: No
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: No
System Serial Number: none
Location: Frenchville, PA

Re: M200 G code yes no

Post by cnc_smith » Thu Feb 08, 2018 11:07 am

Yes the M300 variable can be used but not for a comparison.
You are right the they are for text (string) format.

They can be used in M223, M234, M225.

Also the can be used with the M120 and M121. M120 & M121 are used to write information to a file or append a file with additional information

Example of M120:
M224 #300 "Please enter the file name that you wish to save your data to:\n"
#350 = "c:\cncm\"
M120 "#350\ncfiles\#300.cnc" ; This writes the information to the file name they gave in the M224 in the directory c:\cncm\ncfiles with the extension .cnc. This would save the operator writing the full path and make sure it is going into the directory that the program is expecting it to go into with the correct extension.

There is a lot that can be done but I what to try and kept it KIS at this time. I have write macros that have more than 2 options for answer then have used the numbers in comparison with other variables. I have missed putting in checks to make sure the answer for the number was not out of range and got burnt by going into a section that could and/or did case a crash and also got programming errors will trying to test the macro.

As the saying goes" You try to write code to cover for the Idiot, but the keep making Smarter Idiots that that can still break it."

bakeng
Posts: 47
Joined: Wed Nov 16, 2011 5:50 pm
Allin1DC CNC Controller: No
MPU11 & GPIO4D -w/ 3rd Party Drives: Yes
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: Yes
System Serial Number: none

Re: M200 G code yes no

Post by bakeng » Thu Feb 08, 2018 11:26 am

Believe me, I understand.
I am mainly an automation engineer and am a master level programmer in several languages.
Its amazing what an "idiot" can do to an "idiot proof" machine.
When I'm asked to design and build an "idiot proof" machine, I always ask the customer if they really want idiots running there machine.

Post Reply

Who is online

Users browsing this forum: RandyL and 1 guest