587,036 active members*
2,941 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Okuma > calling subprograms on osp-100
Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2005
    Posts
    26

    Question calling subprograms on osp-100

    how do i call a subprogram on this freak of a controller? All I want to do is turn my second postition program to a subprogram and call it up at the end of my first postion, but I constantly get errors. Ie. Subprogram doesnt exist and another one about M02 being in the wrong spot or not existing can't remember which. Please help.

  2. #2
    Join Date
    Mar 2006
    Posts
    45
    Freak of a controller? They are all pretty easy once you learn the dialects.

    Here's what I do on my E100L. Inside the MIN file:

    ...
    CALL OBSET (B TURRET OFFSET CONFIG)
    ...
    M02 (PROGRAM END)
    (IN THE SAME FILE AFTER M02)
    (--------<MACHINE OFFSETS: B TURRET>--------)
    OBSET
    G140
    VZSHX=0
    VZSHY=0
    VZSHZ=0
    VZSHC=0
    G50 S3800
    VZOFZ=V198+[V187+V186*V190]+[V185-V184]
    G141
    VZSHX=0
    VZSHY=0
    VZSHZ=0
    VZSHC=0
    G50 S5000
    VZOFZ=V197-[V187+V186*V189]-[V183-V182]
    G140
    RTS (THIS SAYS END OF SUBROUTINE)

    ... next sub

    Sub names must start with an "O". If the second characters is a number the remaining 3 or less characters must be numbers, no letters. If the second digit is alphabetic the remaining characters can be numbers or letters.

    The sub's can also be contained in a .sub or .ssb or .lib but you have to look at how to format your program select when you do. More advanced subject than you need here I suspect.

    You can also pass arguments as temporary variables (as opposed to using a machine register). I suggest you read the book on this as it is a very powerful programming tool. From what I can tell this is what really makes Okuma macro different than the others.

    Kev

  3. #3
    Join Date
    Dec 2008
    Posts
    3122
    To add to Kev's post

    Basic subs - placed at end of a running program
    - The CALL statement must be followed by a space
    - The sub being CALLed must start with letter O, with a maximun of 4 letters/numbers following the O ---OO cannot be used, this is system reserved
    - The sub is placed after the M02/M30 line, & must be in a downward search pattern, ie - the sub being called cannot be defined above the CALL statement ( in the program )
    - There is a mximum size allowed for each sub, it is possible to break up a sub into smaller subs & use CALL statements to join together
    - Maximum of 32 sub definitions permitted
    - The % ( if used for file transfer ) is placed at the end of the program

  4. #4
    Join Date
    Sep 2005
    Posts
    26
    I have decided to attach a file to show you what I am getting. Superman - If I put the call after the M02 it doesn't read it. I could write a book after the M02 and the control could care less. The exact call commands I have tried are as follows:

    CALL O222
    CALL O222.SUB
    CALL 0222
    CALL 0222.SUB
    CALL O222 Q1
    CALL O222.SUB Q1

    I am putting them right before the M02.
    Attached Thumbnails Attached Thumbnails 2011-11-02_14-03-14_118.jpg  

  5. #5
    Join Date
    Dec 2008
    Posts
    3122
    Quote Originally Posted by horst007 View Post
    I have decided to attach a file to show you what I am getting. Superman - If I put the call after the M02 it doesn't read it. I could write a book after the M02 and the control could care less. The exact call commands I have tried are as follows:

    CALL O222
    CALL O222.SUB
    CALL 0222
    CALL 0222.SUB
    CALL O222 Q1
    CALL O222.SUB Q1

    I am putting them right before the M02.
    No, all subs are to go after the M2 or M30, then they are parse / checked into RAM

    Your first CALL statement is correct, it is searching for the sub.
    It is the definition of the sub it is erroring on
    NOTE---subs do also have a maximum size, overcome by breaking into smaller subs

    ie
    N99 ...main body
    N100 CALL O222 Q2
    N101 ...
    N102 ...
    ...
    M2
    () <--- I use these just to sepeate the subs
    O222 ( SUB #222 ) <--- name of the sub, comments do work here (I put the T# to show what tool is using it )
    your sub body
    RTS <--- to end the sub, & return to continue with N101
    ()
    %

  6. #6
    Join Date
    Oct 2010
    Posts
    103
    I have OSP700 but would assume subprogram use to be the same. I'd first ask you if you use the program name in the actual sub file. Your "O222.SUB" is just the file name, not the program name. When you open the file to edit, you should have:

    O222
    ......
    ......
    ......
    ......
    RTS

    To add to that, you can have several programs in 1 file. I use several G-code macros, and they are in one file. I use a library type file for this so it is always brought up at start.

    The file name is "OGMAC.LIB"......this is only a file name, not a program name

    Opening this file will show.........

    OG111 <-- this is a program name
    .....
    .....
    ...
    ...
    ...
    RTS
    OG112 <-- this is a program name
    ...
    ...
    ...
    ...
    ...
    RTS
    OG113 <-- this is a program name
    ...
    ...
    ...
    RTS

    (and so on)

    Secondly, if you are calling a sub from a seperate file, the sub needs to be registered in the library. If your sub is specific to 1 main program, there is no reason to make a seperate subprogram file.

    Put the subprogram after the main program in the same file. File name can be up to 8 characters and does not need to start with O, but must start with a letter I think.

    Program name... (YOURFILE)

    inside........

    OMAIN <-- main file name
    ....
    ...
    ......
    CALL O222
    ....
    ..
    ....
    CALL O222
    ....
    ..
    ....
    M2

    O222 <-- subprogram
    ....
    ..
    ....
    ..
    RTS

    For program specific subs, I put the subs in the same file as above. You can also have multiple main programs and subprograms all in the same.

    such as....

    OPRT1
    ...
    CALL O222
    ...
    M2
    OPRT2
    ...
    CALL O222
    ...
    CALL O223
    ...
    M2
    O222
    ...
    RTS
    O223
    ...
    RTS

    On my control, when I pull up a file with multiple mains, I select the file, put comma and then main program name... MAINFILE.MIN,OPART

    don't know if any of this will help you

  7. #7
    Join Date
    Mar 2009
    Posts
    1982
    very useful explanation.
    Would be very nice to have description how to register macros and subprograms to library and how to load library on CNC start

  8. #8
    Join Date
    Aug 2011
    Posts
    2517
    Quote Originally Posted by annoying View Post
    File name can be up to 8 characters and does not need to start with O, but must start with a letter I think.
    Yeah this is quite annoying. We have around 50 CNC machines and do the same parts on whichever machine is free at that time. The program number is listed on the job sheet that comes with the job (we have close to 50000 programs but at least half of those are machine-specific and only available on certain machines). We keep all the programs for each machine in separate directories since most programs have some machine-specific code but we wanted to keep the program numbers the same across all machines for that same part & operation so our job sheets don't need to have 50 machines listed and which program number is used. It works quite well like this as Fanuc programs only use numbers (no letters allowed) but Okuma programs must start with a letter, it won't allow a number-only program name so we need to add a special entry for the Okuma on our job sheets so the operator knows which program to download from our automated PC file server.

    I don't suppose anyone knows if this can be set somehow to accept number-only program names? A parameter maybe?

  9. #9
    Join Date
    Mar 2009
    Posts
    1982
    simple database (excel table) can help to handle that - program definition with program names listed for each mahine.
    There is no way to start program name with number on Okuma. File name can be, suppose

Similar Threads

  1. Subprograms Subroutines Help
    By gibbsmaster in forum EdgeCam
    Replies: 6
    Last Post: 12-23-2012, 12:29 AM
  2. Running subprograms from hdd
    By dtmtim in forum Haas Mills
    Replies: 18
    Last Post: 11-23-2010, 04:12 AM
  3. subprograms
    By cnc@gci in forum Mastercam
    Replies: 4
    Last Post: 06-19-2009, 02:42 PM
  4. does camware have a 'where used' for subprograms?
    By inflateable in forum Mazak, Mitsubishi, Mazatrol
    Replies: 3
    Last Post: 07-09-2008, 11:26 AM
  5. M97 Internal Subprograms?????
    By CAMCRASH in forum G-Code Programing
    Replies: 6
    Last Post: 03-24-2005, 07:10 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
  •