![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Parametric Programing (custom macro b, fadal macro, okuma user task) |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
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? |
|
#2
| |||
| |||
| 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 |
|
#3
| |||
| |||
| Regards, Bill |
|
#5
| |||
| |||
| 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. |
| Sponsored Links |
|
#7
| |||
| |||
|
__________________ Control the process, not the product! Machining is more science than art, master the science and the artistry will be evident. |
|
#8
| |||
| |||
| 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 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. |
|
#9
| |||
| |||
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. |
|
#10
| ||||
| ||||
![]() 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 |
| Sponsored Links |
|
#11
| |||
| |||
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
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 |