586,060 active members*
4,592 visitors online*
Register for free
Login
Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2004
    Posts
    7

    If / Then Statements

    We have a Miyano BNC-34C with a Fanuc OT control.
    We would like to program the machine to run a certain quanity of parts and stop the machine when that quanity is reached.
    We can't find anything about it in the manual. Does anyone know if it is possible with this control, and if so, what shoud the code look like?
    This is what we use in our Okumas:
    CNT=CNT+1
    IF[CNT LT 14]N0001

    counter number=counter number plus 1
    If[counter is less than 14] go to line N0001

    Thanks

  2. #2
    Join Date
    Dec 2003
    Posts
    24221
    I believe you may want the macro programing option, which is extra on the Fanuc controls.
    Al
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  3. #3
    Join Date
    Aug 2004
    Posts
    7
    Al,
    We bought this machine used and are trying to figure it out. If it did have the option on it, how could we tell. Do you know what the code should look like and we can give it a try?

  4. #4
    Join Date
    Mar 2003
    Posts
    765
    Nanker,

    Try this:
    #1=#1+1
    IF[#1 LT 14]GOTO 1

    Variables are identified by the # sign and a number, I don't think the Fanuc let's you use named variables. Plus you need the GOTO statement to identify the block number (without the N).

    HTH,
    Scott

  5. #5
    Join Date
    Jun 2004
    Posts
    67
    Hey Nanker,
    I've successfully used the "loop" counter:

    M98 P666 L10
    (stuff to exit the process)
    M02
    o666 (stuff to make a part)
    M99

    Yes, that is a letter 'o' in the second last line - the case doesn't matter - the parameter after letter "L" is the parts count.

    Loopy regards,
    Terrence

  6. #6
    Join Date
    Jun 2004
    Posts
    450
    On the Cincinnati controls at work, this is done with G10 and G11 codes. Actually the if/then (we call it a check block) is done with only the G11. The G10 is an assignment block.

    Would go something like this:

    N01G10=[T1]V0
    N02Q100
    N03G10=[T1]v[T1]+1
    SECTION OF PROGRAM
    YOU WANT TO REPEAT
    HERE
    N8G11E[T1]<=10L-100
    N9M00

    N01 Sets a 'temporary register' to a value of 0.

    N02 is to give the 'check block' the position to jump back to if the statement on N8 equals 'true'.

    N03 sets a 'temporary register' to the value +1 every time it loops back, thus acting like a counter.

    N08 checks to see if [T1] is less than or equal to 10. If it IS less than or equal to 10, it skips back to Q100 and reruns. If it is NOT equal to or less than 10, it continues with the next line.

    The temporary registers ('t-registers' in the shop) are one of the most useful things I've found on the cincinnati controls. With those and the G11, you can do alot of things. Use it as a counter for just a simple spring pass. Sure it would probably be less confusing just to add an extra pass. But when you are doing the profile of a part that's roughly 100" x 40", this is a bit quicker.

    You can also change ANY value in any of the tables. Tool offsets, position offsets, D and H codes, etc. Especially helpful when using the probe to calculate offsets and such.

    This is all done on the shop floor. Programming has no way of putting this in the programs themselves. But then again, why would they need to? Their programs are perfect, right? :stickpoke

    I realise this has nothing to do with the Fanuc control, but someone out there might find it useful. I'd love to see something like this implemented into some of the control software for us home guys. Or does someone already use it? Mach 2 maybe?

  7. #7
    Join Date
    Jul 2004
    Posts
    3
    There is a screen that has a counter built in. It will show the current # of parts, and the # of parts to run. I believe it is in one of the parameter screens. It is a little difficult to find the first time, but it is there.

    Sorry to be so vague but it has been 7 or 8 year since I last ran a Fanuc OT Control.

    If it does not allow you to make an entry, you will have to call Fanuc and pay $$$ to have it turned on. As with everything in a Fanuc control, it is an option.

    Good Luck
    Kent

Similar Threads

  1. How to do 2 "IF" statements on the same line?
    By murphy625 in forum CamSoft Products
    Replies: 14
    Last Post: 04-02-2005, 02:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •