603,968 active members*
2,894 visitors online*
Register for free
Login
Results 1 to 16 of 16
  1. #1
    Join Date
    Jun 2008
    Posts
    262

    LOOPING? with Camsoft??

    Okay, I've had progress. Nobody got squshed in the runaways and the tool it threw at me missed (bad programming on that knuckleball).

    I had a Bandit. It could loop subs etc. I have an Anilam which does as well.

    I have to either, run a subroutine, or loop back in the program a counted number of times.

    I don't see in the literature how this works in Camsoft.

    Any ideas?

    Hey ! Everyone ! Thanks for the help. I can move the machine now. Camsoft sent me 6.4 because it has better logfile info but I have scarily quiet people around me and must go for now with what I've got.

    nelZ
    i build the braces that keep american teeth straight......tick tick tick

  2. #2
    Join Date
    Mar 2003
    Posts
    4826
    Are you running CNCLite, or what package?

    Look in the manual for help on the JUMP command and GOSUB command. Those respective commands are typically used in an M97 and M98 code respectively, and the call is made in Fanuc fashion:
    M97 N_ _ _ R_ _ _
    where N is the line number for the start of the sub and R is the repeats. However, in Camsoft, those letters could possibly be altered to other alphabetic characters, depending on what you want.

    M99 ends the sub and returns to the main program.
    Check the RETURN command for help on this.
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  3. #3
    Join Date
    Jun 2008
    Posts
    262
    There is no GOSUB in the manual for Lite and Plus.

    On page 5-27 it has JUMP listed. It does not seem to work in the following.

    N1 G0X1Y1Z-1
    N2 X0Y0Z0
    N3 JUMP N1

    I'm in MDI when I try. It just does N1, N2 then stops without changing to the "RED Light".

    The book says M98 only comes with the "plus" package.

    nelZ
    i build the braces that keep american teeth straight......tick tick tick

  4. #4
    Join Date
    Mar 2003
    Posts
    4826
    You cannot use the Camsoft Logic commands directly in the gcode window. They would have to be incorporated into the particular Mcode or Gcode.

    I don't recall if it was possible to add some code to the mcodes in CNCLite. You could always try it and see, I guess.

    Take the precaution of not creating a never ending logic loop. You should not reference a line number that occurs before the sub call itself. The sub line number should be unique, and the code for the sub should be placed after the M30 in your program.

    Main program
    code, blah, blah;
    M97 N1000 R1;
    some more gcode in main program;
    M30;
    N1000 (place code for sub after this);
    M99 (end sub, return to main program);

    Edit: note: you'll have to come up with the correct characters to possibly replace N and R if your version uses something different.
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  5. #5
    Join Date
    Jun 2008
    Posts
    262
    JUMP
    This command enables the user to jump or switch the execution of the G-code program to a specified G-code line that contains a match for the parameter after the JUMP command. The parameter may be a line number, an axis position, etc of any identical match that can be found in a G-code line. etc.

    You're most likely correct but the above highlights the confusing nature of the manual layouts.

    Thanks,
    nelZ
    i build the braces that keep american teeth straight......tick tick tick

  6. #6
    Join Date
    Mar 2003
    Posts
    4826
    I have a very old CNC Lite manual, and it does indicate that you must have a "Bonus Pac" installed to use M98. The question is called: "How do we call Subroutines". The code format is laid out for you in the answer, so I would think you must stick with their variable names "P" which references a subroutine that starts with "O" (the letter not the number) and that repeats would be: "L" and not "R".

    I believe that the way they have written it, the sub program call is actually a subroutine call, as it must still follow the main program M30 as I pointed out above. In a 'real' cnc, a sub program exists elsewhere in memory, but in Camsoft, it would have to be retrieved by calling it with the correct windows path.
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  7. #7
    Join Date
    Mar 2004
    Posts
    1527
    You found,IMHO, the greatest weakness in Camsoft. It doesn't do parametric programming. I wrote a number of special M codes as a work around for looping in Gcode. Here's a clip, the message statements explain how to set up your Gcode to loop.


    MESSAGE
    MESSAGE To use M93 put statement
    MESSAGE {LOOPM93=5} <on its own line>
    MESSAGE N100 <space after this and on its own line>
    MESSAGE <lines of code>
    MESSAGE M93 N100
    MESSAGE the 5 can be any number
    MESSAGE the 100 can be any number
    MESSAGE
    \93=1
    LOADING \55:IF\55=0THENEXIT
    {LOOPM93=LOOPM93-1}
    IF{LOOPM93}>0THENJUMP Nn
    -----M93

    MESSAGE
    MESSAGE To use M94 put statement
    MESSAGE {LOOPM94=5} <on its own line>
    MESSAGE N200 <space after this and on its own line>
    MESSAGE <lines of code>
    MESSAGE M94 N200
    MESSAGE the 5 can be any number
    MESSAGE the 200 can be any number
    MESSAGE
    \93=1
    LOADING \55:IF\55=0THENEXIT
    {LOOPM94=LOOPM94-1}
    IF{LOOPM94}>0THENJUMP Nn
    -----M94

    MESSAGE
    MESSAGE To use M95 put statement
    MESSAGE {LOOPM95=5} <on its own line>
    MESSAGE N300 <space after this and on its own line>
    MESSAGE <lines of code>
    MESSAGE M95 N300
    MESSAGE the 5 can be any number
    MESSAGE the 300 can be any number
    MESSAGE
    \93=1
    LOADING \55:IF\55=0THENEXIT
    {LOOPM95=LOOPM95-1}
    IF{LOOPM95}>0THENJUMP Nn
    -----M95

    MESSAGE
    MESSAGE To use M96 put statement
    MESSAGE {LOOPM96=5} <on its own line>
    MESSAGE N400 <space after this and on its own line>
    MESSAGE <lines of code>
    MESSAGE M96 N100
    MESSAGE the 5 can be any number
    MESSAGE the 400 can be any number
    MESSAGE
    \93=1
    LOADING \55:IF\55=0THENEXIT
    {LOOPM96=LOOPM96-1}
    IF{LOOPM96}>0THENJUMP Nn
    -----M96

    JUMP Nn 'to use write M98 N100 to goto N100, ENDLESS LOOP!!
    -----M97

  8. #8
    Join Date
    Apr 2003
    Posts
    332
    Karl, that was a clever use of IF THEN JUMP to make multiple jumping loops in multiple M codes

    And there's even more methods to do parametric programming and looping, depending if someone has the Lite,Plus or Professional versions.

    First check the CamSoft Corporation Feature Comparison Chart for your version under the titles of:

    Parametric logic language for conditional routines: User prompting
    IF THEN statements to direct program flow & Advanced Math
    Parametric splines, NURBS & 3D offsets a 3D splined profile
    M98 and subroutine calls and return

    In the manual under the title:
    Example of macro variables used in G code program
    Notice the parameters at the top of the G code file example

    Page 8-59 for CNC Professional
    Page 8-25 for CNC Lite/Plus

    Under the Logic Command section see:

    REWIND
    GOTO
    JUMP
    IF THEN
    ISTHERE
    MIDPROGRAM
    GOSUB / RETURN which are the logic equivalents to:

    M98 L# P#
    L#=number of loops
    P#=program number or line number

    The logic commands can be called from G or M codes to customize the system to taste.


    Tech Support
    CamSoft Corp.
    [email protected]
    PH 951-674-8100
    Fax 951-674-3110
    www.cnccontrols.com
    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  9. #9
    Join Date
    Jun 2008
    Posts
    262
    Thanks Karl!

    Your clip of code stops before M98 & M99 (sub call and return?). I don't know what M93 thru M97 are for.

    nelZ
    i build the braces that keep american teeth straight......tick tick tick

  10. #10
    Join Date
    Jun 2008
    Posts
    262
    Karl,

    In each of your M codes you set /93=1. What is this variable? Don't all those M codes do the same thing?



    Camsoft, is there a variable list somewhere in my literature?

    Thanks to one and all.

    nelZ
    i build the braces that keep american teeth straight......tick tick tick

  11. #11
    Join Date
    Apr 2003
    Posts
    332
    nelZ,

    Yes, there are 2 buttons on the face of the main SETUP screen called
    Variable Descriptions and Variable Search
    The descriptions are user defined.


    Tech Support
    CamSoft Corp.
    [email protected]
    PH 951-674-8100
    Fax 951-674-3110
    www.cnccontrols.com
    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  12. #12
    Join Date
    Jun 2008
    Posts
    262
    Thanks Camsoft. It detects when I use a new variable.

    Karl, the LOADING command saves the program state to the variable \55

    my book describes only values of 1,2,3,4,5 and 6

    your routine EXITs when it is 0

    Camsoft, is a 0 to mean the program is being loaded?
    i build the braces that keep american teeth straight......tick tick tick

  13. #13
    Join Date
    Apr 2003
    Posts
    332
    nelZ,

    Karl is writing for the Professional version so there are some minor differences in parameters. For instance there is not a 0 parameter needed or used in CNC Lite for the LOADING command. You can omit the entire line with the LOADING command and IF THEN statement that checks variable \55 for a 0.

    It's not needed in CNC Lite because it runs G&M code traditionally from top to bottom like any control does. CNC Professional is different because it makes a one time pass though the whole G&M program while loading to break down (parse and compile) the G&M code program into a higher more efficient compiled state that executes faster while cutting plus checks for errors and sets up internal flags in memory noting feature usage.

    The test Karl made using the LOADING command with parameter 0 does not apply to CNC Lite because CNC Lite does not make a initial pass through the program. Karl used the LOADING and EXIT commands to skip the looping while the program would of been loaded into memory in CNC Pro.


    Tech Support
    CamSoft Corp.
    [email protected]
    PH 951-674-8100
    Fax 951-674-3110
    www.cnccontrols.com
    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  14. #14
    Join Date
    Mar 2004
    Posts
    1527
    Quote Originally Posted by nelZ View Post
    Thanks Karl!

    Your clip of code stops before M98 & M99 (sub call and return?). I don't know what M93 thru M97 are for.

    nelZ
    My M98 and M99 are what came with your .cbk:
    GOSUB Np;l
    -----M98
    RETURN
    -----M99

    M93 thru M97 are custom Mcodes i wrote. Copy them into your Mcode.fil then run these Gcode programs:
    G0 X0 Y0
    {LOOPM96=5}
    N400 X1
    X0
    M96 N400


    The machine will go back and forth five times.

    G0 X0 Y0
    {LOOPM95=2}
    N300 'need a space here or it will bug
    {LOOPM96=5}
    N400 X1
    X0
    M96 N400
    Y1
    M95 N300

    the machine will go back and forth 5 times, move to Y1, and then go back and forth five more times.

    Karl

  15. #15
    Join Date
    Jun 2008
    Posts
    262
    Alright then, is it possible to do any sort of loop in Camsoft lite?
    i build the braces that keep american teeth straight......tick tick tick

  16. #16
    Join Date
    Apr 2003
    Posts
    332
    Yes, you can use what Karl wrote if you leave out the whole line with LOADING and then place a ! on each logic line.

    He wrote multiple M codes for nested looping. All you need is one of them to work.

    Out of the earlier suggestion these work in CNC Lite:

    In the manual under the title:
    Example of macro variables used in G code program
    Notice the parameters at the top of the G code file example

    Page 8-25 for CNC Lite/Plus

    To better understand what Karl wrote review or make your own looping routine see these Logic Commands:

    REWIND
    GOTO
    JUMP
    IF THEN
    ISTHERE

    The logic commands can be called from G or M codes to customize the system to taste.
    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

Similar Threads

  1. Fanuc O-T looping cycle
    By Billet Sean in forum MetalWork Discussion
    Replies: 5
    Last Post: 04-28-2008, 08:11 PM
  2. Program Looping
    By Bohemund in forum CamSoft Products
    Replies: 7
    Last Post: 05-26-2007, 05:08 PM
  3. Sub Looping
    By murphyspost in forum Daewoo/Doosan
    Replies: 8
    Last Post: 12-27-2006, 05:28 PM
  4. E-Stop Looping Errors in CamSoft
    By DA Dave in forum CamSoft Products
    Replies: 1
    Last Post: 05-17-2006, 06:05 PM
  5. Cutting at multiple depths.. looping ??
    By esmiller in forum Mach Software (ArtSoft software)
    Replies: 9
    Last Post: 01-31-2006, 12:48 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
  •