Hello Guest it is August 25, 2019, 06:05:34 AM

Author Topic: Broken Limit Switch code ?  (Read 1985 times)

0 Members and 1 Guest are viewing this topic.

Broken Limit Switch code ?
« on: October 06, 2007, 11:38:44 PM »
New user.  Just downloaded and installed rev 2.48 of Mach3 on a WinXP box and also onto a fresh Win2k install on another box.

Connected it up to my existing controller driving my PCB milling machine.

Tweaked the motor pins and motor config and the motors run great.

Next step was to define the limit switches.  These are just conventional microswitches, connected to a parallel port pin and Ground, closing when the table wipes past the switch.  That is, they are open most of the time, closing at "the limit".

With the switch open, I read 4.15 volts between pin 12 and pin 25 (ground).  Closing the switch, I read 0v.  This is exactly as expected (as it all worked with my DOS software).

I started by defining Y++ as   Enabled   Port 1   Pin 12   Active Low  (Not Emulated  Hotkey 0).  This is the ONLY input pin defined.
 
I then went to the diagnostics and saw the green "LEDs" on.  Manually closing the switch, one green "LED" went out and a yellow LED labelled M2++Lim comes on.  Open close open close results in off on off on. Clearly, the PC is seeing the switch closing, and the logic (active low) works as intuition suggests.

I then went Alt-2 MDI to jog the motor onto the switch to see what happens, pressed the big red Reset switch and IMMEDIATELY got the message "Limit Switch Triggered".

Hmm, maybe the logic is not as appears.  OK, back to pin config and "uncheck" Active Low.  Back to diagnostics, and I see the opposite.  With the switch open, a green LED and a yellow LED beside M2++Lim are both on.  Close the switch and both LEDs go out.  The logic has reversed, as expected.

Back to Alt-2 MDI, clear Reset and EXACTLY the same thing happens; a message reading "Limit Switch Triggered".

OK, maybe not a strong enough pullup (although Diagnostics WAS able to read it), so I added a 1k pullup to a source of +5.  Open switch, the port now reads 4.8 volts, closed is still 0 (of course).

But ALL else remains the same, the message "Limit Switch Triggered" within a second (or less) of "pressing" Reset.

It seems that if I define a Limit switch, Mach3 thinks that a limit has been reached, no matter how I define it.

This can't be right, but I'm 6 hours into muttering and swearing and reading forum posts and exactly the same thing happens on two different machines.  I've got to be missing something, but I surely can't figure out what.

Any help gratefully gratefully appreciated.

Alan

Offline Hood

*
  •  25,849 25,849
  • Carnoustie, Scotland
    • View Profile
Re: Broken Limit Switch code ?
« Reply #1 on: October 07, 2007, 04:29:24 AM »
Try setting the debounce higher, you will find it on the General Config page.
Hood