Results 1 to 9 of 9

Thread: Asking for a G code sample

  1. #1
    Registered
    Join Date
    Apr 2006
    Location
    USA
    Posts
    11
    Downloads
    0
    Uploads
    0

    Asking for a G code sample

    I've been looking up G-code info on the web and slowely getting some ideas on how to run my machine with G code. Anyhow I only run the X and Z axis and only one motor turns at a time. Right now I run my system with its own on board servo command mode but it has limits that I need to find a way to avoid.
    For what I do the torque setting will always be the same. Velocity and the # of steps is about all that changes.
    My motion profile looks some thing like this:
    X steps 1000 CW Vel 100
    Z steps 30000 CCW Vel 500
    Z steps 30000 CW Vel 50
    Time delay 2 min.. no motion
    X steps 1000 CW Vel 100
    Z steps 10000 CCW Vel 500
    Z steps 10000 CCW Vel 100
    Z steps 10000 CCW Vel 500
    Time delay 30 sec.. no motion
    Z steps 30000 CW Vel 50
    Time delay 2 min.. no motion
    X steps 1000 CCW Vel 100

    This is the basic motions that I run. Each motion has a fixed acceleration profile to it as well.. In other words if I want to change velocity going from point A to point B my current system veiws this as another motion profile. As in accelerat to speed, decelerat,stop ( milliseconds ) accelerat to new speed
    ... so on and so on. This is a pitfal I would like to get away from and hope that G-code makes this possable.

    Any input would be great!
    Bill


  2. #2
    Moderator Switcher's Avatar
    Join Date
    Apr 2005
    Location
    mydxf.blogspot.com
    Posts
    3,665
    Downloads
    0
    Uploads
    0
    I'm not really sure what you want.

    Anyway some basics:

    (1) If you want more than one axis to move at the same time, put both commands on the same line.

    G01 X-5.0 Z-1.5 F50

    Breakdown of above code:

    (A) G01 (Linear Interpolation)
    (B) X-5.0 Z-1.5 (Move the "X" & "Z" axis the specified distance)
    (C) F50 ("F" stands for Feed, so the Feed here is equal to 50 mm/in a minute)

    --------------------------------------------------------------------------

    If you want to pause a program with no axis movement:

    G4 F120

    (A) G4 (Dwell Time)
    (B) F120 (Pause for 120 seconds)





    --------------------------------------------------------------------------
    Sample:

    X (Distance to travel (+/-)) F100
    Z (Distance to travel (+/-)) F500
    Z (Distance to travel (+/-)) F50
    G4 F120 (Time delay 2 min.. no motion)
    X (Distance to travel (+/-)) F100
    Z (Distance to travel (+/-)) F500
    Z (Distance to travel (+/-)) F100
    Z (Distance to travel (+/-)) F500
    G4 F30 (Time delay 30 sec.. no motion)
    Z (Distance to travel (+/-)) F50
    G4 F120 (Time delay 2 min.. no motion)
    X (Distance to travel (+/-)) F100

    --------------------------------------------------------------------------

    WARNING

    This is just a sample , I have NO idea what your machine/control setup is, Run at your own risk

    Plus an actual program has more code.



    .
    Free DXF Files - myDXF.blogspot.com


  3. #3
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    18,935
    Downloads
    0
    Uploads
    0
    Bill.Also see your first post on the related subject.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design (Skype Avail).

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  4. #4
    Registered
    Join Date
    Apr 2006
    Location
    USA
    Posts
    11
    Downloads
    0
    Uploads
    0
    Thanks guys for the input!.. this helps me. For some more detail of the motors I use, they each have there own on board controller, They where fast and easy to get up and running and required very little brain power on my part. Anyhow my machine only moves on the X and Z axis. All it does is dip a part in a selection of chemical tanks. Only one motor needs to run at any one time. NEVER at the same time like one needs for a router.
    I'll study some more on the web and come up with some more focused questions if you folks don't mind.
    Bill


  • #5
    Registered
    Join Date
    Apr 2006
    Location
    USA
    Posts
    11
    Downloads
    0
    Uploads
    0
    Switcher,
    Does G01 command apply when you are moving only one motor? What command defines direction of motor rotation?
    Bill


  • #6
    Moderator Switcher's Avatar
    Join Date
    Apr 2005
    Location
    mydxf.blogspot.com
    Posts
    3,665
    Downloads
    0
    Uploads
    0
    Does G01 command apply when you are moving only one motor?
    The answer is, yes. Also I believe some controls don't require you to use "G01" (an option) while others do require it. I always use it out of habit anyway.

    ------------------------------------------------------------------------

    What command defines direction of motor rotation?
    (A) To rotate a motor clockwise use the ( + )
    (B) To rotate a motor counter-clockwise use the ( - )

    Example:

    G01 X+5.0 F50
    G01 Z-1.5 F50

    (The sample would make the "X" motor spin clockwise, and the "Z" motor would spin counter-clockwise)

    Again, I believe some controls don't require you to use " + " (an option) while others do require it.

    As far as the negitive sign ( - ), I think all controls require you to use that.

    So the sample above, could also look like this:

    G01 X5.0 F50
    G01 Z-1.5 F50

    Notice the ( + ) missing from (X+5.0)

    If your just starting out, with g-code I would recommend keeping the ( + ) & ( G01 ), to keep the program as clear to you as possible.


    Again as far as what way a motor spins clockwise/counter-clockwise would all depend on how your machine is built ( If the above doesn't work for your setup, try reversing them ( - ) & ( + ) in your code.

    Keep your ( F ) very low when practicing, your code. Then when you get the path correct, crank up your Feed. Just be cautious at first

    .
    Free DXF Files - myDXF.blogspot.com


  • #7
    Registered
    Join Date
    Apr 2006
    Location
    USA
    Posts
    11
    Downloads
    0
    Uploads
    0
    Switcher,
    X-5.0 Z-1.5 (Move the "X" & "Z" axis the specified distance) The 5.0 and 1.5 is this the number of steps? or a distance assuming a certian mechanical set up?
    Bill


  • #8
    Moderator Switcher's Avatar
    Join Date
    Apr 2005
    Location
    mydxf.blogspot.com
    Posts
    3,665
    Downloads
    0
    Uploads
    0
    X-5.0 Z-1.5 (Move the "X" & "Z" axis the specified distance) The 5.0 and 1.5 is this the number of steps? or a distance assuming a certian mechanical set up?
    That would be Linear moves (distance to travel), in either millimeter or inch, depending on what you set your control up with.

    You could use the same examples and switch the Linear, and instead have a rotary axis such as "A axis". Then it would be in degree.


    Example:

    G01 A-360 F50 ("A" would rotate counter-clockwise, 360 degree, at a Feed rate of 50 mm/inch a minute)



    -------------------------------------------------------------------------

    Just curious , do you have any photos of your setup?



    .
    Free DXF Files - myDXF.blogspot.com


  • #9
    Registered
    Join Date
    Apr 2006
    Location
    USA
    Posts
    11
    Downloads
    0
    Uploads
    0
    Just curious , do you have any photos of your setup?

    Right now no.. its 3000 pounds, 50+ sq ft of floor space and 7 feet tall. Lots of pumps, heaters, ventelators and a low tech load lock to keep the nasty stuff inside and away from the operator.


  • Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.