Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Probing problem with while do loop.


crazy^millman
 Share

Recommended Posts

Ok I am having problems with this while do loop.

 

code:

O00000474(C AXIS WORKOFFSET RDB)

#150=#7785(C AXIS WORKOFFSET VAULE FOR P40)

#151=#5025(MACHINE C AXIS POSITION)

WHILE[[#150-#151]GT.001]DO1

T40M06

G00G54.1P40G90B90.

G43Z2.0

G00X4.Z4.1Y0

G65P9610X3.25Y0

G65P9618X3.05Y4.B2.S140(CHECK C AXIS OFFSET AND UPDATE C AXIS WORKOFFSET)

G65P9610X3.25

G00G91G28X0

G00G90G54.1P40C20.(MOVE C AXIS TO APPLY NEW C WORKOFFSET)

G00G90C0.(MOVE C AXIS BACK TO C0)

END1

G91G28X0

G91G28Z0Y0

M30


The problem is that when it does the probing that works great and will correct the C offset updat it untill it is within the tolerence I give it. The problem is that when it gets to the tolerence it just keeps going and will not stop the loop. I reset the program and run the program above it it will complete the program without having to run the program. I have tried doing #152=#150-#151 and WHILE[#152GT.001]DO1. I also tired using GE(greater than or equal to) and still got the same results with and without using the above statements.

 

I am thinking about switching to IF and GOTO and seeing if I can get it to work that way but think the WHILE[]DO loop should work. I have some conditions to add to this but if I can not get this to work then kind of barking up the wrong tree so to speak.

 

I can get all of the probing cycles to work just fine, but here is where I am having a fit.

 

Appericate anything you can offer or any help.

Link to comment
Share on other sites

Ron,

 

Not quite used with the While-Do loop, but I don't see where variables #150 and #151 get updated after they were read before the While command.

 

Also, could someone tell mewhere does the program returns when it reaches the line wine END1?

Link to comment
Share on other sites

1: I tired it without the condition statement using the #152 and doing the math in a different place no help.

 

2: Yes the tolerence can be .001 becuase the C axis can move to .0001 degree.

 

3: The idea is to run the Macro complete and start running part as with any probing cycle. So an M00 will just be a delay I am not looking for, but might add it just to keep it running.

 

4: The workoffset varaible updates when you do the probing cycle the S140 will update the C axis workoffset vaule when doing the P9618 cycle. The machine postion updates when you move the C axis and then bring it back to 0. I will however try putting the Varailbes inside of the While Loop and see if that makes a difference. It might not be release one of the varaibles thus repeating the loop. I will let you know how this works.

 

Again thanks for the ideas.

Link to comment
Share on other sites

I changed it to this:

code:

O00000474(C AXIS WORKOFFSET RDB)

N10

#150=#7785(C AXIS WORKOFFSET VAULE FOR P40)

#151=#5025(MACHINE C AXIS POSITION)

#152=[#150-#151]

T40M06

G00G54.1P40G90B90.

G43Z2.0

G00X4.Z4.1Y0

G65P9610X3.25Y0

G65P9618X3.05Y4.B2.S140(CHECK C AXIS OFFSET AND UPDATE C AXIS WORKOFFSET)

G65P9610X3.25

G00G91G28X0

G00G90G54.1P40C20.(MOVE C AXIS TO APPLY NEW C WORKOFFSET)

G00G90C0.(MOVE C AXIS BACK TO C0)

IF[#152GT.001]GOTO10

G91G28X0

G91G28Z0Y0

M30


I have to add my ABS and couple other things, but got it going thanks for the help and ideas.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...