588,127 active members*
5,358 visitors online*
Register for free
Login
Page 1 of 2 12
Results 1 to 20 of 21
  1. #1
    Join Date
    Sep 2009
    Posts
    8

    Change variable by MDI

    Hello,
    I would like to know how it is possible to change a variable by MDI;
    for example:

    N100 print "variable #1 is equal to?" --> this msg can be read on the screen
    The operator insert "250"
    And so now #1 is = 250.

    A sort of "scanf" or "cin" for fanuc

    Thank you very much

  2. #2
    Join Date
    Feb 2006
    Posts
    992
    just type in whatever the variable you wish, #1=33 input then start. it should show up as 33 under variable #1
    The best way to learn is trial error.

  3. #3
    Join Date
    Jun 2008
    Posts
    1511
    Audoru...CNCrim is correct you just go into MDI and type #1=250->EOB->INSERT->cycle start. Now #1=250. One thing to keep in mind on the Fanuc controls #1-#33 are your local variables and will clear to null if you press reset or at program end with M30.

    What model Fanuc are you using?

    Stevo

  4. #4
    Join Date
    Sep 2009
    Posts
    8
    Thank you,
    but it's possibile that i didn't explain it well enough:
    I know that i can set a variable by mdi, but the problem is that i would like a sort of M00 with condition....
    For example:
    i have a program in execution and i want on block N100 a sort of:
    print "set you variable to 1 or 0"
    and put the 1 or 0 inserted by operator by mdi into a variable, and then if #my_variable it's equal to 1 the program can continue, else the program will stop by an M30.

  5. #5
    Join Date
    Jun 2008
    Posts
    1511
    Hmmm ok I am a bit more clear on what you are looking to do but not quite 100%. First off you cannot have the program stop to display what the value of #1 is equal to. You can have the program stop and have the operator view it through the settings screen. You can also have him change it through the settings screen by pressing 1 or 0 then “input”.

    Now with that being said you can have the program stop with a M0 and have the operator input the proper number (1 or 0) into #1 then continue the program. Now you can write the code to have the program end with M30 or continue machining based on what #1 is set to. I believe this is what you were trying to explain.

    Now in the code below the operator will enter what he needs into #1 when the M0 is read, either 1 or 0. The program will continue and when it reads the "IF" statment and if #1 is set to 1 it will skip the M30 and go to the N100 and continue machining. On the other hand if #1 is set to 0 it will not go to N100. It will just proceed to the next block which is M30 and the program will end.


    M0
    (INSERT 1 OR 0 IN #1)


    IF[#1EQ1]GOTON100
    M30
    N100(CONTINUE MACHINING)


    Stevo

  6. #6
    Join Date
    Sep 2009
    Posts
    8
    Thank you very much Stevo,
    last ( I hope ) question is:
    between M0 and if condition how is possibile to save the number that operator enter into variable #1?
    What is the command that i have to insert into the program to set this variable as the operator want?

    Thank you

  7. #7
    Join Date
    Jun 2008
    Posts
    1511
    Ask all the questions that you want to. That’s what we are all here for.

    You can very easily save this value that is input into #1. As a quick reference #1-#33 are your local variables and will clear to null at reset or program end. #100-#199 are you common variables and will clear only at power down of the machine depending on if you have a parameter to allow or disallow them to clear. However it is most common they clear at power down. #500-#999 are you permanent common variables which will never clear unless you program them to change or clear.

    So you can save what #1 is set to by writing it like below. Use #100-#199 if you don’t care that the value will clear at power down, or use #500-#999 if you don’t want the value to clear at all. Make sure that the variable you choose is not being used for something else. These are commonly used for tool changes or macros.


    M0
    (INSERT 1 OR 0 IN #1)
    #500=#1

    IF[#1EQ1]GOTON100
    M30
    N100(CONTINUE MACHINING)


    What exactly are you trying to do? I am just wondering if there is a easier or less operator interface way of doing what you need done. You can have conditions before hand that can maybe set #1 so the operator does not have to and the program will machine accordingly. You may also want to change #1 to #100 or #500 as long as those variables are not being used for something else.

    Stevo

  8. #8
    Join Date
    May 2007
    Posts
    781
    If you are wanting what I think you are, just use the block skip.

    .
    .
    .
    M0(BLOCK SKIP OFF TO STOP);
    \GOTO9999;
    .
    .
    .
    N9999
    (CODE TO TURN STUFF OFF AND PARK THE MACHINE WHERE YOU WANT IT)
    M30

  9. #9
    Join Date
    Feb 2006
    Posts
    1792
    If you are using MDI programs too often, you may find the following information useful:

    The default setting for the MDI mode is such that the program gets erased automatically, after its execution is complete. This means that the program would require to be typed again, for a subsequent execution. This makes trial and error impractical in MDI mode. However, if parameter 3204#6 (on 0i control) is set to 1, the MDI program is retained even after its execution is over. The RESET key will, of course, erase it. If it is desired to retain it even after pressing RESET key, set parameter 3203#7 to 0. An MDI program, however, cannot be permanently saved with a program number, for a future use. Switching off the machine erases it permanently.

  10. #10
    Join Date
    Aug 2009
    Posts
    684

    MDI warning

    I once squashed a job with the spindle nose on an Acramatic by accidently starting an MDI program instead of MEM program. Both screens looked virtually identical. I therefore prefer MDI to clear after performing required action...

    DP

  11. #11
    Join Date
    Feb 2006
    Posts
    1792
    Can you execute an MDI program in AUTO mode?
    (I am not sure)

  12. #12
    Join Date
    Aug 2009
    Posts
    684
    Quote Originally Posted by sinha_nsit View Post
    Can you execute an MDI program in AUTO mode?
    (I am not sure)


    No, but you can do what I did and forget which mode you are in. The control I was using was virtually all touch-screen, no mode setting dial or switch, and the display barely changed from MEM to MDI.

    As I recall, on Acramatic you could write your entire program in MDI, re-run it and ultimately save it. My MDI program was simply a move to XY-zero then down to clock location boss on fixture. It was never meant to be run with a component sitting in the way....

    DP

  13. #13
    Join Date
    Sep 2009
    Posts
    8
    I just want that the operator, by mdi, can stop or skip to another block or load another sub-prog...or so on....
    That's why i don't want to set the variable into the program but let the opertator set it, and i don't want that operator have to write:
    #1=100 but he have to write only "100" and then the program have to restart with some command that i don't know, save that 100 into a variable
    and so on..

  14. #14
    Join Date
    Feb 2006
    Posts
    1792
    I do not think it is possible, but let others think about it.

    It is risky to rely too much on operators.

  15. #15
    Join Date
    Jun 2008
    Posts
    1511
    I agree with Sinha it can be risky to give that much interface to an operator. However sometimes it is necessary. Maybe you could explain more of what you are trying to do and let us see if there is a better way with less interface (there always is).

    I am going to ass u me that the reason you want this is because based on how a particular part is machining at the moment will dictate if the part needs different/more machining that may need to be done but you don’t know this ahead of time before starting the part.

    However to answer your most recent question yes you can have this done by the operator. You will have to use the program I posted earlier. Once the machine stops at M0 you can then have the operator go to the settings screen and highlight #100. He will have to be in MDI and type 1 or 2 whichever he determines he needs then press “input” now it will change #100 to 1 or 2. This will eliminate him having to type #100=()->EOB->INSERT->CS just to set #100.

    There are no special codes to do exactly what you want. This will have to be done with 1 of 3 ways or maybe a few of them together. You can use macroB programming with conditions like “IF”, “GOTO”, and “WHILE” statements to jump around in the program or run different programs. You can do as Andre suggested with having the program stop and the operator will either turn the block skip on to skip a specific operation or leave it off to run another. With the block skip you only have 2 options, on or off. If the operator needs a 3rd then it will not work. Your 3rd is to have the operator interface as I explained above.

    Stevo

  16. #16
    Join Date
    Feb 2006
    Posts
    1792
    "interruption type custom macro" also is a way.

  17. #17
    Join Date
    Jun 2008
    Posts
    1511
    Quote Originally Posted by sinha_nsit View Post
    "interruption type custom macro" also is a way.
    Please give an example.

    OT: Sinha....hows the book coming?

    Stevo

  18. #18
    Join Date
    Feb 2006
    Posts
    1792
    I have not studied it in detail. The following information is from operator's manual (with my interpretation):

    Use of the interruption type custom macro function allows the user to call a program during execution of another program, by inputting an interrupt signal (UINT) from the machine.
    M96 P----; enables custom macro interrupt
    M97; disables custom macro interrupt
    The interrupt signal has no effect in M97 mode.
    In M96 mode, the program number mentioned in the M96 block is called, the moment interrupt signal is input (I am not sure whether the execution of the current block, when the signal is input, is allowed to be complete, or skipped)
    Interrupt signal can be used in both MDI and AUTO modes.
    Interrupt signal must not be input during execution of an interrupt program.

    This feature is like having an "optional M98" type subprogram call, without nesting (using UINT). It is even possible to jump to the desired block of the calling program, after subprogram execution is complete (by mentioning a block number with M99).

    The reason why I did not study it in detail is that I do not have even basic information about "interrupt signal". I do not know what it is and how it is triggered. I would appreciate some information about it.

    The book is ecpected in mid-June. Of course, it does not describe interruption type custom macros. I did not want to write anything without testing it thoroughly.

    Sinha

  19. #19
    Join Date
    Aug 2009
    Posts
    684
    Quote Originally Posted by sinha_nsit View Post
    The reason why I did not study it in detail is that I do not have even basic information about "interrupt signal". I do not know what it is and how it is triggered. I would appreciate some information about it.

    Sinha
    Is it possibly for use with a probing cycle ie signal from work/tool probe?

    DP

  20. #20
    Join Date
    Jun 2008
    Posts
    1511
    Sinha,
    There is not too much to the interrupt macro. I don’t use it much and to the best of my knowledge it is just to call another program when inside of a custom macro. There are 2 types of ways to set it. Subprogram type and macro type. With the subprogram type the local variables remain unchanged. With macro type the local variables change before and after the interrupt.

    DP,
    Yes this is used in probe programming sometimes. Depends on what you are doing. You may also be thinking of the skip signal instead of interrupt.

    Stevo

Page 1 of 2 12

Similar Threads

  1. How to change Tool change position(About MAZATROL T1 control)
    By liushuixingyun in forum Mazak, Mitsubishi, Mazatrol
    Replies: 6
    Last Post: 01-07-2014, 01:33 AM
  2. EMC2 variable pitch / variable diameter threading.
    By samco in forum MetalWork Discussion
    Replies: 0
    Last Post: 03-09-2008, 07:40 PM
  3. variable to change tool offsets in auto cycle
    By dalvinder in forum DNC Problems and Solutions
    Replies: 0
    Last Post: 09-04-2007, 09:45 PM
  4. Replies: 1
    Last Post: 06-30-2007, 03:30 AM
  5. IF variable = bla THEN do this ELSE do that ?
    By iMisspell in forum G-Code Programing
    Replies: 21
    Last Post: 07-31-2006, 04:57 AM

Posting Permissions

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