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:

Macro's on Mazak controls


Irongate Machine Inc
 Share

Recommended Posts

Hello all, I am currently tring to get a macro to run some simple engraving on a Mazak 640M control. I found a macro online to write progressive serial numbers, i have just modified this program to engrave a specific part number. The part numbers I need to engrave are random, so I decided to manually input the numbers into the common macro variables.

 

Now, after the program starts and I am running into problems with the macro If statements. As the If statements search for the variable, the first If statement is not clearing when the statement is false. ex: If #101 EQ 0 GoTo 45 and the variable #101 is 3

 

Any help would be great, I have lots of Q's

Thanks

Link to comment
Share on other sites

Well you have made a condition statement that states if #101 equals zero goto 45. So this means if #101 equal 3 nothing will happen. You need to have some other type of condtion statement where if #101 equal 3 something will happen. I think you can do a if #101 EQ 3 GOTO 75. and have it right below the stament or you must have some type condtion after this one that triggers soemthing else to happen. The statement you have created will only work when #101 is Zero and if you say it is 3 then what you want to happen at N45 will not happen.

 

HTH

Link to comment
Share on other sites

Every time I variables that are possibly used by other programs, I make sure that I intialize them, this way I am not using data from something else. I don't know whether you want to force #101 to a specific number or not, but generally you are safer starting with the variables in a cleared state when possible. If it is not possible, I use variables in the upper ranges where I don't have to "share"

Link to comment
Share on other sites

I learned soemthing today as well wit hthe Mazak's and Macro's with using Mazatrol. You must do force read function to slow the machine down in essence to force it to update the varaible correctly. If you have an EIA manunal it talks about this in the chapter that talks about Macros and their use with the machine and Mazatrol. Something like #54597 or something like that. I will look at work tommorrow and post up what we do there.

 

HTH

Link to comment
Share on other sites

Odds are the a good number of the variables are already in use.

 

If your machine has a Probe or Tool Setter then I can guaranty that they are.

 

As a general rule, Macros should use local variables wherever possible as this ensures that no conflicts arise with common variables.

 

Any Common variables used should be read initially and the values stored so they can be reset once the macro has completed.

 

When using IF macro statements, keep in mind that a single test is of no value.

 

IF[#101 EQ 0] GOTO 45 (Jump to line 45 if #101 =0)

 

If #101 does not equal 0 then execution will continue at the line immediately following the IF statement.

 

You need to structure your code with this in mind.

Link to comment
Share on other sites

I just threw in the If statement as an example and I should have posted more. The if statements in the program are as follows:

 

IF[#590 EQ 0]GOTO 40

IF[#590 EQ 1.]GOTO 41

IF[#590 EQ 2.]GOTO 42

IF[#590 EQ 3.]GOTO 43

IF[#590 EQ 4.]GOTO 44

IF[#590 EQ 5.]GOTO 45

IF[#590 EQ 6.]GOTO 46

IF[#590 EQ 7.]GOTO 47

IF[#590 EQ 8.]GOTO 48

IF[#590 EQ 9.]GOTO 49

 

I have the #590 varialbe set to 3, when i run the program, the first IF statement passes and moves to line 40 where i go to a subprogram.

 

Next question, when using the macro calls G65 and G66/66.1, the G65 call does not need a macro program number and the G66/66.1 does need a seperate macro program? I think I am running into errors with the G Codes and coresponding programs. I am basically trying to figure out the macro programing from the EIA manual, and don't have any good example programs. Thanks agiain.

Link to comment
Share on other sites

Your macro should work and jump to 43. Are you sure the program doesn't set #590 to some other value before it reads this???

 

quote:

I am basically trying to figure out the macro programing from the EIA manual, and don't have any good example programs. Thanks agiain.

I'm assuming you're using the Fusion EIA programming manual.

 

Turn to page 13-43 and read to 13-50. It gives you the descriptions of the difference between G65, G66, G66.1 and M98. Then, turn to page 13-73 to 13-75. This is where it shows a bunch of examples on how to use macro call and do math functions (like trig, simple math and stuff). Page 13-77 and 13-78 covers "IF...GOTO..." and "WHILE/DO" loops.

 

cheers.gif

Link to comment
Share on other sites

ok, my current program is using local variable and now I can not get into the macro program.

 

 

O8007(4 DIGIT PART NUMBER)

N100 G20

N102 G0 G17 G40 G49 G80 G91

N104 T1 M6

G0 G90 G54 X0. Y0. S6500 M3

Z.25 M8

 

(FIND 4TH DIGIT)

N1000 G66 P1010 A1.

 

N1020 M9 M5

N1030 G67 G90 G0 G28 Z0 M19

N1040 G28 X0. Y0.

N1050 M30

%

 

The program reads to line 1000 and either jumps to line 1020 or back to the begining of the program depending on which macro call i give, G65, G66, G66.1?????

Link to comment
Share on other sites

Don't use a "N" on the macro call line... At least not for this case. Try it this way....

 

O8007(4 DIGIT PART NUMBER)

N100 G20

N102 G0 G17 G40 G49 G80 G91

N104 T1 M6

G0 G90 G54 X0. Y0. S6500 M3

Z.25 M8

 

(FIND 4TH DIGIT)

G65 P1010 A1.

M9 M5

G90 G0 G28 Z0 M19

G28 X0. Y0.

M30

 

I don't know what your program "1010" does, but it should jump to it.

 

Also, cancel a modal call (G66 or G66.1) with the G67 by itself before you back out to return home (G28 or G30) or do something else.

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...