So as part of my tabletop competition robot I am using encoders. They are simple encoders only 3 pins 1 for signal the other 2 for power and ground. I have run into a issue. I am using An0-3 as my interrupt ports to read them on the interruptedgehigh I have tried all the modes available as that does not seem to make a difference to my issue. Two of the interrupt ports seem to be acting as other ports. if that makes any sense. I have pasted the basic code below. I put the print in my events as a last ditch effort 2 of them never fire off when manually spinning the wheel. Has anyone run into anything like this. I know the encoders are good i swapped wires and had it work. I tested them with my scope they fire as expected even to the interrupt pin on the shield. Has anyone run into something like this? Am i missing something here?
InterruptPort EncoderB = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.An0, true, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
EncoderB.OnInterrupt += new NativeEventHandler(EncoderB_OnInterrupt);
InterruptPort EncoderD = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.An1, true, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
EncoderD.OnInterrupt += new NativeEventHandler(EncoderD_OnInterrupt);
InterruptPort EncoderA = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.An2, true, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
EncoderA.OnInterrupt += new NativeEventHandler(EncoderA_OnInterrupt);
InterruptPort EncoderC = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.An3, true, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
EncoderC.OnInterrupt += new NativeEventHandler(EncoderC_OnInterrupt);
EncoderACount = 0;
EncoderBCount = 0;
EncoderCCount = 0;
EncoderDCount = 0;
static void EncoderB_OnInterrupt(uint port, uint state, DateTime time)
{
EncoderBCount++;
Debug.Print("EncoderB Hit " + time + " " + port);
}
static void EncoderD_OnInterrupt(uint port, uint state, DateTime time)
{
EncoderDCount++;
Debug.Print("EncoderD Hit " + time + " " + port);
}
static void EncoderA_OnInterrupt(uint port, uint state, DateTime time)
{
EncoderACount++;
Debug.Print("EncoderA Hit " + time + " " + port);
}
static void EncoderC_OnInterrupt(uint port, uint state, DateTime time)
{
EncoderCCount++;
Debug.Print("EncoderC Hit " + time + " " + port);
}