What's new
What's new

fanuc #3000 alarm generator problem, continued.

meandean77

Aluminum
Joined
Jun 23, 2014
Location
United States
this is a continuation of my previously posted problem that i thought had been solved but after a full testing of the macro i have found it doesn't totally work correctly but some of it does. Here is the problem, N1 and N2 group works correctly, a 0 value thru any value within the tolerance range in variables #601-#602 and a 0 value in #603 the program runs thru the N107 (ALL GOOD TO PROCEED) and any value in variables #601 and #602 exceeding the tolerance values generates the appropriate alarm # #3001 ( #601 OUT OF RANGE) and #3002 ( #602 OUT OF RANGE) respectively. the problem is the N3 group, any value other than 0 in variable #603 results in a alarm even if the value is within the tolerance range what's even more strange is the alarm that is generated is alarm #3001 ( #601 OUT OF RANGE) not #3003 ( #603 OUT OF RANGE) which is the expected alarm. the G4's are to ensure that buffering or look ahead are not causing the problem. Results are the same when run in SINGLE BLOCK mode, results are the same for Fanuc 21i and 31i please see the code below. thank you.
%
O1237 (ALARM GERNERATER)

N1
IF[#601EQ0]GOTO2(SKIP IF 0)
G4 X.25
IF[#601LT-.1]GOTO101(#601 OUT OF RANGE)
G4 X.25
IF[#601GT.1]GOTO101(#601 OUT OF RANGE)
G4 X.25


N2
IF[#602EQ0]GOTO3(SKIP IF 0)
G4 X.25
IF[#602LT-.1]GOTO102(#602 OUT OF RANGE)
G4 X.25
IF[#602GT.1]GOTO102(#602 OUT OF RANGE)
G4 X.25


N3
IF[#603EQ0]GOTO107(SKIP IF 0)
G4 X.25
IF[#603LT-.1]GOTO103(#603 OUT OF RANGE)
G4 X.25
IF[#603GT.1]GOTO103(#603 OUT OF RANGE)
G4 X.25


(ALARMS)
G4 X.25
N101 #3000=1 ( #601 OUT OF RANGE)
G4 X.25
N102 #3000=2 ( #602 OUT OF RANGE)
G4 X.25
N103 #3000=3 ( #603 OUT OF RANGE)
G4 X.25


G4 X.25
N107 (ALL GOOD TO PROCEED)


M99
%
 
%
O1237 (ALARM GERNERATER)

N1
IF[#601EQ0]GOTO2(SKIP IF 0)
G4 X.25
IF[#601LT-.1]GOTO101(#601 OUT OF RANGE)
G4 X.25
IF[#601GT.1]GOTO101(#601 OUT OF RANGE)
G4 X.25


N2
IF[#602EQ0]GOTO3(SKIP IF 0)
G4 X.25
IF[#602LT-.1]GOTO102(#602 OUT OF RANGE)
G4 X.25
IF[#602GT.1]GOTO102(#602 OUT OF RANGE)
G4 X.25


N3
IF[#603EQ0]GOTO107(SKIP IF 0)
G4 X.25
IF[#603LT-.1]GOTO103(#603 OUT OF RANGE)
G4 X.25
IF[#603GT.1]GOTO103(#603 OUT OF RANGE)
G4 X.25

GOTO107

(ALARMS)
G4 X.25
N101 #3000=1 ( #601 OUT OF RANGE)
G4 X.25
N102 #3000=2 ( #602 OUT OF RANGE)
G4 X.25
N103 #3000=3 ( #603 OUT OF RANGE)
G4 X.25


G4 X.25
N107 (ALL GOOD TO PROCEED)


M99
%



I added what you need to avoid the alarm. You forgot to skip the alarms if everything returns back good.



Also, I would do something like:


O1237 (ALARM GERNERATER)
G31
N1
IF[ABS[#601]GT.1]GOTO101(#601 OUT OF RANGE)
G31
N2
IF[ABS[#602]GT.1]GOTO102(#602 OUT OF RANGE)
G31
N3
IF[ABS[#603]GT.1]GOTO103(#603 OUT OF RANGE)

GOTO107

(ALARMS)
N101 #3000=1 ( #601 OUT OF RANGE)
N102 #3000=2 ( #602 OUT OF RANGE)
N103 #3000=3 ( #603 OUT OF RANGE)

N107 (ALL GOOD TO PROCEED)


M99
%


G31 will prevent buffering. G4 "can?" prevent buffering but there's always arguments against it because it may not actually prevent it, depending on how many blocks lookahead you're running. Best to turn off any extra lookahead before doing macro math anyway.

Also I like ABS[] to compare the absolute value to a given number, since in your example you have + or - .1 tolerance. However, if you only had + or only -, or you were +.1 but -.2, then this won't work. But just an idea for cleaner code.
 
%
O1237 (ALARM GERNERATER)

N1
IF[#601EQ0]GOTO2(SKIP IF 0)
G4 X.25
IF[#601LT-.1]GOTO101(#601 OUT OF RANGE)
G4 X.25
IF[#601GT.1]GOTO101(#601 OUT OF RANGE)
G4 X.25


N2
IF[#602EQ0]GOTO3(SKIP IF 0)
G4 X.25
IF[#602LT-.1]GOTO102(#602 OUT OF RANGE)
G4 X.25
IF[#602GT.1]GOTO102(#602 OUT OF RANGE)
G4 X.25


N3
IF[#603EQ0]GOTO107(SKIP IF 0)
G4 X.25
IF[#603LT-.1]GOTO103(#603 OUT OF RANGE)
G4 X.25
IF[#603GT.1]GOTO103(#603 OUT OF RANGE)
G4 X.25

GOTO107

(ALARMS)
G4 X.25
N101 #3000=1 ( #601 OUT OF RANGE)
G4 X.25
N102 #3000=2 ( #602 OUT OF RANGE)
G4 X.25
N103 #3000=3 ( #603 OUT OF RANGE)
G4 X.25


G4 X.25
N107 (ALL GOOD TO PROCEED)


M99
%



I added what you need to avoid the alarm. You forgot to skip the alarms if everything returns back good.



Also, I would do something like:


O1237 (ALARM GERNERATER)
G31
N1
IF[ABS[#601]GT.1]GOTO101(#601 OUT OF RANGE)
G31
N2
IF[ABS[#602]GT.1]GOTO102(#602 OUT OF RANGE)
G31
N3
IF[ABS[#603]GT.1]GOTO103(#603 OUT OF RANGE)

GOTO107

(ALARMS)
N101 #3000=1 ( #601 OUT OF RANGE)
N102 #3000=2 ( #602 OUT OF RANGE)
N103 #3000=3 ( #603 OUT OF RANGE)

N107 (ALL GOOD TO PROCEED)


M99
%


G31 will prevent buffering. G4 "can?" prevent buffering but there's always arguments against it because it may not actually prevent it, depending on how many blocks lookahead you're running. Best to turn off any extra lookahead before doing macro math anyway.

Also I like ABS[] to compare the absolute value to a given number, since in your example you have + or - .1 tolerance. However, if you only had + or only -, or you were +.1 but -.2, then this won't work. But just an idea for cleaner code.
Dan
you were correct placing the GOTO107 before the (ALARMS) made the program run correctly. i like and tested your much cleaner version of the program and that's what i am going to use. i like how your code only needs one line of code vs my 3 lines of code, it covers + and - and works regardless if value is .11 or -7. . thank you. This alarm generator is going to be used on a 2x 400mm HMC cell connected to a FASTEMS 24 pallet system it will be run everytime after the renishaw part probe, probes the part to set the dynamic offset values. thanks again.
 
Clearly, you're calling program O1237 after Common Nonvolatile variable #601, #602, or #603 have been set. Calling a Subprogram or Macro program will actually halt buffering in relationship with the calling program even if further halt of buffering is required in the program being called.

However, in your application, where only Conditional Macro Statements are being used, halt of buffering is not required. What is achieved by having G31 between each of the Macro Statements, is that in Single Block Mode, each Macro Statement can be executed without having to set the Parameter bit to do so. This same behavior in Single Block Mode can also be achieved with G04, with or without a dwell period being specified, or simply by adding an EOB between each of the Macro Statements. Accordingly, as G04 in a stand alone Block requires an EOB, the G04 is superfluous and just the EOB will suffice to be able to execute a continuous string of Macro Statement blocks singly in Single Block Mode. This is not the same as Halting Buffering, it only affects the execution of the Macro Statements in Single Block Mode and is useful when debugging an area of a program containing a few Macro Statements without having to alter a parameter bit.

The following will work and even the N!, N2 and N3 sequence numbers are not required. However, their presence will also allow the Macro Statements to be executed singly when in Single Block mode by virtue of the EOB included with each of the Sequence Number blocks.

O1237 (ALARM GERNERATER)
N1
IF[ABS[#601]GT.1]GOTO101(#601 OUT OF RANGE)
N2
IF[ABS[#602]GT.1]GOTO102(#602 OUT OF RANGE)
N3
IF[ABS[#603]GT.1]GOTO103(#603 OUT OF RANGE)

GOTO107

(ALARMS)
N101 #3000=1 ( #601 OUT OF RANGE)
N102 #3000=2 ( #602 OUT OF RANGE)
N103 #3000=3 ( #603 OUT OF RANGE)

N107 (ALL GOOD TO PROCEED)
M99

Because operation of the Control is Halted and put into an alarm condition when #3000 is executed, its also a common and accepted practice to put the Alarm Codes after M99 as follows. With this strategy, the GOTO107 is not required.

%
O1237 (ALARM GERNERATER)
IF[ABS[#601]GT.1]GOTO101(#601 OUT OF RANGE)
IF[ABS[#602]GT.1]GOTO102(#602 OUT OF RANGE)
IF[ABS[#603]GT.1]GOTO103(#603 OUT OF RANGE)
M99
(ALARMS)
N101 #3000=1 ( #601 OUT OF RANGE)
N102 #3000=2 ( #602 OUT OF RANGE)
N103 #3000=3 ( #603 OUT OF RANGE)
%
In the above example, if none of the Conditional Statements test True and branch to the Alarm Statements, program control will revert back to the calling program via M99. Accordingly, the GOTO command is not required.

Regards,

Bill
 
Last edited:








 
Back
Top