One symptom of a broken ribbon cable is bad I/Os. Do a continuity test on each of the pins. This exact thing happened to us and cost over an hour at competition.
Everywhere I’ve looked says to connect ground to signal, so I’m not sure that is correct. Connecting the power to signal doesn’t do anything either anyways.
We have other IO pins being used with encoders that are working perfectly fine. Whenever we try to use a limit switch on any of the pins, it doesn’t work. I can try a new ribbon cable later today and see if that works.
That’s not correct. The digital sidecar has a pullup to 5v on the signal line. Connecting a switch between signal and power means that signal will never change from 5v. You need to connect the switch between signal and ground, so that signal will switch from 5v (when open) to ground (when closed).
I also guess that something is wrong with power. Follow Alan’s suggestions.
Double and triple check the code to make sure you aren’t assigning something else to that pin as well.
Try creating a whole new software project that has nothing in it but the limit switch code, to make sure you aren’t running into any issues with other stuff interfering.
Unplug your limit switch and verify it’s working as intended - use a multimeter to measure resistance between the two pins on the PWM connector - you should see the resistance value switch between infinite and 0 ohms when pressing the switch (as for which one is which, that’s up to how it’s wired - normally connected or normally open).
Check the LED’s on the DSC - all three should be brightly lit (5V, 6V and Power), and you should see the RSL working correctly.
Take spares of other parts (DSC, DSC-cRIO cable, etc) and swap them out to make sure the problem isn’t in one of them.
You can also use that same multimeter to measure the voltage potential on and across the limit switch while it’s plugged in. If it’s changing how you expect it to, you likely have a software problem. If it isn’t changing, you likely have a wiring problem.