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 > G-Code Programing > Parametric Programing


Parametric Programing (custom macro b, fadal macro, okuma user task)


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 10-28-2011, 01:50 PM
 
Join Date: Oct 2011
Location: USA
Posts: 2
millmasterflex is on a distinguished road
Deciphering Help

We have an exsiting program that has some interesting features which I could some help in decipering what each line is doing. Any help would be greatly appricated.

Beginning of program:

IF[#503 GE #502] GOTO777 - What is GE?
IF[#502 GT ***] GOTO778 - What is GT ***?
IF[#500 LT *] GOTO779 - What is LT *?

#19=#503 - What is this?
#5=*
#2=*
#14=0
G90 G10 L2 P3 X#5221 Y#5222 Z#5223 (G54 XYZ TO G56) - And all this?
WHILE [#14 LT #502] DO1 - This?
#10=0 - And this?
G90 G10 L2 P3 X#5221 (G54 X TO G56) - And this?
WHILE [#10 LT **] DO2 - And this?

Regular code here....
Before Tool change ...

G91 G10 L2 P3 X#5 - Not sure what this does.
G90
#10=#10+1 - Or this
#19=#19+1 - Or this
#14=#14+1 - Or this
IF[#19 GE #502] GOTO 102 - Or this
END2

G91 G10 L2 P3 Y#2 - Or this
G90

Then there is a tool change call out and the following...

#19=#503
#5=*
#2=*
#14=0
G90 G10 L2 P3 X#5221 Y#5222 Z#5223 (G54 XYZ TO G56)
WHILE [#14 LT #502] DO1
#10=0
G90 G10 L2 P3 X#5221 (G54 X TO G56)
WHILE [#10 LT **] DO2

Any help on the above would be great!

Regular code and then pretty much all the above repeats again. Who's the guru here that can decipher this code?
Reply With Quote

  #2   Ban this user!
Old 10-28-2011, 08:20 PM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

Oh boy....that is a lot of explanations. Sinha.....I think he needs your book!!!

First off welcome to the forum.

Second I have to say I do not know what the *** are for in your code and how this would even logicly function.

GE means “Greater than or Equal To”
GT means “Greater Than”
LT means “Less Than”
GOTO means “Go To”

What you are seeing in your program with #19 or any other #() are variables. These variables hold values that that the program specifies. As an example if you were to program #19=5 and then go look at your variable settings thru the settings screen you will find that #19 is equal to 5. Now if you were to program a G0X#19 it would be like programming G0X5 because #19 is set to 5

This is really just skimming the surface of macroB programming.

Now the GE, GT, LT, GOTO, WHILE…DO statements are all conditions of the program and are read really as explained above. What you posted is not a complete program as the conditions at the beginning have no address to go to if they prove true. Lets use the following code as an example of what this means.

(main program)
#19=5
#20=2
IF[#19EQ5]GOTO100
G0X#2
N100M30

In the first 2 lines macro variable #19 is being set =5 and #20 is being set =2. The IF statement is saying If #19 is equal to 5 got to address N100. In this program #19 is set equal to 5 so the IF statement is true and the program will skip everything else and go directly to address N100 and read M30 and end the program. If you were to change #19 to be say 4 then the IF statement will be false and will not go to N100 and instead read the next line of G0X#2 which is G0X2 and continue on to the N100M30 and end your program.

You basically have to substitute your #() numbers for what the value of them are. When the program runs and #20=5 and your line of code is G0X#20 once it reads this line it will take the #20 and make it 5 reading G0X5

WHILE statements are more tricky and if you do not grasp what is posted above you will have a tuff time understanding what this means until you do.

#19=0
WHILE[#19LT5]DO1
G0G91X1.
#19=#19+1
END1
M30

What the WHILE statement does is run between the WHILE and DO until the WHILE statement is true. So the above code sets #19=0 then jumps into the loop. #19=0 so it will move the X 1” at the G0G91X1. Line and then read #19=#19+1 which we know it was =0 and now it adds 1 to the value making #19=1 but the WHILE statement is not satisfied because it is still less than (LT) 5. So it will go back to the G0G91X1. Line moving the machine again and then reading #19=#19+1. #19 in the last run thru was =1 so now it is equal to itself +1 which makes it =2 and once again not satisfying the WHILE statement because #19 is still less than 5. This will keep adding until #19 is no longer less than 5 and once that happens it will leave the loop and go to the block directly after the END1 line which is M30 ending your program.

The G91G10L2P3 is setting a workcoordinate. G10 is the code to do theis, L2 is the registry of the workcoordinate and the P3 is the coordinate number which is G56 so if you program G91G10L2P3X2. It will add 2 to the X value in G56 now it is using #5 so if #5 is =2 it will do the same thing. To explain G10…if you were to useP2 instead it would set G55 and P1 would be G54. L2 means to change the coordinate but you can use a different L() to change tool offsets or parameters.

Hope this helps.
Stevo
Reply With Quote

  #3   Ban this user!
Old 10-28-2011, 09:49 PM
 
Join Date: Sep 2010
Location: Australia
Posts: 733
angelw is on a distinguished road

Originally Posted by stevo1 View Post

Second I have to say I do not know what the *** are for in your code and how this would even logicly function.

Stevo
You're right Stevo, code like IF[#502 GT ***] GOTO778 will result in a syntax error. At a guess, I'd say that its a visual prompt to replace with varying data. But why you would not use a variable and some commented notes to set the variable, who knows.

Regards,

Bill
Reply With Quote

  #4   Ban this user!
Old 10-29-2011, 03:29 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

Systematic study is needed. See the attachments for basic information on macro programming. These are not my notes.
Attached Thumbnails
Click image for larger version

Name:	macro.jpg‎
Views:	50
Size:	168.7 KB
ID:	145031  
Attached Files
File Type: pdf Macro Programming Reference.pdf‎ (104.5 KB, 28 views)
Reply With Quote

  #5   Ban this user!
Old 10-30-2011, 06:16 PM
 
Join Date: May 2007
Location: USA
Posts: 913
g-codeguy is on a distinguished road

You definitely need to buy sinha's book. As a cheaper alternative you could buy Peter Smid's book. However, it is my understanding that sinha's book gives more detailed examples. Haven't purchased it yet myself, but will eventually invest in one. I had Peter Smid's book before sinha wrote his. The Fanuc Operator's Manual gives examples, but in my opinion is harder to understand. Once you do have a handle on how to use Macros, then it becomes easier to understand Fanuc's explanations.

I think you will find using macros to be not only fun, but a great programming tool. I'm always looking for a new way to incorporate macros into my programming.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 10-31-2011, 07:18 AM
 
Join Date: Oct 2011
Location: USA
Posts: 2
millmasterflex is on a distinguished road

Thanks so much for the help guys!! Really appreciate it!

What is this sinha book people are referring to? Looks like I need to get a copy.
Reply With Quote

  #7   Ban this user!
Old 10-31-2011, 11:47 AM
 
Join Date: Feb 2008
Location: The Edge of Obscurity
Posts: 229
ProProcess is on a distinguished road

Originally Posted by millmasterflex View Post
Thanks so much for the help guys!! Really appreciate it!

What is this sinha book people are referring to? Looks like I need to get a copy.
From Amazon From Amazon
__________________
Control the process, not the product!
Machining is more science than art, master the science and the artistry will be evident.
Reply With Quote

  #8   Ban this user!
Old 11-01-2011, 04:42 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

I could not really understand the US book market.

There is one seller (---SuperBookDeals) which sells this book for as low as $17.11.
There is another (alibris) which sells it for $60.00

Amazon.com: CNC Programming using Fanuc Custom Macro B (9780071713320): S.K Sinha: Books Amazon.com: CNC Programming using Fanuc Custom Macro B (9780071713320): S.K Sinha: Books

Why is there so much difference in price? Moreover, if one can get it for 17.11 why would anybody purchase it for 60.00? Both the prices are for new book.
Reply With Quote

  #9   Ban this user!
Old 11-01-2011, 08:24 AM
 
Join Date: Feb 2008
Location: The Edge of Obscurity
Posts: 229
ProProcess is on a distinguished road

Originally Posted by sinha_nsit View Post
I could not really understand the US book market.

There is one seller (---SuperBookDeals) which sells this book for as low as $17.11.
There is another (alibris) which sells it for $60.00

Amazon.com: CNC Programming using Fanuc Custom Macro B (9780071713320): S.K Sinha: Books

Why is there so much difference in price? Moreover, if one can get it for 17.11 why would anybody purchase it for 60.00? Both the prices are for new book.
Those are the strange anomalies of a free market society.
It's up to the purchaser to decide whom to buy from and how much they are willing to pay.
If a seller is not selling a particular product it's up to them to change the price to a level that buyers are willing to pay.
__________________
Control the process, not the product!
Machining is more science than art, master the science and the artistry will be evident.
Reply With Quote

  #10   Ban this user!
Old 11-01-2011, 08:23 PM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

Originally Posted by angelw View Post
You're right Stevo, code like IF[#502 GT ***] GOTO778 will result in a syntax error. At a guess, I'd say that its a visual prompt to replace with varying data. But why you would not use a variable and some commented notes to set the variable, who knows.
I was assuming the same thing. I was more thinking that this was not an actual program in the control but something to reference and fill in the blanks if you will.
Originally Posted by sinha_nsit View Post
I could not really understand the US book market.
Why is there so much difference in price? Moreover, if one can get it for 17.11 why would anybody purchase it for 60.00? Both the prices are for new book.
Hey Sinha.....you still have your book out there correct? I see you have it listed and the MTH forum. I was thinking about picking up another copy as I have lent mine out a few times to some fellow friends that are getting into the trade (well macros anyway). I also have my brother and his family coming into town from Europe and it is nice to have something lying around that has me published so I can at least keep up with my brothers well doing. Nothing like saying "good for you but are you published".....

Originally Posted by millmasterflex View Post
Thanks so much for the help guys!! Really appreciate it!
You are welcome. Ask all you want....everyone here is more then willing to help. I would suggest picking up Sinha's book as it is a very good book for starting with basics of macroB programming and will cover in detail every question you asked in your first post.

Stevo
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 11-07-2011, 06:41 PM
 
Join Date: May 2007
Location: USA
Posts: 913
g-codeguy is on a distinguished road

Originally Posted by sinha_nsit View Post
I could not really understand the US book market.

There is one seller (---SuperBookDeals) which sells this book for as low as $17.11.
There is another (alibris) which sells it for $60.00

Amazon.com: CNC Programming using Fanuc Custom Macro B (9780071713320): S.K Sinha: Books

Why is there so much difference in price? Moreover, if one can get it for 17.11 why would anybody purchase it for 60.00? Both the prices are for new book.
I finally ordered a copy for myself. A quick search found copies marked as high as $76 and $96. I opted for a copy costing much less. Looking forward to reading it.
Reply With Quote

  #12   Ban this user!
Old 11-14-2011, 05:47 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

Take the print of the additional appendices attached here which are not there in the book. These are helpful references.
Attached Files
File Type: pdf Appx C List of Macro Variables.pdf‎ (32.3 KB, 19 views)
File Type: pdf Appx D Argument Specification I.pdf‎ (9.8 KB, 16 views)
File Type: pdf Appx E Argument Specification II.pdf‎ (8.6 KB, 16 views)
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
Need help in DECIPHERING ENCODER WIRES from a rotary table ichudov CNCzone Club House 3 08-02-2010 08:53 PM
Help deciphering this encoder - Aerotech DC1000 yantra3d Servo Motors and Drives 5 02-11-2010 03:36 PM




All times are GMT -5. The time now is 01:05 AM.





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