Welcome to Our Community

Some features disabled for guests. Register Today.

G Code pause

Discussion in 'Control Software' started by Mike Latimer, Sep 29, 2020.

  1. Mike Latimer

    Builder

    Joined:
    Mar 17, 2018
    Messages:
    2
    Likes Received:
    0
    We have just setup a X Y plotter 1.2 m x 2.4 m using open build parts and a Black box controller.
    What we are trying to do is very simple.
    We are wanting to setup a measurement grid of 50mm squares, 1.2m x 2.4m.
    At each intersecting point on the grid we want to pause for 30 seconds take a measurement then go to the next point and repeat.
    We can make G code for the grid no problem, but how do we get our measurement head to pause for 30 sec and continue to the next point.
     
  2. Giarc

    Giarc OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Jan 24, 2015
    Messages:
    3,016
    Likes Received:
    1,682
    #2 Giarc, Sep 29, 2020
    Last edited: Sep 29, 2020
    Mike Latimer likes this.
  3. Giarc

    Giarc OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Jan 24, 2015
    Messages:
    3,016
    Likes Received:
    1,682
    Just a quick check to be sure and I found GRBL does support the G4. gnea/grbl
     
  4. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,785
    Likes Received:
    1,366
    But I think with grbl the pause is in seconds rather than milliseconds as it would be in "standard" g-code.
    Alex.
     
  5. Giarc

    Giarc OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Jan 24, 2015
    Messages:
    3,016
    Likes Received:
    1,682
    You are probably right. I guess we would have found out if I was wrong 8.333 hours after the first attempt. :) I have never messed with the G4. I assumed ms because of every other arduino project I do is ms.
     
    Alex Chambers likes this.
  6. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,462
    Likes Received:
    1,915
    While the pause has its attractions I don't like it..... how do you know when to take the measurement? travel time between every point will not be equal.
    I would rather integrate the Gcode generation and the sampling into one script, so the script will send a move command, wait for the 'OK' from GRBL, then sample, then move, etc.
    Then you know for sure that no sample was taken while still moving.
     
    Peter Van Der Walt likes this.
  7. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,785
    Likes Received:
    1,366
    LOL - I embarrassed myself by getting this wrong about a year ago - not sure why grbl decided to be different on this one.
    Alex.
     
  8. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,462
    Likes Received:
    1,915
    not GRBL that is different from anything in the Gcode world, the RS274 Gcode standard and LinuxCNC's interpretation of it says seconds
    G Codes

    GRBL is essentially NOT an Arduino project, while you can compile and flash it using the Arduino IDE it uses not a single line of Arduino library code, it is pure C/C++, therefore you can compile and flash it with a number of other ATMega compilers AFAIK.
     
  9. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    Yep, that. I've flashed it directly from Windows command line in the past with AVRDUDE. Easier with the Arduino IDE, but that's also just a stub to generate the hex from the library files, no real "Arduino" code there.

    Arduino just happens to be the most convenient form factor for the ATMega328p.
     
  10. gsw

    gsw New
    Builder

    Joined:
    May 1, 2018
    Messages:
    6
    Likes Received:
    7
    Hi i would like to ask about the G4 dwell time, i am using the Black box control system, i am setting up a very basic system and wanting the Z axes to go down and pause for 3 seconds and return back home. but i cant get the dwell time to work. does it work in the black box code or is there another way to achieve my z axes move with a wait time of (seconds). any help would be helpful.
     
  11. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    All you should need to write is G4 P3, that's it. G Codes
     
    Peter Van Der Walt likes this.
  12. gsw

    gsw New
    Builder

    Joined:
    May 1, 2018
    Messages:
    6
    Likes Received:
    7
    thanks for your reply, when i put the G4 P3 in the code and simulate it, it doesn't pause. will it pause in the simulation in the open builds control simulation.
     
  13. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    That I don't know off-hand, though if the simulation uses grbl's hardware simulation mode then it should. I'd just do a very short hand-code and run it straight on the machine. Only need to move a few mm to be able to tell whether it's performing as expected.

    G90 G21 G17 G54
    G53 Z0
    G1 Z-10 F500
    G4 P3
    G0 Z0
    M30

    Something like that. Change the G21 to G20 and the Z-10 to Z-0.5 if you're working in imperial units. Home first, obviously.
     
  14. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,051
    Likes Received:
    4,313
    Simulator is eye candy :) run it on the machine!
     
    sharmstr and David the swarfer like this.
  15. gsw

    gsw New
    Builder

    Joined:
    May 1, 2018
    Messages:
    6
    Likes Received:
    7
    Thanks for the info, the dwell (G4) works on the machine but not in the simulator. that was throwing me off.
     
    Kerry Thurber and sharmstr like this.
  16. Kerry Thurber

    Builder

    Joined:
    Dec 23, 2020
    Messages:
    16
    Likes Received:
    5
    I just upgraded versions (1.0.270 now) and the simulator pauses, but it doesn't matter what number you put in there, it will pause the same amount
     
  17. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,051
    Likes Received:
    4,313
    Thanks for the report, try the Beta of 1.0.272 - modified 3D viewer being built: See Control crashes on large files?
     
    #17 Peter Van Der Walt, Jan 6, 2021
    Last edited: Jan 6, 2021
  18. Kerry Thurber

    Builder

    Joined:
    Dec 23, 2020
    Messages:
    16
    Likes Received:
    5
    Thank you I will do that.
    Hey who's writing the simulator? I'm a coder. Can I help?
     
    sharmstr likes this.
  19. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,051
    Likes Received:
    4,313
    OpenBuilds/OpenBuilds-CONTROL accepts pull requests :)
     
  20. Kerry Thurber

    Builder

    Joined:
    Dec 23, 2020
    Messages:
    16
    Likes Received:
    5
    I misspoke. There is a minute pause between commands in the simulator. My G4 commands in version 1.0.270 are not processed.
     
  21. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,051
    Likes Received:
    4,313
    The sim does not handle pauses, it just gets the array of points, and moves between them with the approximate feedrate
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice