585,922 active members*
3,849 visitors online*
Register for free
Login
Page 1 of 2 12
Results 1 to 20 of 28
  1. #1
    Join Date
    Jan 2009
    Posts
    39

    Question IF[#120AND7EQ1]GOTO1

    Gentlemen,
    In this conditional statement, IF[#120AND7EQ1]GOTO1 is the number 7 read as a local variable #7? And if so could it be written like this,
    IF[#120AND#7EQ1]GOTO1?

  2. #2
    Join Date
    Feb 2009
    Posts
    64

    ?

    IF[#120AND7EQ1]GOTO1 would give a false return.

    #120 may equal 1 but 7 never will. The control will read '7' as a constant and not a variable.

    However, I ran this:
    #120 = 1;
    n2 IF[#120 AND 7 EQ 1] do1;
    goto2;
    end1;
    m1;

    and got it into an infinite loop. This is odd. This will confuse me for a while. I would expect this to go straight to m1, but the machine is counting the statement as true when I would expect it not to.

    F[#120AND#7EQ1]GOTO2 also gave an infinite loop. Very strange.

  3. #3
    Join Date
    Mar 2005
    Posts
    988
    AND is an operator so I think in your loop, this becomes bitwise. Therefore, the product of bin 1 and 7 = 0001 ... or in other words equal to "1". So the program loops...
    It's just a part..... cutter still goes round and round....

  4. #4
    Join Date
    Feb 2006
    Posts
    1792
    You are right.
    AND can be both bitwise and Boolean. It depends on what you have as its arguments. In fact, it is also possible to have "different" ANDs in the same Block!
    IF [[[#1 AND #2] LT 100] AND [#1 LT #2]] GOTO 10;
    Of course,parameter 6000#0 should be 1 to allow use of AND as a Boolean function in a conditional statement.

    Incidently, arithmetic 0 and 1 are not equivalent to Boolean FALSE and TRUE, as believed by Peter Smid.

  5. #5
    Join Date
    Dec 2008
    Posts
    3109
    IF [[#120 EQ 1] AND [#7 EQ 1 ]] GOTO 1
    Would this not be an easier way of getting the syntax correct ?
    You are breaking up the query to each variable and get a yes/no from each, if either give a 0 return then the IF statement will not jump

  6. #6
    Join Date
    Feb 2006
    Posts
    1792
    Quote Originally Posted by Superman View Post
    IF [[#120 EQ 1] AND [#7 EQ 1 ]] GOTO 1
    Would this not be an easier way of getting the syntax correct ?
    You are breaking up the query to each variable and get a yes/no from each, if either give a 0 return then the IF statement will not jump
    Yes.
    This is what he perhaps wants to check.
    This would be the simplest method.

  7. #7
    Join Date
    Oct 2009
    Posts
    12
    Hi to all.

    iI have vmc (Jih Fong Machinery Co) of taiwan with Fanuc 0-MD 20# of tool changer i have lost of its all macro and sub programs i am not able make the macro program how to call the 20 tools step by step please help me thanks to all.

  8. #8
    Join Date
    Feb 2006
    Posts
    1792
    For a better response, start a new thread for a new problem.

    Can call a tool without using any macro. Send it to a safe position (say, reference position), and command T1 M06, for example. Then bring it to the machining area, incorporate length offset and continue...

  9. #9
    Join Date
    Oct 2009
    Posts
    12
    Thanks to all but i can't inter( IF [[#) likes value

  10. #10
    Join Date
    Jun 2008
    Posts
    1511
    Quote Originally Posted by Khalid.Ins-Tek View Post
    Thanks to all but i can't inter( IF [[#) likes value
    If you do not have the full keypad with these functions on it then you have to write the program and download it to the control.

    Stevo

  11. #11
    Join Date
    Oct 2009
    Posts
    12
    hi stevo
    then i feed from pc through RS232 but genrate a alarm 004

  12. #12
    Join Date
    Jun 2008
    Posts
    1511
    Quote Originally Posted by Khalid.Ins-Tek View Post
    hi stevo
    then i feed from pc through RS232 but genrate a alarm 004
    Hmmm that’s weird. The PS04 alarm is “address not found”. This is typically when you are running a program not downloading. I saw the program you sent me via PM and it appears to be a tool change program in macroA format correct? Is this the program for your machine? My guess is it is not alarming on the M42 it is alarming on the block after “N1”. Do you have macroA on your control?

    You are doing a download and not dripfeeding correct?

    Stevo

  13. #13
    Join Date
    Feb 2006
    Posts
    1792
    Quote Originally Posted by Khalid.Ins-Tek View Post
    Thanks to all but i can't inter( IF [[#) likes value
    Set parameter 3204#0 to 0 for a square bracket, instead of parenthesis.

  14. #14
    Join Date
    Jun 2008
    Posts
    1511
    Quote Originally Posted by sinha_nsit View Post
    Set parameter 3204#0 to 0 for a square bracket, instead of parenthesis.
    Sinha....IIRC there is no parameter 3204 for the O series control. You are probably refering to the newer Oi series control.

    Stevo

  15. #15
    Join Date
    Jan 2009
    Posts
    39

    Question IF[#120AND7EQ1]GOTO1

    Gentlemen,
    So what is the answer to my original question, IF[#120AND7EQ1]GOTO1
    would number 7 be read as a local variable #7? Had a apps. guy tell me
    that the pound sign from #120 would be carried to the number 7 but
    he did not seem to confident in his answer so that's why I come to the
    experts here on CNC Zone. Thank You

  16. #16
    Join Date
    Feb 2006
    Posts
    1792
    Quote Originally Posted by stevo1 View Post
    Sinha....IIRC there is no parameter 3204 for the O series control. You are probably refering to the newer Oi series control.

    Stevo
    YES!
    0 series may have a similar parameter (?)

  17. #17
    Join Date
    Feb 2006
    Posts
    1792
    Quote Originally Posted by ggborgen View Post
    Gentlemen,
    So what is the answer to my original question, IF[#120AND7EQ1]GOTO1
    would number 7 be read as a local variable #7? Had a apps. guy tell me
    that the pound sign from #120 would be carried to the number 7 but
    he did not seem to confident in his answer so that's why I come to the
    experts here on CNC Zone. Thank You
    Superman has already suggested the correct method.
    IF[#120AND7EQ1]GOTO1 would not do what you want. It means entirely different thing.

  18. #18
    Join Date
    Dec 2009
    Posts
    11

    DID IT WORK?

    I was just reading through this thread now, BUT I and am curious to see how it worked out for you.
    I ran it through using NCplot, it seemed to work just fine.

    #120=1
    #7=1

    IF [[#120 EQ 1] AND [#7 EQ 1 ]] GOTO 1
    M00
    N1

  19. #19
    Join Date
    Aug 2009
    Posts
    684
    I want to resurrect this thread to get to a satisfactory conclusion. Looking through some Inspection Plus macros I see this kind of AND format everywhere and I really don't understand it...

    examples from the 'settings' macro: -

    IF[#120AND8NE8]GOTO6

    IF[#120AND3EQ3]GOTO4

    IF[#120AND3EQ2]GOTO3



    DP

  20. #20
    Join Date
    Feb 2006
    Posts
    1792
    This is bitwise AND.
    (#120 AND 8) checks the status of fourth bit of binary representation of #120 (starting counting from bit-1, bit-2, and so on) from right.
    If #120 AND 8 is equal to 8, then fourth bit is 1.
    #120 gets its value from input interface signals.(#120 = #1032)
    Let us say first five signals are all 1. Then #1032 would be binary interpretation of 11111 i.e., 31.
    31 AND 8 is equivalent to binary 11111 AND 01000 which gives 01000, i.e., 8.
    8 means that the fourth bit is ON.
    If the fourth bit is not ON, the value returned would be 0.
    Thus the first statement means that "if the fourth input signal is 0 (OFF), jump to block number 6." (IF[#120AND8NE8]GOTO6)
    Read the attachment for more details.
    Attached Files Attached Files

Page 1 of 2 12

Posting Permissions

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