Welcome to Our Community

Some features disabled for guests. Register Today.

Black Box: Know what axis hit limit switch?

Discussion in 'Controller Boards' started by kevinbaileycrum, Nov 17, 2020.

  1. kevinbaileycrum

    Builder

    Joined:
    Nov 10, 2020
    Messages:
    12
    Likes Received:
    2
    Is there a way to know what axis a limit switch?

    When sending gcode over serial if i hit a limit switch, I want to know what axis (or rather which limit switch) I hit.
    The box has pins in the back saying x-axis, y-axis, z-axis and Im curious if I have a way of interacting with grbl. I thought maybe I could send a '?' command over and get info about the positioning of each axis and try to figure out which one hit that way but i think while it is in its alarm state I cant send '?'

    Curious if there is any info being sent to the box that I can catch about what limit switch was hit.
    In context I am sending gcode through a terminal and not using the control interface that would tell me what position it believes each axis.
     
  2. Peter Van Der Walt

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

    Joined:
    Mar 1, 2017
    Messages:
    13,753
    Likes Received:
    4,070
    Grbl does a "port based interrupt" for speed (polling each pin in turn would cause issues with stepgen and also reaction speed of the limits), and as such only knows "one of the limits" got hit. Grbl doesn't even know, Grbl thus cannot tell the host application either:

    Refer gnea/grbl
     
  3. kevinbaileycrum

    Builder

    Joined:
    Nov 10, 2020
    Messages:
    12
    Likes Received:
    2
    Thanks Peter. I was afraid of such news. I appreciate your response especially since I now see this is a grbl question rather than a black box one.

    so is it the case that ports (er..pins...forgive me) labeled x-limit y-limit etc are just for fun / user organization?
     
  4. Peter Van Der Walt

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

    Joined:
    Mar 1, 2017
    Messages:
    13,753
    Likes Received:
    4,070
    Pretty much yes. Port = group of pins. Reading a port in parallel, bitmasking, etc is a lot faster than DigitalRead the Arduino world uses.

    Even looking at "i know i sent an X+ move so it must be the X max switch" would not always be true because you could get an EMi related false trigger on another switch instead
     

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