586,094 active members*
4,112 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Okuma > Sub programs and G50 on older OSP5000L green screen
Page 1 of 2 12
Results 1 to 20 of 23
  1. #1
    Join Date
    Mar 2010
    Posts
    17

    Sub programs and G50 on older OSP5000L green screen

    Hello all,

    I am trying to write a program that machines several small identical parts from one piece of stock sticking out of the chuck far enough to do so. I was hoping to write a main program that used G50 to set the Z zero then call a sub program to do the actual machining. Each additional part would use a G50 that set the Z zero in 1.0625 further. What I tried looked something like this.

    %
    G00 G90 G40 G50 S2000 M42
    G00 X20.0 Z20.0
    G50 Z0.0
    Call O0007
    G00 X20.0 Z20.0
    G50 Z1.0625
    Call O0007
    G00 X20.0 Z20.0
    G50 Z2.125
    Call O0007
    G00 X20.0 Z20.0
    G50 Z3.1875
    Call O0007
    G00 X20.0 Z20.0
    M5
    M9
    M30
    %

    Well it doesn't work. It runs the first program fine, but doesn't seem to advance the Z as I expect. What am I missing?


    I also tried to "schedule" a group of main programs to run in sequence....it also did not work. It kept alarming out on the command "Pselect". something about too many letters in the command and that there can be only 4. I was following the example in the manual so I'm not sure what I did wrong. That program look like this"

    G00 G90 G40 G50 S2000 M42
    PSELECT A.min, O0007
    PSELECT B.min, O0008
    PSELECT C.min, O0009
    PSELECT D.min, O0010
    G00 X20.0 Z20.0
    M5
    M9
    M30
    %

    Each of the programs referenced is a main program and has a G50 line to set Z zero. and I should mention that if I manually select a program and run it, they all work as expected, I just can get it to do it automatically

    Dan

  2. #2
    Join Date
    Dec 2008
    Posts
    29

    Sub programs and G50 on older OSP5000L green screen

    On the last line of the program when you return the turret back to G50 location try X20.0 W20.0 minus the part off amount in Z Turret will return in incremental.
    Be careful I am not an expert but it should work. Try without the stock first. and at the last part return full amount back to where it originally started from. X20.0 Z20.0
    Through the parts Z will read funny numbers
    But if the sub program is tested and parts are coming ok than who cares.
    You may need to change the sub program to be all in incremental, then it will cut the crrect part from whatever point it starts
    I'm shooting blanks here please take that into account.
    that's all I can think off.




    Sent from my iPhone using Tapatalk

  3. #3
    Join Date
    Jun 2015
    Posts
    4154

    Re: Sub programs and G50 on older OSP5000L green screen

    this forum :

    http://www.cnczone.com/forums/okuma/...ma-please.html

    code to autochange Z_zero @ post 4

    post 3 and 2 are introductive ... hope to work on your machine
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  4. #4
    Join Date
    Apr 2006
    Posts
    822

    Re: Sub programs and G50 on older OSP5000L green screen

    Hello,
    Here is the way I would program it.

    N100 G0 X20 Z20
    N102 IF [V1 GE [V2-1]] GOTO NEND (JUMP TO END OF PROGRAM IF QTY REACHED)
    N104 G50 S2000
    N106 G97 Sxxx M42 M3 M8
    N108 Xxxx Z0
    N110 VZSHZ=-[V1*1.0625] (SHIFT Z AXIS ZERO POINT BY THE DISTANCE REQUIRED)
    N112 .
    N114 .
    N116 .
    N118 machining program
    N120 .
    N122 .
    N124 .
    N126 V1=V1+1 (INCREMENT COUNTER)
    NEND G00 X20 Z20
    N128 M5 M9
    N130 M2

    You need to set your V1 (counter to 0 at the start of the bar.
    Set V2 to the number of items you wish to machine.
    The Zero Shift part works like this:
    On the first run of the program the shift amount is ZERO... i.e. 0 times anything is 0!
    on the 2nd and subsequent run the Shift Amount is calculated from the counter times the distance you want to shift.
    2nd run moves along a distance of 1*1.0625 i.e. the Z axis will move along by 1.0625" (NOTE that I have a - sign in front of the calculation to give a negative amount)
    3rd run will move 2*1.0625" = 2.125" and so on...
    When you have machined the required number of parts from the bar, the program will jump to the end if the operator keeps pressing the button by mistake!
    The reason for the [V2-1] in the check statement is that I am counting from ZERO not ONE.
    When you put in a new bar, reset V1 to Zero and away you go again.
    Obviously this program runs one part per cycle start.
    To run multiple parts you could put the program together like this:

    N100 G0 X20 Z20
    N102 IF [V1 GT V2] GOTO NEND (JUMP TO END OF PROGRAM IF QTY REACHED)
    N104 G50 S2000
    N106 G97 Sxxx M42 M3 M8
    N108 G0 Xxxx Z0
    N110 CALL O1000 Q=V2-1
    NEND G0 X20 Z20
    N112 M5 M9
    N114 M2

    O1000 (SUB PROGRAM FOR MACHINING THE SHAPE)
    N200 G0 Xxxx Z0
    N202 VZSHZ=-V1*1.0625 (SHIFT Z AXIS ZERO POINT BY THE DISTANCE REQUIRED)
    N204 .
    N206 .
    N208 .
    N210 machining program
    N212 .
    N214 .
    N216 .
    N218 V1=V1+1 (INCREMENT COUNTER)
    N220 G0 X20 Z20
    RTS

    Program is basically the same, just that the call to the subprogram is called a multiple of Q times.
    The Zero Shift part of the program still works the same way.

    The interesting info about using the VZSHZ Z axis shift amount is that the Z0 point is only shifted during the program execution.
    i.e. when the program finishes the Z0 point returns to the value you set when setting up the job.
    Hope this helps as well.
    Brian.

  5. #5
    Join Date
    Apr 2009
    Posts
    1262

    Re: Sub programs and G50 on older OSP5000L green screen

    Broby's example will work great. Use caution in that any shift (VZSHZ) will be gone in the event of a reset. His example uses the non-resetting common variable to calculate it, so it should work fine. In the event that you would need it to be more permanent, then use VZOFZ which is the zero set on your machine. It does not go away with reset.

    The problem that you are having with the SDF program is your format:

    PSELECT A.MIN,,,Q1
    PSELECT B.MIN,,,Q1
    END

    You really don't want any G-codes in your schedule program since it is only calling main programs that should contain all of your "running" code. You must have the 3 commas. They separate the MAIN, SECTION of main, SUB location, NUMBER OF REPETITIONS that the Schedule Program is able to call.

    Best regards,
    Experience is what you get just after you needed it.

  6. #6
    Join Date
    Jun 2015
    Posts
    4154

    Re: Sub programs and G50 on older OSP5000L green screen

    hy check this code how it works :

    - if you declare z_zero only once, not for every bar :
    .... input basic values:
    .........v1 - how many parts
    .........v3 - amount to change z_zero
    .........v6 - your constant z_zero
    .... program always starts from part one ( V2 =1 ); if by any reason you need to interrupt, and continue later, you may change V2 to the part to start; like this, you can continue a bar without needing to modify z_zero; also, if you forgot to declare V2=1 for the next bar, there is a M0 which raises whenever V2<>1, so it acts like a safety condition; even with V2 modified, V1 does not need to be modified
    .... if all is ok, you just change bars, and don't interfere within the program; it will stop when V1 will be reached;

    Code:
    V1=100    ( how many parts )
    V2=1      ( which part to begin with )
    V3=1.0625 ( length to machine afferent to one cycle / program / part )
    V6=...    ( z_zero ... always the same )
    
     ( * )
    
    CALL OCHK
    
    V2=V2-1
    VSZOZ=V6-V3*V2
    
    NHERE
      V2=V2+1
      CALL OPROG
      IF [ V2 EQ V1 ] NSKIP
      VSZOZ=VSZOZ-V3
    GOTO NHERE
    NSKIP
    M02
    
     ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
    
    OPROG
    
     ( program goes here )
    
    RTS
    
     ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
    
    OCHK
    
     IF [ V2 NE 1 ] GOTO N01
                    GOTO N03
     N01 M0 ( be sure not to crash )
     N03
    
    RTS
    - so far so good, but in reality, bars have different lenght, and maybe is hard to keep a constant z_zero; in this case :
    ... input bar, and initalize z_zero; program will read it and change it with each part just in case, there will be a backup for z_zero in the same soubroutine that comes up when V2 is not 1
    ... if you need to continue from a certain part, than :
    ....... only change V2 to desired part
    ..............or
    ....... leave V2=1 and change :
    ......... z_zero
    ......... V1 ( decrease number of total parts )
    ... thus, you need to change V1 when z_zero changes; this occurs when :
    ..... machining was interrupted after some parts have been crafted
    .........or
    ..... there are bars with different length, so parts/bar will vary

    if somehow a shorter bar is used, and V1 is not changed, than a crash may occur, so to avoid this, initalize V5 with the lower admisible value for z_origin; like this, if someone tries to craft more parts from a shorter bar, machine will stop when reaching a limit Z position

    this condition may lead to a trick, when using the program :
    ... declare V5 as real as possible, so to stay safe
    ... don't buther about V1; for example, declare V1=9999.9999

    .... if all is ok, you just change bars, and z_zero with every bar and don't interfere within the program, even if bars are not equal; it will stop always arround same phisical position

    Code:
    V1=99999    ( how many parts )
    V2=1      ( which part to begin with )
    V3=1.0625 ( length to machine afferent to one cycle / program / part )
    V5=...    ( lower admisible limit for z_zero ... always the same )
    
     ( * )
    
    CALL OCHK
    
    V2=V2-1
    VSZOZ=VSZOZ-V3*V2
    IF [ VSZOZ LE V5 ] NSKIP
    
    NHERE
      V2=V2+1
      CALL OPROG
      IF [ V2 EQ V1 ] NSKIP
      VSZOZ=VSZOZ-V3
    GOTO NHERE
    NSKIP
    M02
    
     ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
    
    OPROG
    
     ( program goes here )
    
    RTS
    
     ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
    
    OCHK
    
     IF [ V2 NE 1 ] GOTO N01
     IF [ V2 EQ 1 ] GOTO N02
    
     N01 M0 ( be sure not to crash )
         GOTO N03
    
     N02 V10=VSZOZ ( z_zero backup )
         GOTO N03
    
     N03
    
    RTS
    these examples don't just count, but handles particular cases often meet into practice :
    ... faster in cycle restart
    ... z_zero backup
    ... handles unequal bars
    ... stoping condition being not " how many parts have been crafted " but " don't crash "
    ... you may speed up initializing z_zero with each bar, by using G22 comand if it works

    i like the final one; let's dehot it, using CALL O... Q_times

    Code:
    V2=1      ( which part to begin with )
    V3=1.0625 ( length to machine afferent to one cycle / program / part )
    V5=...    ( lower admisible limit for z_zero ... always the same )
    
     ( * )
    
    CALL OCHK ( same as before )
    
    V2=V2-1
    VSZOZ=VSZOZ-V3*V2
    
    CALL OPROG Q99..999
    
    M02
    
     ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
    
    OPROG
    
      VSZOZ=VSZOZ-V3
      IF [ VSZOZ LE V5 ] NSKIP
      ( program goes here )
      NSKIP
    
    RTS
    shorter and safer and as mr Wizard said : main programs should contain all of your "running" code kindly !

    Quote Originally Posted by dansteinmetz View Post
    I also tried to "schedule" a group of main programs to run in sequence....
    it can be done also like this, but is not the case ... "schedule" is for a higher purpose, like ... hmm ... i would say " fried potatoes with cheese ", but i don't "schedule" that
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  7. #7
    Join Date
    Jun 2015
    Posts
    4154

    Re: Sub programs and G50 on older OSP5000L green screen

    Quote Originally Posted by deadlykitten View Post
    ... stoping condition being not " how many parts have been crafted " but " don't crash "
    this is about perspective ... when you go one bar after another, you desire to cut "n_bars", so to deliver "n_bars x q_parts"

    q_parts is just a small drop, is not required as a data input into your pogram; so :
    ... using a stop condition like " don't crash ", seems more natural; also gives you a safety feeling
    ... if there are a lot of bars, than may be needed a counter

    going with a constant value, like q_parts/bar, means that bars are all the same ... program should not be sensitive to this otherwise, there is required extra-caution when an "atypical" bar shows in
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  8. #8
    Join Date
    Apr 2006
    Posts
    822

    Re: Sub programs and G50 on older OSP5000L green screen

    Wow, you certainly know how to turn a simple question into a long dissertation of complexity.
    as long as it works... well I guess it is good.
    Maintaining your solution would be an interesting test of memory.
    The solution I have put up is but one solution. Not saying that it is the best or the worst.
    Mr Wizard says that the zero shift value will disappear if a reset occurs... this is absolutely true, it does, but if you do do a restart, the program will update the zero shift amount again anyway as soon as the code is scanned.
    I have used this approach for many years on parts that are machined and then parted off.
    The simple test to check for odd bar lengths was to have a "standard" length bar sitting on the bench and compare each new bar to that before placing in machine (that is if you don't know how to read a measuring tool) and "operators" may not be that experienced and are just button pushers only.

  9. #9
    Join Date
    Jun 2015
    Posts
    4154

    Re: Sub programs and G50 on older OSP5000L green screen

    Quote Originally Posted by broby View Post
    Maintaining your solution would be an interesting test of memory
    why ?
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  10. #10
    Join Date
    Apr 2006
    Posts
    822

    Re: Sub programs and G50 on older OSP5000L green screen

    Why? Because your explanations are so involved... to the point where I don't read all through them.
    Documentation... hate it but have to have it

  11. #11
    Join Date
    Jun 2015
    Posts
    4154

    Re: Sub programs and G50 on older OSP5000L green screen

    Quote Originally Posted by broby View Post
    Maintaining your solution would be an interesting test of memory
    how code works with " V5 = lower admisible limit for z_zero ", than this requires a specific value for each machine

    by so, if program runs on 2 identical machines, than V5 will have different values, because of encoder " stroke limits "

    identical machines should have same travels, while limits are different, thus :

    " Z_plus_limit_cnc1 - Z_minus_limit_cnc1 = Z_plus_limit_cnc2 - Z_minus_limit_cnc2 ", while " Z_plus_limit_cnc1 <> Z_plus_limit_cnc2 "

    this means that V5 must be changed if program will be moved to another machine

    i must admit that i started thinking about this after your reply ... V5 modification may be eliminated with this code, so to be able to move the program between identical machines, without changing it :

    Code:
    V2=1      ( which part to begin with )
    V3=1.0625 ( length to machine afferent to one cycle / program / part )
     ( * )
    V5=V180+V3    ( lower admisible limit for z_zero ... always the same )
    like this, variables left for input are :
    ... part length
    ... part to begin with

    the " V180 " should be defined on each machine as " encoder_Z_in_front_of_chuck + 10 ", and avoid using V180 for other purposes

    i have a " variables association map "; like this, i know, for example, that i must not modify variables from V150 to V200

    actually, for custom functions, i would like to avoid commone variables, and use other names, but i do not know exactly what conditions i must respect to use a " custom_name_variable "; for example, for this case, it would be great to use not "V180", but " encoder_Z_in_front_of_chuck "; is there something like " V.... ", max 5 chars ?
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  12. #12
    Join Date
    Apr 2006
    Posts
    822

    Re: Sub programs and G50 on older OSP5000L green screen

    Please keep in mind that the machine the original poster is referring to is a VERY OLD model.
    V180?? On the early models they only had 32 common variables to use.
    Seems like you are adding in a whole lot of work to make the program compatible with a bunch of different machines.
    Not the requirement that was asked for in the first place, so your answer just clouds the issue.
    the simple solution I put up DOES answer the question... followed by the Wiz's clarification on the PSELECT command.
    You need to remember that what is available on the later machines is not necessarily available on earlier models.
    K.I.S.S. Principle needs applying to your answers.

  13. #13
    Join Date
    Jun 2015
    Posts
    4154

    Re: Sub programs and G50 on older OSP5000L green screen

    my 1st answer in this thread is simple enough
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  14. #14
    Join Date
    Apr 2006
    Posts
    822

    Re: Sub programs and G50 on older OSP5000L green screen

    Quote Originally Posted by deadlykitten View Post
    my 1st answer in this thread is simple enough
    The problem I see with that answer is that you are changing the ZEROSET of the program.
    i.e. when a new part is put in, you then need to change the ZEROSET to start off a new bar.
    With changing the Zero SHIFT value, this does not happen.
    i.e. much safer and easier to use.

  15. #15
    Join Date
    Jun 2015
    Posts
    4154

    Re: Sub programs and G50 on older OSP5000L green screen

    Quote Originally Posted by broby View Post
    The problem I see with that answer is that you are changing the ZEROSET of the program.
    i.e. when a new part is put in, you then need to change the ZEROSET to start off a new bar.
    at programs end, z_zero is reinitialized " VSZOZ=... ( constant value ) ", so there is no intervention

    Quote Originally Posted by broby View Post
    When you put in a new bar, reset V1 to Zero and away you go again.
    i eliminate variable reseting , so there is no intervention
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  16. #16
    Join Date
    Apr 2009
    Posts
    1262

    Re: Sub programs and G50 on older OSP5000L green screen

    VSZOZ doesn't even exist on his machine...

    It's a 5000 green screen...about 1984 vintage I would guess. Your answer will only work with the P300. It will not work on ANYTHING older.
    Experience is what you get just after you needed it.

  17. #17
    Join Date
    Apr 2006
    Posts
    822

    Re: Sub programs and G50 on older OSP5000L green screen

    Quote Originally Posted by OkumaWiz View Post
    VSZOZ doesn't even exist on his machine...

    It's a 5000 green screen...about 1984 vintage I would guess. Your answer will only work with the P300. It will not work on ANYTHING older.
    Which confirms my statement in post #12!

    You, Kitty Cat, seem to forget to look at the model of the controller when firing off your lengthy replies... the fancy stuff you can do on P300 controllers is way more than what the earlier models can do.
    I KNOW my solution will work because it has been, and continues to be used on the older systems we have here. (we only just received a P300 controller yesterday in the form of a LB35III lathe).

  18. #18
    Join Date
    Jun 2015
    Posts
    4154

    Re: Sub programs and G50 on older OSP5000L green screen

    well, i guess i will buy a p5000 if VAPAZ is not missing, then it might be a chance
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  19. #19
    Join Date
    Apr 2006
    Posts
    822

    Re: Sub programs and G50 on older OSP5000L green screen

    Quote Originally Posted by deadlykitten View Post
    well, i guess i will buy a p5000 if VAPAZ is not missing, then it might be a chance
    Now you are just being a dick...

  20. #20
    Join Date
    Jun 2015
    Posts
    4154

    Re: Sub programs and G50 on older OSP5000L green screen

    well, i must do my best to avoid giving wrong solutions my gf has a lot of money, but i don't buy fast cars ... i buy cnc's

    if VAPAZ works on p5000, than my code may be converted to work on that machine
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

Page 1 of 2 12

Similar Threads

  1. Replies: 19
    Last Post: 06-04-2019, 07:43 AM
  2. OSP5000L Green Screen Parts Counter
    By nlh in forum Okuma
    Replies: 3
    Last Post: 06-06-2014, 04:52 PM
  3. BTR for Okuma OSP5000L (green screen)
    By bradleyk in forum DNC Problems and Solutions
    Replies: 1
    Last Post: 10-29-2008, 06:10 AM
  4. Replies: 0
    Last Post: 10-13-2008, 03:53 PM
  5. OSP5000L (green screen) RS232
    By bradleyk in forum Okuma
    Replies: 15
    Last Post: 03-13-2008, 03:27 PM

Tags for this Thread

Posting Permissions

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