Is CNC Macro it's own language, or would knowing other programming languages help?


Results 1 to 9 of 9

Thread: Is CNC Macro it's own language, or would knowing other programming languages help?

  1. #1
    Member Michael_Karvovski's Avatar
    Join Date
    Jun 2019
    Posts
    5
    Downloads
    0
    Uploads
    0

    Question Is CNC Macro it's own language, or would knowing other programming languages help?

    I can't find any organized regimented way of learning CNC Macro programming. There is nothing resembling this other than just 2 books written by Peter Smid and S K Sinha. Does this mean I would have to know other adjacent programming languages to really know what is going on?



  2. #2
    Community Moderator Jim Dawson's Avatar
    Join Date
    Dec 2013
    Posts
    5717
    Downloads
    0
    Uploads
    0

    Default Re: Is CNC Macro it's own language, or would knowing other programming languages help

    All programming languages are the same and all programming languages are different. Logic is logic and common to all languages. The syntax and format of languages are different and have a few different rules. But they all do the same thing: Process data to achieve an end result.

    The most powerful bit of code in any language is the ''If'' statement. All languages have this decision making functionality, only the syntax changes.

    If (some statement here)

    (If true, Execute some code here)

    Else

    (If false, Execute some code here)

    End If

    So yes, having an understanding of basic programming would be very helpful so you can structure the logic flow in a way that makes sense. Google GWBasic, this is probably the simplest language to learn to understand program flow, and is quite similar to many CNC macro languages.

    Jim Dawson
    Sandy, Oregon, USA


  3. #3
    Member Michael_Karvovski's Avatar
    Join Date
    Jun 2019
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by Jim Dawson View Post
    All programming languages are the same and all programming languages are different. Logic is logic and common to all languages.......Google GWBasic, this is probably the simplest language to learn to understand program flow, and is quite similar to many CNC macro languages.
    Thanks for the important lead!

    If the whole family of BASIC dialects applies to what you are saying, then this link will be most helpful:
    http://freecomputerbooks.com/sitemap.html

    How would you rank the Assembly language??



  4. #4
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    230
    Downloads
    0
    Uploads
    0

    Default Re: Is CNC Macro it's own language, or would knowing other programming languages help

    Um... there's quite a bit to be said here, but I only have a few minutes right now.

    There is no single standard macro language for CNC machines. Each control manufacturer has their own version. However, they do tend to copy each other somewhat, so jumping from one brand to another isn't that hard to do (however, don't expect your programs to run on one machine when they were written for another).

    Most CNC macro languages do resemble BASIC somewhat; so if CNC macro programming is what you are after, I agree that studying BASIC is a good starting point. However, for real computer programming; it's TERRIBLE!!!1! It will teach you some REALLY bad habits... so be prepared to un-learn (or set aside) about half of what you've picked up from BASIC. I would also suggest avoiding Java; at least initially; because it's frequently poorly taught.

    Assembly language is one step removed from the actual 1s and 0s that the processor chip deals with... it's basically a human-readable version of it. Mnemonic abbreviations are used; for example:
    Code:
    mov ax,5;
    add ax,7;
    The assembler program would then take your assembly language and convert it into the binary codes that can then be actually executed by the computer.

    That example above, if assembled and run on an Intel 8086 compatible processor, would put the number 5 into the CPU register AX; and then add 7 to it, leaving the result in AX.

    Because each kind of processor chip is different, there is no one single assembler language (and syntax varies between different assemblers on the same chip platform - GNU's 8086 assembler is different than Microsoft's; for example). The example above won't even assemble on an ARM processor; for one thing, ARMs don't have AX and BX registers, they have registers numbered R0, R1, etc; for another, they don't have the ability to load data in the same instruction as a math operation (they are RISC processors - they do smaller, simpler operations, but more of them per second - you would have to load the number 7 in an instruction before the add operation).

    Unless you are creating a program that must run as fast as absolutely possible (and even then, compilers these days are really good - writing in C and then hand-tuning the assembly language result is what's usually done instead of writing the whole thing from scratch in assembly language); or one that directly manipulates hardware features that higher-level languages like C can't get at; you don't need to write in assembly language. However, like knowing what pistons and gears are, even if you're not an auto mechanic; learning about it is a good idea, just so you have an appreciation of what's going on under the hood... even if you never write anything other than a simple CNC macro.





  5. #5
    Member Michael_Karvovski's Avatar
    Join Date
    Jun 2019
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default

    __Britt if you were to design a curriculum for someone, so that someone could arrive at the knowledge of Fanuc Macro programming, what would that curriculum look like? What is the best approach, given that BASIC, Java, and Assembly are not ideal in your opinion.



  6. #6
    liyary's Avatar
    Join Date
    Oct 2019
    Posts
    8
    Downloads
    0
    Uploads
    0

    Default

    Does this mean I would have to know other adjacent programming languages to really know what is going on?



  7. #7
    Member vmax549's Avatar
    Join Date
    Oct 2005
    Location
    Lady Lake
    Posts
    1145
    Downloads
    3
    Uploads
    0

    Default Re: Is CNC Macro it's own language, or would knowing other programming languages help

    Macro B is simply a conditional extention of Gcode. Best learned by learning Gcode and Macro B. It is a very simple language to learn but can be very complex when needed to do specific operations. I do not know of any other language that would help you learn it as it is directly tied to Gcode. The 2 authors you metioned seem to do a good job explaining it.

    Just a thought, (;-) TP



  8. #8
    diOuwersloot's Avatar
    Join Date
    Jan 2020
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default Re: Is CNC Macro it's own language, or would knowing other programming languages help

    Quote Originally Posted by Michael_Karvovski View Post
    I can't find any organized regimented way of learning CNC Macro programming. There is nothing resembling this other than just 2 books written by Peter Smid and S K Sinha. Does this mean I would have to know other adjacent programming languages to really know what is going on?
    Each control manufacturer has their own version. However, they do tend to copy each other somewhat, so jumping from one brand to another isn't that hard to do however, don't expect your programs to run on one machine when they were written for another



  9. #9
    diOuwersloot's Avatar
    Join Date
    Jan 2020
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default Re: Is CNC Macro it's own language, or would knowing other programming languages help

    Quote Originally Posted by Michael_Karvovski View Post
    __Britt if you were to design a curriculum for someone, so that someone could arrive at the knowledge of Fanuc Macro programming, what would that curriculum roblox music codes look like? What is the best approach, given that BASIC, Java, and Assembly are not ideal in your opinion.
    It is a very simple language to learn but can be very complex when needed to do specific operations. I do not know of any other language that would help you learn it as it is directly tied to Gcode.



  10. #10
    Member deadlykitten's Avatar
    Join Date
    Jun 2015
    Location
    Antarctica
    Posts
    4131
    Downloads
    0
    Uploads
    0

    Default Re: Is CNC Macro it's own language, or would knowing other programming languages help

    I can't find any organized regimented way of learning CNC Macro programming.
    hy karvovsky the foundation is to learn simple g-code, get familiarized with it, edit it, etc

    macro programing is about parameterizing the g-code

    this being said, share a g-code created by you, and i will show you a few tricks; you don't need to read books, nor other programing languages, because a conversation with someone that knows, may be equivalent to months of practice

    if you were to design a curriculum for someone, so that someone could arrive at the knowledge of Fanuc Macro programming, what would that curriculum look like? What is the best approach, given that BASIC, Java, and Assembly are not ideal in your opinion
    if you know g-code, and you wish to learn macros, and you are:
    ... allready familiarized with a programing language, then it will be easier for you to asimilate the macros
    ... not familiarized with a programing language, then you should not worry, because you can learn g-code directly

    if you don't know g-code, and you wish to learn macros, by learning a programing languge, then you will hit quicky into a few problems :
    ... basics of a programing languages are a bit more advanced then the basics of macros
    ... logic inside programing languages has a different flow then the ones from macros, mostly because some g'code particularities ( like labels ( N*** N01 NAT02 ) and goto's) are not recomanded inside a programing language, since they will make the source code harder to understand / maintain; a programing language is more versatile, especially when it comes to simple logic; the syntax " GOTO label N*** " was designed to jump over specific code paragraphs, or to terminate heavily nested code, and this 2 situations are approached differently in modern programing languages; in other words, only when it comes to simple reading the code, and trying to get the sense out of it, there is required a mind set for macros, and another one for programing languages; the big difference between those 2 mind sets, is that the mind set for programing is not even begining where the mind set for macro's is ending ( for macro programing you may need to know a few reserved instructions, like 'if' 'goto' '#', maybe 10...let's say 20; a programing language has hundreds; the gap between the ease of use between "pc programing" and "cnc's macros", is that there are tools, material's, machines and, you know, real stuff involved ) / kindly

    we are merely at the start of " Internet of Things / Industrial Revolution 4.0 " era : a mix of AI, plastics, human estrangement, powerful non-state actors ...


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Is CNC Macro it's own language, or would knowing other programming languages help?

Is CNC Macro it's own language, or would knowing other programming languages help?