What type of limit switch are you using? Actual switch? Proximity (if proximity is it NPN or PNP)? Key bits of info missing there, as well as how they are wired (voltage and normally closed or normally open).