do while loops in series


Results 1 to 6 of 6

Thread: do while loops in series

  1. #1
    Member
    Join Date
    Jul 2014
    Posts
    221
    Downloads
    0
    Uploads
    0

    Default do while loops in series

    I want my program to check for a condition
    While[condition true] DO1
    something.....
    END1

    then I want it to check another
    condition

    While [condition 2 true] DO1
    something...
    END1


    but when I program it like that, 2 while loops in series it checks only one and then stops program

    Similar Threads:


  2. #2
    Member
    Join Date
    Feb 2011
    Location
    usa
    Posts
    353
    Downloads
    2
    Uploads
    0

    Default Re: do while loops in series

    can you post the program so we can look at it
    rcs60



  3. #3
    Member
    Join Date
    Jul 2014
    Posts
    221
    Downloads
    0
    Uploads
    0

    Default Re: do while loops in series

    no because i deleted it because it didnt work but it was something like this:

    WHILE [#101 EQ 1] DO1;
    X0;
    Y100;
    X60;
    Y0;
    X0;
    END1;
    WHILE [#101 EQ 2] DO1;
    X100;
    Y60;
    X00;
    Y0;
    END1;



  4. #4
    Registered Mhoppe's Avatar
    Join Date
    Oct 2014
    Location
    USA
    Posts
    35
    Downloads
    0
    Uploads
    0

    Default Re: do while loops in series

    Quote Originally Posted by allenp View Post
    no because i deleted it because it didnt work but it was something like this:

    WHILE [#101 EQ 1] DO1;
    X0;
    Y100;
    X60;
    Y0;
    X0;
    END1;
    WHILE [#101 EQ 2] DO1;
    X100;
    Y60;
    X00;
    Y0;
    END1;
    The way you have the logic written there will not work. That is potentially an infinite loop. You need to add code to modify #101 at some point. What are you attempting to accomplish? Some type of warmup routine?

    Last edited by Mhoppe; 04-06-2015 at 04:27 PM.


  5. #5
    Member
    Join Date
    Jul 2014
    Posts
    221
    Downloads
    0
    Uploads
    0

    Default Re: do while loops in series

    yes of course, I've forgotten about it, I added #101=0 before END1.
    WHILE [#101 EQ 1] DO1;
    X0;
    Y100;
    X60;
    Y0;
    X0;
    #101=0;
    END1;
    WHILE [#101 EQ 2] DO1;
    X100;
    Y60;
    X00;
    Y0;
    #101=0;
    END1;
    M99

    I set #101 manually before program starts then it should go to either loop 1 or loop 2 depending on value of #101 then it ends loop and goes to m99 repeats the whole procedure L number of times.

    It works for my first while do loop but if i set #101 to 2 then it wont work.
    why?



  6. #6
    Member
    Join Date
    Feb 2013
    Location
    USA
    Posts
    21
    Downloads
    0
    Uploads
    0

    Default Re: do while loops in series

    Quote Originally Posted by allenp View Post
    yes of course, I've forgotten about it, I added #101=0 before END1.
    WHILE [#101 EQ 1] DO1;
    X0;
    Y100;
    X60;
    Y0;
    X0;
    #101=0;
    END1;
    WHILE [#101 EQ 2] DO1;
    X100;
    Y60;
    X00;
    Y0;
    #101=0;
    END1;
    M99

    I set #101 manually before program starts then it should go to either loop 1 or loop 2 depending on value of #101 then it ends loop and goes to m99 repeats the whole procedure L number of times.

    It works for my first while do loop but if i set #101 to 2 then it wont work.
    why?
    Not exactly sure what your trying to accomplish but it sounds like you would be better off using an IF/GOTO statement. Something like:

    IF[#101EQ1]GOTO100
    IF[#101EQ2]GOTO200

    N100;
    X0;
    Y100;
    X60;
    Y0;
    X0;
    GOTO300
    N200;
    X100;
    Y60;
    X00;
    Y0;
    N300
    #101=0
    M99



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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

do while loops in series

do while loops in series