586,013 active members*
3,807 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Okuma > Priority code reproblem in looped program (Okuma LC40, OSP500L)
Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2013
    Posts
    18

    Question Priority code reproblem in looped program (Okuma LC40, OSP500L)

    I'm trying to run a program that loops a specifyed number of times, but when it loopes back to start i get a P-code error, as it begins on a lower code.
    Is there any way to reset the priority codes?

  2. #2
    Join Date
    Feb 2009
    Posts
    6028
    You should be able to call a p0 on both turrets just before the loop statement.

  3. #3
    Join Date
    Apr 2013
    Posts
    18
    Do I have to call it twice, and if so, how do I do that?

  4. #4
    Join Date
    Apr 2013
    Posts
    65
    I've never ran a dual turret, but I'll take a stab at this.

    Code:
    VC20 = 42 (**ENTER NUMBER OF PARTS**)
    
    (SET-UP CODE TO START LOOP HERE)
    (IE MOVE TO SAFE PLACE)
    
    NATS (START OF LOOP) 
    
    (MAIN LOOP HERE)
     
    
    VC20 = VC20-1
    IF [VC20 GT 0]GOTO NATS
    
    (EXIT LOOP CODE) 
    
    NEND

  5. #5
    Join Date
    Apr 2006
    Posts
    822
    You should be able to program a negative P code at the start of each turret to 'reset' your P Codes.
    i.e.

    G13
    N100 P-100
    G14
    N100 P-100
    .
    .
    .
    Program as required...
    .
    .
    .

    Cheers
    Brian.

  6. #6
    Join Date
    Apr 2013
    Posts
    18
    Thanks for the replies..
    I tryed both calling P-100 and P0, but i get the same error saying that the P-value is lower then the one befor..
    Any other ideas?

  7. #7
    Join Date
    Apr 2009
    Posts
    1262
    Broby is right. The P with a negative (P-1) will work for you. Are you sure you re-selected after the edit? If yes, then check for out of sequence P-codes elsewhere.

    A bit off topic, but another way to do the loop would be to use the Schedule program feature in the control with a Q value for the number of repeats.

  8. #8
    Join Date
    Apr 2013
    Posts
    18
    I'm pretty sure I did, but I'll try it again, and post the entire code he.
    I looked into schedule program but i had problems as i have to move the zero point with every loop. But i realy want to get the if, goto loop working.

  9. #9
    Join Date
    Apr 2006
    Posts
    822
    Well you can still use a schedule program to do what you want.
    Use a common variable in your program to count the number of parts machined.
    Then reference this at the start of the program to "move" the Zeroset position.

    Lathe program could be along these lines:

    N0001 G13
    N0002 P1
    N0003 IF [V1 GT V3] NEND (SAFETY PROGRAMMING TO MAKE PROGRAM JUMP TO END IF YOU KEEP PRESSING CYCLE START TOO MANY TIMES!)
    N0003 VZSHZ=V1*[-13.5]
    N0004 P10
    N0005 G00 X500 Z800
    N0006 G14
    N0007 P1
    N0008 VZSHZ=V1*[-13.5]
    N0009 P20
    N0010 G00 X300 Z400
    N0011 G50 S2500
    *
    *
    *
    Program as required
    *
    *
    *
    (End of Program Code, Used to count)
    G13
    V1=V1+1 (Total Parts Per Bar Counter)
    V2=V2+1 (Total Running Parts Counter)
    NEND M2

    The Schedule Program Could be along these lines:
    $BARFEED.SDF%
    N1 VSET V1=0 (RESET COUNTER FOR PARTS PER BAR)
    N2 PSELECT A.MIN
    N4 IF [V1 LE V3] N2
    N5 END

    Explanation:
    V1 Used to count the number of parts per bar in machine.
    V2 Used to count the TOTAL number of parts machined.
    V3 Used to set how many parts can be machined from the Bar before the bar is up to the chuck.
    VZSHZ is the Shift Amount on Z axis for either turret.

    By setting the variable V1 to zero at the start of the process and using the calculation VZSHZ=V1*[-13.5] you effectively are using a ZERO amount of Shift on Z axis.
    The value of -13.5mm in the example program is the distance you need to shift the Z axis along the bar to machine the next part. Change that value to what ever amount you need.
    Once you have machined the first part, your counter V1 now equals 1, so the equation VZSHZ=V1*[-13.5] will now produce a Z axis shift amount of 1*[-13.5] = -13.5mm
    Thus the machine will move the program along the Z axis towards the chuck by 13.5mm and because the program is the same on A and B turret, both turrets will be moved.
    The schedule program will reset the "bar" counter to Zero at the start of cycle.
    V2 is used purely to keep track of the total number of parts that have been machined.
    If you hit reset at any stage during machining, the Z axis shift amount is removed and the actual Z Zeroset amount will be at the first part position again.
    Using a method like this will get rid of you P code issues.
    There are other ways of running a program in the schedule file that will run the program multiple times such as PSELECT A.MIN,,,Qx where "x" is the number of times to repeat the program.
    This way is a little faster to execute as you are not waiting for the program to be selected each time.
    But I have generally found that operators can follow the logic above more easily and with less chance of making mistakes.
    Hope this long winded explanation helps.
    Regards
    Brian.

  10. #10
    Join Date
    Apr 2013
    Posts
    18
    Daimn broby.. Thats elegant!
    And I'm glad you took the time to add the V3 - safety counter. That could have seriously screwed me over
    I'll post when I've tried it out

    Thanks

Similar Threads

  1. Okuma OSP500L-G rs232 program load problems
    By Davidhaag in forum Okuma
    Replies: 22
    Last Post: 07-10-2020, 03:59 PM
  2. Replies: 13
    Last Post: 02-21-2011, 11:53 PM
  3. Okuma OSP500L program repeat?
    By mp- in forum Okuma
    Replies: 11
    Last Post: 11-13-2007, 02:17 PM
  4. okuma osp500l-g with sub-spindle
    By pp-TG in forum Okuma
    Replies: 1
    Last Post: 08-30-2007, 02:54 PM
  5. okuma OSP500L-G Control with sub-spindle
    By pp-TG in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 0
    Last Post: 06-18-2007, 11:20 PM

Posting Permissions

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