:
There is a pin setting in Mach3 that says how to react to the inputs from the switches. Your setting is probably wrong as the trigger happens immediately. You may want to think about shielded wire and/or a resistor on each limit switch line. If there are stray wires, connect them to ground.