Interrupt Driven Rotary Table controller

Discussion in 'Software and Programming' started by rodw, Nov 30, 2015.

Help Support HMEM by donating:

  1. Mar 27, 2019 #81

    Captain_Obvious

    Captain_Obvious

    Captain_Obvious

    Active Member

    Joined:
    Jun 3, 2017
    Messages:
    43
    Likes Received:
    17
    Now I'm by no means any kind of an Arduino expert, but would it not be possible to just make a digital pin go high when the code is not active, AKA signal is not being sent to the stepper motor?
     
    Last edited: Mar 27, 2019
  2. Mar 27, 2019 #82

    curtistdc

    curtistdc

    curtistdc

    Member

    Joined:
    Dec 28, 2015
    Messages:
    6
    Likes Received:
    0
    Yes that is what I am looking for but, as I am picking through the code I am having a hard time thinking how I an going to do it. Something along the lines of if stepper not true then bring pin whatever high for a pulse to deactivate the M40 code. I am going to dive back in and see if I can figure something out.
    Thanks
     
  3. Mar 27, 2019 #83

    Scott_M

    Scott_M

    Scott_M

    Well-Known Member

    Joined:
    Apr 13, 2013
    Messages:
    245
    Likes Received:
    73
    Location:
    Medina, Ohio USA
    Hi Scott
    Scott here, can't you address it in the code ? I am not that savvy with custom macros but can't you call the m40 conditionally ? Like for 5-6 seconds ( long enough to make your rotary move ) and then have it return from M40. Or is there another M code that will cancel it. Like we cancel a canned cycle or cutter comp ?

    Scott
     
  4. Mar 27, 2019 #84

    curtistdc

    curtistdc

    curtistdc

    Member

    Joined:
    Dec 28, 2015
    Messages:
    6
    Likes Received:
    0
    I had not thought about a macro. My machine has macro a and I have not tried to write a macro before but that is a thought. There is not another m code to cancel m40, it waits for a 24 volt signal to trigger a change in the ladder to cancel it. There may be a way to do it with a macro but I need to do a little research and see. From my limited understanding of macros you can use variables programed into the diagnostic parameters which could be used for a time limit. I will look at my fanuc manual and see what I can find out about that.

    Have you had good lock with the setup you did with the proximity switch?
    Thanks
    Scott
     
  5. Mar 27, 2019 #85

    Scott_M

    Scott_M

    Scott_M

    Well-Known Member

    Joined:
    Apr 13, 2013
    Messages:
    245
    Likes Received:
    73
    Location:
    Medina, Ohio USA
    Hi Scott
    Actually we had to bail on the prox switch. It developed a serious debounce issue that I could not resolve. I went to a mechanical N.O. switch and piggybacked it to the shield switch.
    It has been rock solid since. It really brought some new possibilities to a "vintage" machine.

    Scott
     
  6. Mar 27, 2019 #86

    curtistdc

    curtistdc

    curtistdc

    Member

    Joined:
    Dec 28, 2015
    Messages:
    6
    Likes Received:
    0
    Did you try to tie it into the A0 pin directly with the same value resistor? I am only asking because I am in the process of mounting five buttons on the face of the machines control enclosure and I tried simulating the five switches on the shield with a resistor array matched to the resistors on the shield. I had problems because I was getting feedback from the resistors on the shield and the voltage values were not correct when both were wired into the A0 pin. My next step is going to break the connection to the A0 pin from the shield. I plan on mounting the arduino and display inside the Machines control with just the lcd showing though so there wont be a need for the shield buttons anyways.

    as for the macro idea I did some reading in the fanuc manual and you can change some internal registers on the cnc control with a macro but I think that the one for the m40 code may not be one of them. I posted a question about this type of thing elsewhere maybe the fanuc gurus can shed some light on the problem.
     
  7. Mar 28, 2019 #87

    Scott_M

    Scott_M

    Scott_M

    Well-Known Member

    Joined:
    Apr 13, 2013
    Messages:
    245
    Likes Received:
    73
    Location:
    Medina, Ohio USA
    Hi Scott
    I was using a digital pin for the prox. I had tried it with and without pull-up resistor - internal and external. Would get random triggers.


    Scott
     
  8. Mar 28, 2019 #88

    Captain_Obvious

    Captain_Obvious

    Captain_Obvious

    Active Member

    Joined:
    Jun 3, 2017
    Messages:
    43
    Likes Received:
    17
    Did you try a small value capacitor from the signal pin to ground? I had a random trigger issue with an Arduino based device. It would trigger every time a fluorescent lamp turned on of off nearby. A small capacitor solved the issue. It was a genuine Arduino Nano.
     
  9. Mar 28, 2019 #89

    Scott_M

    Scott_M

    Scott_M

    Well-Known Member

    Joined:
    Apr 13, 2013
    Messages:
    245
    Likes Received:
    73
    Location:
    Medina, Ohio USA
    No I did not.
    But it has been working well now with the mechanical switch so I doubt I will try it.
     
  10. Mar 29, 2019 #90

    curtistdc

    curtistdc

    curtistdc

    Member

    Joined:
    Dec 28, 2015
    Messages:
    6
    Likes Received:
    0
    I think I have a solution for this application. I used a digital write command within the go divide section to send pin 10 high momentarily to cancel the m40 command from the cnc. I tried to use the millis compare system but kept getting errors from the compiler in a strange section of the code and I could not figure out why. So I went against what I believe to be the correct method and used a delay command in between pin 10 high and pin 10 low with a 100 ms pulse. I know this stops the processor from working during the delay but bench testing showed no sign of problems. Everything seemed to work properly. The next step is to hook everything to the cnc machine and se how it works.

    I would ultimately like to write a macro for the machine so that I can input the number of divisions into a macro variable and the nc code will index until it reaches the desired number of divisions. Need to do some macro studying.
    Scott
     

Share This Page