Dear Lene,
Could you tell me result of try as follows(Delete or skip M,S,T code and insert M30 at the end of Main program).
(M6 T1);
(G00 X0 Y0 Z0,5 S400 M13);
.
.
.
G65 H01 P#132 Q25000
M98 P1010
G00 Z100;
G00 X0 Y200;
M30
Daecheol Sung
Hi all!
I hope some of you can help me deal with a problem I get when I make a program in Custom Macro A for a Fanuc O-MD, 3-axis milling machine.
My problem is that when I try to run my program (posted at the bottom) I get alarm 076 address P not defined.
I have tried to define my P#values both at the main program, in variables definition of main program and later I tried to define them in the subprogram. Neither seemed to get rid of the problem, and since I haven’t been able to find much help on macro A I seem to be stuck.
The program has to drill 9 holes (3x3) in each of 8 parts that are lined up as 4x2
I am new to CNC programming so it might be some very basic knowledge I’m lacking. I really hope someone can help!
Thanks!
Regards,
Lene Madsen
O0010 Main program
G17 G40 G54 G21 G90 ;
M6 T1;
G00 X0 Y0 Z0,5 S400 M13;
G65 H01 P#121 Q4000
G65 H01 P#122 Q4000
G65 H01 P#123 Q8500
G65 H01 P#124 Q8500
G65 H01 P#125 Q3
G65 H01 P#126 Q3
G65 H01 P#127 Q0
G65 H01 P#128 Q0
G65 H01 P#129 Q2
G65 H01 P#130 Q2
G65 H01 P#131 Q25000
G65 H01 P#132 Q25000
M98 P1010
G00 Z100;
G00 X0 Y200;
O1010 Custom macro A
G65 H01 P#101 Q1
G65 H01 P#102 Q#128
N1 G65 H83 P99 Q#101 R#130
G65 H01 P#103 Q1
G65 H01 P#104 Q#127
N5 G65 H83 P80 Q#103 R#129
G65 H01 P#105 Q1
G65 H01 P#106 Q#122
N10 G65 H83 P75 Q#105 R#126
G65 H01 P#107 Q1
G65 H01 P#108 Q#121
N15 G65 H83 P50 Q#107 R#125
G81 X#108 Y#106 R0,1 Z-13,1 F50
G80
G65 H02 P#107 Q#107 R1
G65 H02 P#108 Q#108 R#123
G65 H80 P15
N50 G65 H02 P#105 Q#105 R1
G65 H02 P#106 Q#106 R#124
G65 H80 P10
N75 G65 H02 P#103 Q#103 R1
G65 H02 P#104 Q#104 R#131
G65 H80 P5
N80 G65 H02 P#101 Q#101 R1
G65 H02 P#102 Q#102 R#132
G65 H80 P1
N99 M99
I first created the program in macro B (I was advised to do so, but I had ofcourse no way of testing this)
#24 X 4
#25 Y 4
#21 U 8,5
#22 V 8,5
#23 W 3
#11 H 3
#1 A 0
#2 B 0
#3 C 2
#7 D 2
#8 E 25
#9 F 25
O0010 Main program
M6 T1;
G17 G40 G54 G21 G90 ;
G00 X0 Y0 Z10 S400 M13;
G65 P1010 X4 Y4 U8,5 V8,5 W3 H3 A0 B0 C2 D2 E25 F25 ;
G00 Z100;
G00 X0 Y200;
O1010 Custom macro B
G00 X#24 Y#25
#121 = 1
#122 = #2
N1 IF[#121 GT #7] GOTO 99
#131 = 1
#132 = #1
N5 IF[#131 GT #3] GOTO 80
#111 = 1
#112 = #25
N10 IF[#111 GT #11] GOTO 75
#101 = 1
#102 = #24
N15 IF[#101 GT #23] GOTO 50
G81 X#102 Y#112 R0,5 Z-13,5 F50
G80
#101 = #101 + 1
#102 = #102 + #21
GOTO 15
N50 #111 = #111 + 1
#112 = #112 + #22
GOTO 10
N75 #131 = #131 + 1
#132 = #132 + #8
GOTO 5
N80 #121 = #121 +1
#122 = #122 + #9
GOTO 1
N99 M99
Similar Threads:
Last edited by Lene Madsen; 11-30-2010 at 06:37 AM. Reason: added macro B program
Dear Lene,
Could you tell me result of try as follows(Delete or skip M,S,T code and insert M30 at the end of Main program).
(M6 T1);
(G00 X0 Y0 Z0,5 S400 M13);
.
.
.
G65 H01 P#132 Q25000
M98 P1010
G00 Z100;
G00 X0 Y200;
M30
Daecheol Sung
O0010 Main program
G17 G40 G54 G21 G90 ;
M6 T1;
G00 X0 Y0 Z0,5 S400 M13;
G65 H01 P#121 Q4000
G65 H01 P#122 Q4000
G65 H01 P#123 Q8500
G65 H01 P#124 Q8500
G65 H01 P#125 Q3
G65 H01 P#126 Q3
G65 H01 P#127 Q0
G65 H01 P#128 Q0
G65 H01 P#129 Q2
G65 H01 P#130 Q2
G65 H01 P#131 Q25000
G65 H01 P#132 Q25000
M98 P1010
G00 Z100;
G00 X0 Y200;
M30
O1010 Custom macro A
G65 H01 P#101 Q1
G65 H01 P#102 Q#128
N1
G65 H83 P99 Q#101 R#130
G65 H01 P#103 Q1
G65 H01 P#104 Q#127
N5
G65 H83 P80 Q#103 R#129
G65 H01 P#105 Q1
G65 H01 P#106 Q#122
N10
G65 H83 P75 Q#105 R#126
G65 H01 P#107 Q1
G65 H01 P#108 Q#121
N15
G65 H83 P50 Q#107 R#125
G81 X#108 Y#106 R0,1 Z-13,1 F50
G80
G65 H02 P#107 Q#107 R1
G65 H02 P#108 Q#108 R#123
G65 H80 P15
N50
G65 H02 P#105 Q#105 R1
G65 H02 P#106 Q#106 R#124
G65 H80 P10
N75
G65 H02 P#103 Q#103 R1
G65 H02 P#104 Q#104 R#131
G65 H80 P5
N80
G65 H02 P#101 Q#101 R1
G65 H02 P#102 Q#102 R#132
G65 H80 P1
N99
M99
I answered your post last night, but I don't see it here this morning. Not sure what happened there.
Anyway, the format you're using to define P is correct with User Macro A. In the following example, P would take on the value of Q, being 4000
G65 H01 P#121 Q4000
When a program contains macro statements, and the control alarms for no obvious reason due to something related to the Macro statements, try isolating a line of code that the error message relates to, in a program by itself and try running it. For example, construct the following program and run it.
O1000
G65 H01 P#121 Q4000
M00
M30
%
1. If the program errors and displays the same error message that you have been experiencing, then you have an issue with the control because the code in the above program is viable.
2. If the program runs without an error, and when it stops at the compulsory stop M00, look up variable 121 in the Macro variable register and check that the value 4000 has been stored in the corresponding variable.
3. Continue to add to this program one block at a time, the blocks from your original program, but include the M00 just before the end of the program.
4. After each inclusion of the additional block, run the program to see if you get the error and check the variable as in point 2 above.
This may sound a bit tedious, but when you have an error situation that is occurring for no obvious reason, this is a good way of finding the cause, particularly when the program is relatively short as yours is.
Please post the result if you decide to run this test.
Regards,
Bill
Or if you are just learning CNC programming then you may want to use macroB instead. This is more current with machine programming then A. I am never against learning something no matter how old it is but it is definitely 2 breeds of programming and macroB will help you longer term. You will also find more support to B then A. I am taking nothing away from the people already helping and their suggestions.
Sorry I know read the rest of your post with the macroB code. May I ask why you were advised to write this in macroB first?
Can anyone tell that I hate macroA??
Stevo
Sung and Angelw:
I will be trying both your suggestions once the machine is off duty, thank you very much both!
Stevo1:
The particular machine I am running only has the option to program in macroA.
I was adviced to write in macroB since they mostly differ on syntax. Is that wrong?
The syntax of Macro B is very much like Basic or Pascal and is quite intuitive and relatively easy to read. Macro A, on the other hand, uses codes to represent functions and accordingly, you have to know what the codes represent to be able to read the program.
In the following example the two Macro statements have the same function, but the Macro B code is far easier to read.
Macro A------------------------------Macro B
G65 H02 P#101 Q#102 R15------------#101 = #102 +15
I can well imagine someone suggesting you write the program in Macro B, then transpose the Macro A function code to perform the same task, because of the better readability of Macro B. However, the same could be achieved by drawing a Flow Chart, which is the approach taken when designing software.
The attached picture is an example of a flow chart just to illustrate how symbols, lines, and directional arrows can be used to show functions, conditional statement etc in a graphical, easy to follow form. Flow charts are often just quick hand sketches to allow you to better visualize the logic of your program.
Regards,
Bill
Last edited by angelw; 12-07-2010 at 02:22 AM.