A small quirk with Mcode setup..


Results 1 to 4 of 4

Thread: A small quirk with Mcode setup..

  1. #1
    Registered
    Join Date
    Nov 2004
    Location
    USA
    Posts
    446
    Downloads
    0
    Uploads
    0

    Default A small quirk with Mcode setup..

    I have this code for a button. Its under an Mcode.

    The problem I am having is that clicking on EXIT MENU does not always exit the listsetup.. Its actually a 50/50 thing.. Sometimes it exits on the first click, sometimes I have to click it 2 or 3 times to get the menu to exit.
    I tried entering the exit coding (red) in different locations but nothing seems to make a difference.
    Any ideas?

    !\8=0
    !:UPDATE1
    !IF \81=0 THEN \9=FREE
    !IF \81=2 THEN \9=BUSY
    !IF \8=EXIT MENU THEN EXIT
    !LISTCLEAR: LISTSETUP 20;5625;2000;2000 :LISTADD STAGE 1 STATUS :LISTADD EXIT MENU :LISTADD TIME LEFT \31 :LISTADD STATUS \9 :LISTADD DWELL \151 :LISTADD DRIP \171 :LISTPICK \8
    !IF \8=EXIT MENU THEN EXIT
    !SLEEP .25
    !IF \8=EXIT MENU THEN EXIT
    !IF \8=0 THEN GOTO :UPDATE1
    -----M1

    Similar Threads:


  2. #2
    Registered
    Join Date
    Sep 2003
    Location
    ADDISON, Illinois
    Posts
    17
    Downloads
    0
    Uploads
    0

    Default

    Murphy,

    I got the answer. Next time iam charging

    Simpler was the answer. It was stuck in a loop. I removed all the GOTO and loop logic and the end result is that variable \8 from LISTPICK will be updated correctly even after it finishes. No need to go around in a IF THEN GOTO loop.

    !IF \81=0 THEN \9=FREE
    !IF \81=2 THEN \9=BUSY
    !LISTCLEAR: LISTSETUP 20;5625;2000;2000 :LISTADD STAGE 1 STATUS :LISTADD EXIT MENU :LISTADD TIME LEFT \31 :LISTADD STATUS \9 :LISTADD DWELL \151 :LISTADD DRIP \171 :LISTPICK \8

    The LISTPICK command still works great without the you keep checking and reissuing it over. The simplicity of LISTPICK is it will stay active on the screen forever, even if you go do other things, run other logic and come back hours later , LISTPICK seems as if its waiting for you running in the background ready to store your PICK to variable \8.

    I also separated the commands on separated lines so it reads cleaner.

    !IF \81=0 THEN \9=FREE
    !IF \81=2 THEN \9=BUSY
    !LISTCLEAR
    !LISTSETUP 20;5625;2000;2000
    !LISTADD STAGE 1 STATUS
    !LISTADD EXIT MENU
    !LISTADD TIME LEFT \31
    !LISTADD STATUS \9
    !LISTADD DWELL \151
    !LISTADD DRIP \171
    !LISTPICK \8

    Jim C.



  3. #3
    Registered
    Join Date
    Nov 2004
    Location
    USA
    Posts
    446
    Downloads
    0
    Uploads
    0

    Default

    Jim,
    Thanks for the help!!! But it doesnt work

    The menu shows up correctly and displays the values of the variables but the variables do not update. I have to click the button to execute the Mcode to get it to update. One of the variables (\31) is driven by the timer.fil and counts down. I want to be able to watch it count down when the list is open.
    My version, the loop I had going was continuously re-running the mcode for me as if I was clicking on it myself. The problem is that exiting that loop was a 50/50 shot when you clicked on EXIT MENU.

    Any other ideas??
    Murphy



  4. #4
    Registered
    Join Date
    Sep 2003
    Location
    ADDISON, Illinois
    Posts
    17
    Downloads
    0
    Uploads
    0

    Default

    Yesterday you didn't update the TIME variable \31 in the code you posted so there was no need to go into a loop. So if it wasn't for the reason that you wanted to update the pop up list box menu for the time then the code I posted yesterday will work very cleanly.

    Instead of the M code from yesterday put this code in the TIMER and also refresh your variables here too.

    !IF \81=0 THEN \9=FREE
    !IF \81=2 THEN \9=BUSY
    !LISTCLEAR: LISTSETUP 20;5625;2000;2000 :LISTADD STAGE 1 STATUS :LISTADD EXIT MENU :LISTADD TIME LEFT \31 :LISTADD STATUS \9 :LISTADD DWELL \151 :LISTADD DRIP \171 :LISTPICK \8

    Jim C.



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

A small quirk with Mcode setup..

A small quirk with Mcode setup..