585,708 active members*
3,902 visitors online*
Register for free
Login

Thread: Basics

Results 1 to 11 of 11
  1. #1
    Join Date
    Nov 2004
    Posts
    14

    Basics

    Murphy,
    Would you please describe in chronological order what happens when a M08 or G01 code is activated. please include input, logic, variable (access and how to define or set variable) and output. Only one example would give me the idea of where to start. Include any process's or macros that are applicable. The information with cnc lite can be vague at times.
    Application-----Bridgeport mill with 3 servos.
    Any help would be greatly appriciated.
    Thanks.
    Plateroomred

  2. #2
    Join Date
    Nov 2004
    Posts
    446

    I wish I could but I know nothing about G codes..

    I do not use G codes in my program.. Everything my program does is hard-coded with my own code writing.

    If you post the code, I might be able to give you some help but as I said, my machine is NOT a typical CNC machining center.

    I only use CNC controls to operate my machine/process but it has nothing to do with actual machining.

    If you post the code, I might be able (should be able) to give you an idea of what is going on with it.

    I wish I could be more helpful..
    Also, just so you know, you got lucky I saw your post because I do not log into this forum as often. Most, if not all, of my problems have been solved and my learning curve is pretty much flat at this point so I dont use the forum so much anymore. Knowing you are looking for help, I will check back shortly to see if I can assist you.

    Murphy

  3. #3
    Join Date
    Jul 2003
    Posts
    33
    This is one I could even answer.

    I got this info right out of the manuals.

    INPUTS/OUTPUTS is the # character.
    You can read the ON/OFF state of any input or output with the # character. You can also set the state of any output to On or Off, but you cannot set an Input because they are read only. 0 means Off and 1 means On.
    EXAMPLE: #1=1

    VARIABLES are the \ character.
    You can have up to 999 variables from \1 through \999 to store any set of numbers, characters or word/number combinations.
    \123=.999

    The controller does have the ability to store unlimited variable names. A legal variable name is a name that begins with any letter of the alphabet. To save a value to a variable in a G Code program, enclose the math and the variable name followed by an equal sign (=) inside curly braces {}. For example, to store 5.5 to the variable KEEPME: {KEEPME=5.5}

    For example, to do math to an existing X axis coordinate in a G Code line where X needs to have .75 added to its value, write the G Code line like this:

    N100 G01 X{5.5+.75} Y6.2 F30

    For example, to add the value of a variable to an existing X axis coordinate in a G Code line, enter: N100 G01 X{5.5+KEEPME} Y6.2 F30

    G01 and M08 does what ever you want it to do. In most CBK files for default machines G01 moves the axes in a linear motion using the GO command internally or for CNC Lite/Plus it just moves as a industry standard G01 would do.

    You can look up each command in your M08 MCODE.FIL file to see what your is doing and modify it if you want.

    Bob

  4. #4
    Join Date
    Mar 2004
    Posts
    1542
    I'll discuss how flood is set up on my knee mill, similar to yours. I'm sure yours is not set up this way (yet)

    Here's the M08 and M09 code:


    'coolant on
    IF #18=1 THEN #33=1:LIGHT 9;ON
    IF #18=0 THEN MESSAGE Flood switch is off
    -----M8

    'coolant off
    #33=0
    LIGHT 9;OFF
    -----M9

    There's also this lines in the inputio.fil:

    IF #18=0 THEN #33=0:LIGHT 9;OFF 'Turn off flood

    IF #19=0 THEN #33=0:LIGHT 9;OFF 'Turn off flood
    IF #19=1 THEN #33=1:LIGHT 9;ON 'Turn on flood


    The hardwiring is:

    A three position (on1-off-on2) toggle switch is hooked up to inputs #18 and #19. The on position is connected to input#19 and the auto to #18. It is labelled "Flood ON-OFF-AUTO. #33 output powers the flood coolant pump(thru a relay).

    The program:

    The first line in M08 (IF #18=1 THEN #33=1:LIGHT 9;ON) checks to see if flood is in the auto position, then powers output #33, turning on the flood coolant pump. A light is also lit on the screen. If the positon switch is not in AUTO the coolant does not come on.
    The second line(IF #18=0 THEN MESSAGE Flood switch is off) sends a message to the display if the coolant switch is not in the auto position.

    Extra credit (inputio):

    Lines in the inputio file run only when an input changes state.

    IF #18=0 THEN #33=0:LIGHT 9;OFF 'Turn off flood
    runs if move the flood switch to off from AUTO - it turns off the coolant pump and light on the screen

    IF #19=0 THEN #33=0:LIGHT 9;OFF 'Turn off flood
    runs if move the flood switch to off from ON- it turns off the coolant pump and light on the screen

    IF #19=1 THEN #33=1:LIGHT 9;ON 'Turn on flood
    runs if move the flood switch to on - it turns on the coolant pump and light on the screen


    This is handy for the operator, he can turn the flood on and off with both a switch and the M08 and M09 code.

    Karl

  5. #5
    Join Date
    Nov 2004
    Posts
    14

    Very Helpfull

    To all replies,
    Thank you very much, I have already had success with some of the M codes. All of your suggestions helped for me to get a better understanding of some of the basics. But I still have a ways to go.
    Once again Thanks,
    Plateroomred

  6. #6
    Join Date
    Nov 2004
    Posts
    446
    Post some more questions.. We (I) will be happy to do our best to move you along.

    I owe this forum allot for the information I have got from it. I need to pay it back.. LOL..

    Post away!!

  7. #7
    Join Date
    Nov 2004
    Posts
    14

    Thanks for the offer Murph

    Murphy625,
    I am still having a hard time getting a grasp of this variable thing. I sure would appreciate your take on it, even if it doesnt directly apply to my 3 axis Bridgeport.
    Thanks Again,
    Plateroomred

  8. #8
    Join Date
    Apr 2003
    Posts
    332
    plateroomred,

    Hopefully this Larry (we won't disclose your full name) but, if so your package is relatively new, although there has been a version update that we can give you, so you are more than welcome to call us or write down your questions to us here at CamSoft tech support. Don't worry that your questions are basic, we will show you how to find the answers or examples by electronically searching using the Search for Solutions button. You can search for answers using key words like a web-browser faster than you can log onto CNC Zone. Even if they are un-orthodox we can provide an example.


    Tech Support
    CamSoft Corp.
    (951) 674-8100
    [email protected]
    www.cnccontrols.com
    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  9. #9
    Join Date
    Nov 2004
    Posts
    446
    Ok.. I will try to make this sound as easy and as simple as it really is..

    Variables are referred to by the \ mark. My camsoft package gives me 999 different variables I can use any way I like. I don't know why camsoft gives 999 as opposed to 10,000 of them or just 500 but that's the way it is.. You don't need to use all of them but if your program gets big, keep in mind you are limited to 999. (your program make provide more)

    So, lets say my machine has a speed setting or something like that.. The program I wrote gives me 10 speed settings.. 1 = slow and 10=fastest.. Now that I have a format to tell the machine how fast to go, I need a way to store that variable.. The next step is to pick an unused variable.. In my case that would be between 1 and 999.
    So, I like the number 50 so I am going to use the variable 50 as my speed setting.
    In code, I would refer to this variable as \50 The backslash tells the software that you are referring to a variable number.. So lets say I want a slow speed.. I would set variable \50 to something low like 2. In my code it would look like this:
    \50=2
    Actually, my code also requires that I put a "!" in front of all lines of code. (I don't know why but it is required..) The proper format would actually be
    !\50=2
    I am not sure if your code requires the exclamation point or not.
    That says make variable 50 equal the value of 2.. I could also test to see if the variable is set at a specific number by doing this:
    !IF \50>2 THEN SAY HELLO WORLD
    The line of code above says If variable 50 is greater than 2 then use the speech engine and make the computer say the words HELLO WORLD. (your speakers need to be turned up)
    On that note, testing to see if code works using the "SAY" command is a great way of instantly checking to see if you did it right..
    Now... even though this example uses variable 50 "\50" as my speed control, you could just as easy have picked any of the 999 different variable numbers that are available. (your camsoft package may have more or less)
    I used the term speed control just for an example.. the variable 50 could be made to refer to any function of your controller.

    One question.. How much programing experience do you have? Do you understand the basics of programming any software? how a computer runs code in an organized pre-determined way?

    Here is another example(s) of what I just explained.

    !\50=3 'this line sets the speed to 3
    !IF \50<2 THEN SAY THE SPEED IS TO SLOW
    !IF \50>5 THEN SAY THE SPEED IS TO FAST

    The above code first sets the variable 50 to a value of 3 for testing purposes. The code then checks to see if variable \50 is less than 2 and if it is, the computer will say "The Speed Is To Slow". The next line after that checks to see if the value of variable 50 is greater than 5 and if it is, it makes the computer say "The Speed Is To Fast".

    Is this making sense?

    Here is another one.. We are going to mix things up a little and manipulate a variable "pragmatically". Don't try to make sense of speed control or anything like that.. this example will be completely hypothetical.

    !\33=5
    !\34=10
    !\33+\34=\55

    The above code sets the variable 33 to a value of 5. The next line sets the value of the variable 34 to a value of 10. The 3rd line does a little math by adding 2 variables together, then placing the answer into variable 55 which would then equal 15 so variable 55 would end up being 15.

    Is this making sense?

    Hope this helps..
    Murphy

  10. #10
    Join Date
    Mar 2003
    Posts
    4826
    Plate,
    I can tell you're starting from scratch, but that's okay, we all have to start from somewhere

    Your computer executes logic statements, which can take many forms, but one form is a simple algebraic expression. However, if you write a logic statement with fixed values (called constants) in it, there is only one possible outcome for that expression, because everything has a fixed value.

    So a variable is just like what you learned in school:
    A + B = C

    This expression has millions of possible uses, because each letter A and B can be assigned any value at any time.

    Camsoft reserves small letter names for one type of variable, and for other types, it uses what Murphy has described, a \ followed by a number. It is simply a naming convention that Camsoft dreamt up, nothing mysterious once you understand it.

    Programming is fun to learn once you get a few of the basic rules under your belt. It takes some cleverness to reduce what you want to control, to the rigid rules of logic that your computer can execute correctly under all circumstances.
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  11. #11
    Join Date
    Nov 2004
    Posts
    14

    Thanks Murph

    Thanks for your time Murph, you too Hu. I will try some experimenting when I get back from vacation, I can hardly wait, I get to visit the inlaws in Cleveland.
    Thanks again,
    Plateroom(Larry)red

Posting Permissions

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