Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Fanuc Macro Order of Operations


Tim Johnson
 Share

Recommended Posts

Does anyone know How Fanuc figures out their equations. The problem I'm having is with this condition statement;

 

IF[#120AND3EQ1]GOTO1

 

#120 does equal 1 and my control (Fanuc 18iMB)shows this to be a true statement. The problem I have is with Vericut. Vericut telling me that the statement is false using the order of operations and that in order for the statement to be correct I would either need a second set of brackets ( IF[[#120AND3]EQ1]GOTO1 ) or try find out what their order is. Vericut tried but Fanuc would not give them any info because they don't own a controller. cuckoo.gif

 

I called Fanuc and after some arguing they admitted that AND was used before EQ but would not give me their standard order of oerations and told me to call Renishaw since they programmed it. (to run through THEIR controller) mad.gif

Link to comment
Share on other sites

From what I understand the statement compares #120 and binary 3. Since #120 equals 1 and 3 equals binary 11, and that makes the statement true.

 

code:

BIT               7      6      5      4     3    2    1    0

 

Value 128 64 32 16 8 4 2 1

code:

1 = 00000001

3 = 00000011

--------------

= 00000001

Adding the columns;

 

0 AND 0 = 0

0 AND 1 = 0

1 AND 1 = 1

Link to comment
Share on other sites
Guest SAIPEM

Your macro syntax is incorrect for using Bitwise operators.

The Bitwise operators are OR, AND and XOR.

 

Bitwise operators are a convenient way of combining comparisons but the syntax is VERY specific.

Each part of the Bitwise comparison MUST be enclosed in [] brackets

 

 

Example 1

-------------

IF[[#120 EQ 1] AND [#3 EQ 1]] GOTO 1

GOTO 2

 

N1

(EXECUTE CODE HERE IF BITWISE COMPARISON IS TRUE)

 

N2

(JUMP PAST N1 IF BITWISE COMPARISON IS FALSE)

 

 

Or

 

Example 2

-------------

 

#100 = [#120 EQ 1] AND [#3 EQ 1]

IF [#100 EQ 1] GOTO 1

GOTO 2

 

N1

(EXECUTE CODE HERE IF BITWISE COMPARISON IS TRUE)

 

N2

(JUMP PAST N1 IF BITWISE COMPARISON IS FALSE)

Link to comment
Share on other sites

IF[#120AND3EQ1]GOTO1

 

3 is not a variable. Renishaw uses this statement to determine which of 4 styles of Funuc control software is being used. In this case if the statement is true then the Renishaw knows the control has tool length offsets. If it returns false then the control uses the old style "G92,G50" for tool point location.

Link to comment
Share on other sites
Guest SAIPEM

Simply remove the #.

 

The syntax in my previous example still holds true.

 

It would still be helpful if you could post the Renishaw Macro itself to the FTP site.

 

There are certain differences in how different Fanuc versions interpret Macro B.

 

i.e. The conditional "THEN" statement isn't supported universally.

Link to comment
Share on other sites

The problem is not with the Renishaw program. That works fine. The problem is how Vericut processes a Fanuc equation. Every equation goes through a "module" or subprogram to be processed. Currently the subprogram is flawed in the way it processes the Fanuc equation because Fanuc doesn't use the typical "order of operations" shown in the link in the first posting. Vericut needs to know what Fanuc's order is to fix the problem. I was hoping someone on this forum knew so I could speed them up to fix my problem. I could fix this problem by editing out the older style equation in the Renishaw program (and I still might), but I usually request an update about every couple years and don't want to have to remember what I did two years ago.

Link to comment
Share on other sites
Guest SAIPEM

The problem is macro syntax.

 

Fanuc isn't the cause of the problem, your Renishaw Macro and Vericut's interpretation is.

Don't assume that Renishaw got it correct just because the Macro works (or seems to) on your machine.

I've had to fix plenty of their Macros that had glaring errors but would still function.

 

Fanuc Macro B does conform to standard order of operations.

 

Please reference 'GROUPING' under "Mathematical precedence" in your link. It's item #1

 

IF[#120AND3EQ1]GOTO1 is incorrect syntax.

 

IF[[#120EQ1]AND[3EQ1]]GOTO 1 is the Correct syntax.

Link to comment
Share on other sites

I don't know enough about this bitwise stuff to offer an argument, but I would think that since the Renishaw "Ispection Plus" software is designed to run on four different types of Fanuc controls and with that software running on who knows how many machines the software should be dialed in by now. When I ask for updates it's because we've added an option to our controls that the current software doesn't work on. Fanuc themselves told me the AND is processed before the EQ which does not conform to the standard order of operations. They just wouldn't give me their total order process.

Link to comment
Share on other sites

Tim I think you need to not throw out Math's order of operations in this instance. Remember it is a computer and sometimes they need things spefically divided to understand each compontents meaning. What you might have to do is have it post code for the machine one way and then use a mi switch to post code antoher way to get Vericut to not give you a problem. I would also be all over them about giving you access to what or how they need it to get a full understanding of the equation and how it should be handled to give the ocrrect idea to the program to use it.

 

HTH

Link to comment
Share on other sites
Guest SAIPEM

Tim-

 

Whoever you spoke with at Fanuc is simply wrong.

That happens quite often that Fanuc phone support can't get it right.

 

They could be saying that given your syntax, AND is being processed before EQ.

Link to comment
Share on other sites

Ron,

 

Good idea, The subprogram I'm having a problem with is locked in the control's memory. I could create a seperate program folder for Vericut and comment out the unneeded blocks.

 

The conversation with Fanuc did get rather heated up. The guy was treating my questions like I was trying to pry nuclear secrets from him. I think I'll try again and see how far up the ladder I can climb.

Link to comment
Share on other sites
Guest CNC Apps Guy 1

Well since it runs correctly in the machine (for which it was designed), it would seem as though Vericut needs to make some changes. I've ALWAYS thought G-Code verification of MACRO stuff has been dicey at best.

 

JM2C

Link to comment
Share on other sites

The sad part about most support techs is that the scenarios they are trained to deal with are taken from a (fake book) so to speak. 90% of tech personell are chain of command enacted according to the problem, which is given by the error message you tell them you are receiving. Also along with the question as to whether there control parady uses 4, 8 or 16 bit syntax messages.Also something to think about is whether they are using cobal, faultran or some other language to drive the parody. Most companies keep that as trade secret stuff. there should be a standard unit that you can plug into the serial out of your machine that will read the digital stream. Ive seen techs use them but am not sure what the connection is. S.Hall

Link to comment
Share on other sites

I've just talked a GE Funuc rep about the order of operations issue and he said that he knew what I was talking about but the only documentation available is what is in the operators manual. He also did say that AND bitwise would always be processed before EQ. He also stated that there is no logical OR, XOR, or AND capability in the Fanuc control.

 

IF[#120AND3EQ1]GOTO1 -- bitwise statement

 

IF[[#120EQ1]AND[#3EQ1]]GOTO1 -- logical statement

 

quote:

Well since it runs correctly in the machine (for which it was designed), it would seem as though Vericut needs to make some changes.

Vericut does want to make the changes but also wants the total documentaion (probably to fix everything in one shot). It appears that they're going to have to do it the hard way... the way we do it. smile.gif

Link to comment
Share on other sites

Long answer;

I read the bitwise statement to him and asked him if the syntax was correct without telling him what it was for and he immediately said if I was trying to single out something from a group then yes it was. A while into the conversation he was explaining how they worked was when I told him we figured out the order by putting brackets the #120AND3 he said that would also work but then added that if we put brackets around the #120 and also around the 3 that would then be considered a logical statement and would have errored out.

 

Short answer;

Yes the bitwise statement that works is the correct one to use.

Link to comment
Share on other sites
Guest SAIPEM

Tim-

 

The Fanuc rep you talked to ought to read his own company's literature and actually write a Macro.

 

"GE Fanuc’s Custom Macro is the most popular CNC macro language, and powerful examples may be downloaded from a host of third-party web sites. Instructor, video, computer-based and web-based training is available from GE Fanuc and several third-party sources."

 

Language Features

 

* Local Variables for passing parameters and for intermediate calculations within a macro

* Common Variables shared by all macros

* Permanent Common Variables that keep their values even when power is turned off

* System Variables to read and write a variety of CNC data items and generate alarm messages

* Standard operations (add, subtract, multiply and divide)

* Trig Functions (Sin, Cosine, Tangent and their inverse)

* Math Functions (SQRT, ABS, ROUND, FIX, FUP, LN, EXP)

* Logical Bitwise Operators (AND, OR, XOR)

* Conversion Functions (BCD to BIN, BIN to BCD)

* Branching (IF-THEN and GOTO)

* Conditional Operators (equals, not equals, less than, less than or equal to, greater than, greater than or equal to)

* Loops (WHILE-DO-END)

* Variety of calling formats with parameters including defining custom G-codes and M-codes

* Printing of values to a serial port

 

 

http://www.imakenews.com/gefanuc/e_article000076528.cfm

Link to comment
Share on other sites
Guest CNC Apps Guy 1

GE Fanuc and Fanuc are COMPELTELY SEPERATE ENTITIES. If you were to order a new, Operator's Manual from GE Fanuc you will pay 1 price, if you were to order one from Fanuc you will pay another. Another sad case of the left hand not knowing what the right hand is doing.

 

You are more likely to get more cooperation from GE Fanuc than Fanuc because GE Fanuc being a non Japanese company is more free with information, Japanese companies guard information like it is life and death. I remember when I was consulting at a company that was getting a linear pallet pool system, we requested the AutoCAD drawings from the builder so we could do some layout in the facility (a 3500 sq.ft. piece of equipment is not an easy thing to place in an existing facility). They refused. They didn't want to part with it. Until we threatened to cancel the order and go with a competitor did they relent. It's merely a difference in culture.

Link to comment
Share on other sites
Guest SAIPEM

quote:

GE Fanuc and Fanuc are COMPELTELY SEPERATE ENTITIES. If you were to order a new, Operator's Manual from GE Fanuc you will pay 1 price, if you were to order one from Fanuc you will pay another. Another sad case of the left hand not knowing what the right hand is doing.

 

You are more likely to get more cooperation from GE Fanuc than Fanuc because GE Fanuc being a non Japanese company is more free with information, Japanese companies guard information like it is life and death.

Absolutely and unequivocally true.

GE Fanuc will almost always have the same part at a cheaper price.

 

Talking to FANUC is like calling the IRS and expecting accurate and legal Tax advice.

Link to comment
Share on other sites

GE Fanuc Automation is an affiliate of FANUC Ltd.

I was an instructor there in 2000 teaching basic programming and Macro B. I think the FANUC AMERICA company is geared more towards parts and sevice, although they offer training as well. I think if you buy a control it comes through GE Fanuc. They sure sold a buttload when I was there.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...