588,548 active members*
5,774 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > G-Code Programing > How do I make the program pause until it sees a TTL input?
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2005
    Posts
    476

    How do I make the program pause until it sees a TTL input?

    I have an application that requires a single axis to index by 5mm, then pause until it sees an input on one of the lines. This is not a user input (i.e. hit a key on the keyboard) but a TTL input coming from another computer.

    My machine is measuring a tensile force, indexing to the next position, recording the force again, and so on. But the computer that interfaces with the load cell (and records the result) is a seperate system. So I'm trying to coordinate the two machines. If I can get the recording machine to tell the machine running Mach2 when to perform the next indexing move, I'm set.

    It seems so simple, just toggle one TTL input high to say "go to the next location." After browsing all 7 pages of threads in this forum, I didn't find the way to do this. Am I right, is it a simple thing to do?

    Thanks!
    -D

  2. #2
    Join Date
    Dec 2003
    Posts
    24221
    Quote Originally Posted by damae
    Am I right, is it a simple thing to do?
    Normally that is a simple thing, I am not familiar with Mach2, but if you move 5mm then wait for a pulse, you may have to set it up as an M code in a CNC system, to wait until the input goes active high, the ideal way is to set up handshaking, because if it is not the rising edge of the pulse you are detecting but the fact that it is high indicating you should index to the next 5mm move, then if you index and the pulse has not ended, i.e. not=0 then you it could be seen as a new index move and the machine will index prematurely.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

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

  3. #3
    Join Date
    Jun 2005
    Posts
    476
    Quote Originally Posted by Al_The_Man
    ... because if it is not the rising edge of the pulse you are detecting ... it could be seen as a new index move and the machine will index prematurely.
    Al.
    I hadn't thought of that. I expect the indexing move to take a second or two but the pulse will be on the millisecond scale. So both the rise and fall should have happened before the index move is complete.

    How would I setup a M code? I should have mentioned this is not an industrial control (like Fanuc). It's a small xylotex board with TurboCNC or Mach3.

  4. #4
    Join Date
    Jun 2005
    Posts
    476
    After reading a little more, I wonder how the Cycle Start input works.

    Is there a gcode command to put the machine into a mode to wait for a "cycle start?" Can anyone explain how to do that? For instance, does the cycle start have to refer to a subroutine, or can it be used in the middle of a program?

  5. #5
    Join Date
    Dec 2003
    Posts
    24221
    A few controls allow the customizing of G codes, but generally (M)achine codes are used to control just about everything that occurs outside of the Numerical Control side of things, I would think this would be the way to go. You would have to read up on the control you intend to use and find out how to implement a custom M code, which generally is fairly easy depending on the logic that the control uses.
    Typically you would issue, say a M81 in the part program which would call the routine tied to it, which would simply wait until it see a high on a particular digital input, The routine then sends a (Fin)ish or done signal back to the CNC side and the part program would continue with the next move, Someone familiar with Mach2 etc may be able to take it a bit further.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

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

Posting Permissions

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