What's new
What's new

using variabloes with a Fadal

Tommy Dean

Plastic
Joined
Nov 19, 2019
Hello everybody I love reading this page, I`m learning a lot. I`m trying to teach myself how to program a Fadal CNC mill. I`m very familiar with old (now outdated) DOS computer programming, and am trying to use some of those ideas on my mill. A lot of the program lines look very familiar. By looking at other`s programs, I see lot of lines being repeated, which can make a small task turn into a huge program. For example, if you wanted to cut .020" off of something, the repeat the process 5 times to end up with .100" removed, the programs I see will list the command to cut off .020", then a command to lower the Z axis .020" then the command again, and again, so the command to cut off .020" was actually typed in 5 times.
What I`m trying to do, is use variables to repeat the same command several times. A youtube video that I watched says to use a variable for the X, Y, and/or Z, and then a "GOTO" command, such as this:

(in this simple example, I would expect the machine to move 2" back and forth cutting .020" off each time forever until I stop the program)

n100 #101 = 8.00 (random start position for example only)
n200 G01 z[#101] (Z goes to the position 8.0)
n300 X4.0 (x goes to the position 4.0)
n400 #101 = [#101-.020] (change variable)
n500 z[#101] (z drops down .020"}
n600 x 2.0 (x heads back to where it started)
n700 #101 = [#101-.020] (change variable)
n800 z[#101] (z drops again down another .020
n900 GOTO n300 (head back up and do it all over)

I know this program won`t work because it won`t even let me send it to the mill using my computer & a serial cable. Am I even close? Thank you for any input, from a CNC rookie, Tom
 
You're correct in thinking that you can do parametric/variable coding for CNC machining, and much of what you learned about programming computers still applies (IF/THEN, DO/WHILE, VALUE++, etc)...

However, the specific syntax that your Fadal needs is beyond me, as I've never touched one.

Don't worry, lots of Fadal gurus around here, someone will straighten you out.
 
As you found out, you dont have the correct syntax. (It looks like your code is more like what a fanuc control would want)

Do a google search for 'fadal manual'
Look in the user manual and read the section on Macro programming. There will be examples and descriptions to help you get it correct.

It helps to make a small simple program first to make sure it runs and debug if theres an issue, then build on that once its working.

Sent from my SM-G930P using Tapatalk
 
I used to do parametric programming on a Fadal using the macro language all the time. BIG hint, it is based on Microsoft Basic! I did a program that cut a 15 degree tapered pocket 12"x18" and 7" deep with overcut corners in HR steel. First pass roughing with an insert cutter, then finish with solid mill with a radius at 0.010" steps. Tested the program by changing the parameters and cutting a 1"x2" tapered pocket 1/2" deep in aluminum. Whole program was about 50 lines. I'd love to send you an example but it has been 20 years!

Another hint. Create subroutines and pass the parameters into the subroutine using the variables. My programs were frequently for just a couple parts. I had a variable for Safe Z that I always set at about 6" because I often didn't know how the operator was clamping the part. He could change that variable and it would change everywhere. Or he could search on it and replace it with a fixed value in certain operations. Hope this helps.

Life is too short to program that way anymore. On my homebuilt machine and the bedmill at work we use CamBam for $149. It sure as hell isn't MasterCam but it saves me a ton of time and makes changing to different tool when I break one so much easier. 40 sessions before you buy, nothing to lose trying it.
 
How about fusion 360 it’s free and probably a lot safer for your machine backplot it out before you crash your money printing machine
Don


Sent from my iPhone using Tapatalk Pro
 
Thanks for the response. But what I`m still missing is the syntax that works. For example, if I wanted the Z axis to go to the variable number, something like - G01 Z[#101]. I`m not sure if that`s the correct syntax. Or it was suggested to me that the variable needs to be an R number, like Z[R1} or something like that. And the GOTO line doesn`t work, what`s the proper syntax for "GOTO" ?
 
Yes, Fusion 360 is great, and I`ve used that. I`m trying to do some very simple cutting, thought it would be easier to just type in a couple lines. ....having problem getting the correct syntax for the few lines... Thanks.
 
Have you found the info you are looking for? i have a Fadal book with a macro/Parametric programming section, if needed i could provide some info.
 
No I haven`t found the info I`m looking for yet. I`m pretty sure I`m on the right track, just need to know the correct syntax to type it in. I think the "GOTO" command will work, but I`m thinking there`s another word used instead of "GOTO". Also, the variables might have to be a letter & a number, like R1 or something like that. Any help you could give would be greatly appreciated. Thanks.
 
No I haven`t found the info I`m looking for yet. I`m pretty sure I`m on the right track, just need to know the correct syntax to type it in. I think the "GOTO" command will work, but I`m thinking there`s another word used instead of "GOTO". Also, the variables might have to be a letter & a number, like R1 or something like that. Any help you could give would be greatly appreciated. Thanks.

Hello Tommy,
GOTO is used in the Fadal Macro Language. It can be used with either a Line Sequence Number, of a Label; an example of each follows:

N5
-----------
-----------
-----------
#GOTO N5 (GOTO a Line Number)



#:LOOP
-----------
-----------
-----------
#GOTO :LOOP (GOTO a Line containing a LABEL)

Following is an example of repeating an X/Y profile to a Full Depth at a specified DOC

#V1=0.0 (Z Start Level)
#V2=-2.0 (DOC)
#V3=-11.0 (Full Depth)

#:LOOP
#V1=V1+V2 (Increment DOC)
#IF V1 < V3 THEN V1 = V3 (Prevent Over Cutting in Z)
G01 Z V1 F_ _

(X/Y Profile Starts Here)
-------------
-------------
-------------
-------------
(X/Y Profile Ends Here)

#IF V1 > V3 THEN GOTO :LOOP

Note, that in the above example, the Full Depth doesn’t have to be evenly divisible by the DOC. Accordingly, the DOC can be changed without consideration of the Full Depth.



Regards,

Bill
 
Last edited:
Hello Tommy,
GOTO is used in the Fadal Macro Language. It can be used with either a Line Sequence Number, of a Label; an example of each follows:

N5
-----------
-----------
-----------
#GOTO N5 (GOTO a Line Number)



#:LOOP
-----------
-----------
-----------
#GOTO :LOOP (GOTO a Line containing a LABEL)

Following is an example of repeating an X/Y profile to a Full Depth at a specified DOC

#V1=0.0 (Z Start Level)
#V2=-2.0 (DOC)
#V3=-11.0 (Full Depth)

#:LOOP
#V1=V1+V2 (Increment DOC)
#IF V1 < V3 THEN V1 = V3 (Prevent Over Cutting in Z)
G01 Z V1 F_ _

(X/Y Profile Starts Here)
-------------
-------------
-------------
-------------
(X/Y Profile Ends Here)

#IF V1 > V3 THEN GOTO :LOOP

Note, that in the above example, the Full Depth doesn’t have to be evenly divisible by the DOC. Accordingly, the DOC can be changed without consideration of the Full Depth.



Regards,

Bill

Bill,
Thanks for the info. I managed to get the "GOTO" command to work, but not the " G01 Z V1 F_ _ " line. I assumed that the F was feedrate, so I put a number in there, but it still got an error. I also tried a pound sign in front of it, since that`s what fixed the GOTO that wouldn`t work, but no luck yet. I still can`t use a variable with a G01 command to move one of the axis. Any ideas?
 
I found this example in the Fadal book, i know it is for drilling, but, i thought what the heck? maybe it will help.IMG_1498.jpgIMG_1500.jpg
 
Yes indeed, looks like this may be what I was looking for. Appears that the pound sign and plus sign are important.... I`ll give it a try again. Thank you very much. .... Tom
 
I had hoped to forget all the BS I learned about Fadals, but here is one thing I think I recall.

V variables are not allowed in NC lines. You have to move them to R variables.

Try changing Bill's example to.....

#IF V1 < V3 THEN V1 = V3 (Prevent Over Cutting in Z)
#R9 = V1
#G01 Z+R9 F_ _
 
Last edited:
That explains alot. I will try that. Good thing there are people out there that are smarter than me, I would have never guessed something like that. :) Thanks, Tom
 
Well that didn`t work either. My program crashes with any use of an R variable. I remember reading something awhile back about some kind of an option when the machine is bought that enables the machine to use macros and variables. I`m beginning to wonder if my machine is even capable of it. I guess I have more research to do. If anybody else has heard of this option, and how to check my machine for it, I`d appreciate that. Thanks for all of your help. ....Tom
 
After doing more reading, I see why a couple people mentioned above to just skip the programing and use Fusion 360. Holy cow it gets complicated real fast....
 
After doing more reading, I see why a couple people mentioned above to just skip the programing and use Fusion 360. Holy cow it gets complicated real fast....

I'm sure you already know this, all the the Fadal manuals are availible for download (free) at Fadalcnc.com
 
I'm sure you already know this, all the the Fadal manuals are availible for download (free) at Fadalcnc.com

Yes I see that, that`s where I was reading. I might be trying to type a simple program that isn`t simple at all. Looks like I have more to learn...
 








 
Back
Top