CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > Fanuc


Fanuc Discuss Fanuc controllers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 02-19-2009, 11:36 PM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road
macro format error while using boolean functions

The book by Peter Smid on Fanuc Macro uses statements like
#5 = [#1 EQ #2] on page 125.
This,however, gives MACRO FORMAT ERROR on my 0i Mate TC.
Is there a parameter which can be used for allowing such statements (assigning 1 for TRUE and 0 for FALSE)? Or, is Peter Smid wrong?
Reply With Quote

  #2   Ban this user!
Old 02-20-2009, 04:33 AM
 
Join Date: Feb 2009
Location: india
Posts: 48
chetan is on a distinguished road
Cool

Hi sinha

I dont know about peter smid. i think you should use g65 command which is actual macro command in fanuc. If you need it i can help you in that.

Regards
Reply With Quote

  #3   Ban this user!
Old 02-20-2009, 08:14 AM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

Sinha,
I have never seen a macro statement like that before. I have not read Peter’s book so I don’t know what he is trying to refer to in that statement. When using the EQ, LE, GE, statements this is usually to go to certain area’s in the program or to set a certain number.

Example
IF[#1EQ#2]GOTO100
G0G28Z0
N100M30

In this statement if variable #1 was equal to variable #2 then the program would jump to N100 line and end the program with the M30. However if variable #1 was NOT equal to #2 then the program would go to the next line of G0G28Z0 then end the program with M30.

Or you can use the format of IF[#1EQ#2]TH#5=10. This will set #5=10 if #1 is the same as #2. If it is not then nothing will change with #5.

#5=[#1EQ#2] is not a proper format of a macro for a Fanuc control that is why you are getting the alarm. The only thing that I can think is maybe the EQ is suppose to be a +. Then #5 would be set to the sum of #1+#2.

Chetan,
The G65 is a macro “call” not a function that you turn on and off to use the variables. The G65 is a way of passing data to your local variables. For example a few of the local variable assignment is A=#1, B=#2, C=#3, D=#7. So if you wanted to write a statement using your macro call you would format it like this.

O0001(main program)
G65P8000A5B10D4C35
M30

What this code will do is call program 8000 just like a sub program using M98 except #1 would equal 5, #2=10, #3=35, #7=4. You then write your 8000 program using these variables.
O8000
G0G90X#1Y#2Z#7
G1Z-#3
G0Z#7
M99

Stevo
Reply With Quote

  #4   Ban this user!
Old 02-20-2009, 08:36 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

Smid believes that TRUE is equivalent to decimal value 1, and FALSE is equivalent to decimal 0. But actually it is not so, unless there is a parameter for such an interpretation.
Reply With Quote

  #5   Ban this user!
Old 02-20-2009, 09:05 AM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

Originally Posted by sinha_nsit View Post
Smid believes that TRUE is equivalent to decimal value 1, and FALSE is equivalent to decimal 0. But actually it is not so, unless there is a parameter for such an interpretation.
I have no idea what that means . Can you explain what that means? So when something is false it is =1. and if something is true it is =0. I don't follow you. I do extensive macros and I have never even seen that in the Pascal format. Am I missing something or misunderstanding what your saying?

Stevo
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 02-20-2009, 10:35 AM
viorel26's Avatar  
Join Date: Jun 2007
Location: Romania
Age: 31
Posts: 102
viorel26 is on a distinguished road

sinha_nsit post Peter’s book page 125
#5 = [#1 EQ #2] on fanuc is a MACRO FORMAT ERROR
see stevo1 example for corect format

stevo1
other use of G65 on Fanuc with Macro A
G65 H81 P1000 Q#101 R#102 ( IF[#101EQ#102]GOTO1000 )
Reply With Quote

  #7   Ban this user!
Old 02-21-2009, 12:17 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

Originally Posted by stevo1 View Post
I have no idea what that means . Can you explain what that means? So when something is false it is =1. and if something is true it is =0. I don't follow you. I do extensive macros and I have never even seen that in the Pascal format. Am I missing something or misunderstanding what your saying?

Stevo
Ok, I have copied exactly what is given in the book:

Boolean and Binary Examples

As an exercise, evaluate the following macro data entries. The first group is the given data, the second group is the evaluated data, and the final third group is the compared data.

Given data:

#1 = 100.0 Stored value is 100.0
#2 = #0 No data - variable is VACANT
#3 = 100.0 Stored value is 100.0
#4 = 150.0 Stored value is 150.0

Evaluated data:

#5 = [#1 EQ #2] Returns 0 = FALSE
#6 = [#2 EQ #3] Returns 0 = FALSE
#7 = [#2 EQ #0] Returns 1 = TRUE
#8 = [#1 EQ #3] Returns 1 = TRUE
#9 = [#4 GT #3] Returns 1 = TRUE

Compared data

#10 = [[#1 EQ #3] AND [#2 EQ #0]] TRUE, because both values are true

etc.

My observations:
What he writes on the right-hand side of = is OK, but TRUE or FALSE values cannot be assigned to variables which can only store arithmetic values. Smid believes that when TRUE is assigned to a variable, the variable stores 1. Similarly, assigning FALSE to a variable makes the variable store 0. At least on my machine, with the current parameter setting, this gives MACRO FORMAT ERROR (alarm no 114). I could not find any parameter in the parameter manual for such an interpretation of TRUE and FALSE. TRUE and FALSE are boolean values, and cannot be mixed up with arithmetic values.
Reply With Quote

  #8   Ban this user!
Old 02-21-2009, 01:41 AM
 
Join Date: Feb 2009
Location: india
Posts: 48
chetan is on a distinguished road

Originally Posted by stevo1 View Post
Sinha,
I have never seen a macro statement like that before. I have not read Peter’s book so I don’t know what he is trying to refer to in that statement. When using the EQ, LE, GE, statements this is usually to go to certain area’s in the program or to set a certain number.

Example
IF[#1EQ#2]GOTO100
G0G28Z0
N100M30

In this statement if variable #1 was equal to variable #2 then the program would jump to N100 line and end the program with the M30. However if variable #1 was NOT equal to #2 then the program would go to the next line of G0G28Z0 then end the program with M30.

Or you can use the format of IF[#1EQ#2]TH#5=10. This will set #5=10 if #1 is the same as #2. If it is not then nothing will change with #5.

#5=[#1EQ#2] is not a proper format of a macro for a Fanuc control that is why you are getting the alarm. The only thing that I can think is maybe the EQ is suppose to be a +. Then #5 would be set to the sum of #1+#2.

Chetan,
The G65 is a macro “call” not a function that you turn on and off to use the variables. The G65 is a way of passing data to your local variables. For example a few of the local variable assignment is A=#1, B=#2, C=#3, D=#7. So if you wanted to write a statement using your macro call you would format it like this.

O0001(main program)
G65P8000A5B10D4C35
M30

What this code will do is call program 8000 just like a sub program using M98 except #1 would equal 5, #2=10, #3=35, #7=4. You then write your 8000 program using these variables.
O8000
G0G90X#1Y#2Z#7
G1Z-#3
G0Z#7
M99

Stevo
Hi

You are saying that is different.There are two types of macro body A type and Btype . what i mean to say is just see below

N0....start of the program
.
.
G65 H02 P#100 Q#100 R1 ( this balock will add 1 input in the variable #100)
G65 H82 P0 Q#100 R10 ( this block will see that variable #100 is equal to 10 or not
if it is not equal then it will go to N0
if it is equal then it will go to next block)
G65 H01 P#100 Q0 ( in this variable #100 is made equal to zero)
M30 (end of the program)

The above sample i had used for running the program 10 times i.e. for 10 jobs.
H02 is for addition
H01 is for equal
H82 is for conditional divergence.

This works 100%

Last edited by chetan; 02-21-2009 at 02:17 AM.
Reply With Quote

  #9   Ban this user!
Old 02-23-2009, 07:06 AM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

Originally Posted by sinha_nsit View Post
I could not find any parameter in the parameter manual for such an interpretation of TRUE and FALSE. TRUE and FALSE are boolean values, and cannot be mixed up with arithmetic values.
You are correct. Are you using macro A or B? I don't use macroA so I can no explain or answer for any of the different funcitons that this may have compared to macroB. If I wanted to set a value to #10 if #1 and #2 were the same I would use IF[#1EQ#2]THEN#10=1. Maybe it is done how the book explains because I don't think macroA supports the IF or GOTO statments.


Originally Posted by chetan View Post
I dont know about peter smid. i think you should use g65 command which is actual macro command in fanuc. If you need it i can help you in that.
Chetan,
I am not saying that you are incorrect with your programming that you gave in your last post. I would assume that you are using macroA? However with your post you made here you made it sound like you need to activate G65 in order to use the line of code Sinha_nist originally posted "#5 = [#1 EQ #2] page125". You can use variables or calculation lines anytime in a main or sub program not needing to use G65 at all.

Stevo
Reply With Quote

  #10   Ban this user!
Old 02-23-2009, 09:32 PM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

My machine has Macro B.

The book also claims to have been written for "Fanuc Custom Macro B users".

Are you people aware of any other book on Macro B, which describes it in detail, not just as a 10-page Chapter in a conventional programming book?

I have heard about Mike Lynch's book, but it is too expensive, above $90. Mike Lynch is a big name, but I have no idea about his book. Any comment from you? Any other good book?
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 02-24-2009, 12:47 AM
 
Join Date: Feb 2009
Location: india
Posts: 48
chetan is on a distinguished road

Originally Posted by sinha_nsit View Post
My machine has Macro B.

The book also claims to have been written for "Fanuc Custom Macro B users".

Are you people aware of any other book on Macro B, which describes it in detail, not just as a 10-page Chapter in a conventional programming book?

I have heard about Mike Lynch's book, but it is too expensive, above $90. Mike Lynch is a big name, but I have no idea about his book. Any comment from you? Any other good book?
Hi

I think you you should use common variables instead of local variables. I dont know much about this, it is just suggestion. Infact i need to know is there any diff bet them.
Reply With Quote

  #12   Ban this user!
Old 02-24-2009, 12:56 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

If you have used some programming language such as Pascal, it would be easy to understand.
Local variables are same as local variables of a Fortran subroutine (called Procedure in Pascal).
Common variables are global variables which can be use everywhere with the same meaning.
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Boolean Operation with a Mesh chaddcurtis Rhino 3D 10 02-22-2011 02:08 PM
Macro Syntex Error??? jamesweed Fanuc 5 02-20-2009 01:02 AM
Need Help!- V22 Boolean Subtract TZ250 BobCad-Cam 12 12-03-2008 01:11 AM
Boolean camtd SolidEdge 0 09-21-2008 06:31 PM
Boolean Feature svenakela SolidEdge 2 08-27-2007 09:18 PM




All times are GMT -5. The time now is 01:53 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361