reading a quadrature encoder

hi all

new to Arduino here.

I have been studying the quadrature encoder code, and it looks like to get full resolution, you actually need to hook interrupts to both the A and B inputs. Can anyone verify this?

I need to read two quadrature encoders (high tic counts) and the code I've seen "out there" hooks the two Uno interrupts to pin A of each encoder (since there are only two user interrupts). This means you only get half the resolution.

So it's pretty much necessary to XOR the A and B of each interrupt and use that to trigger the Arduino interrupt pin?

You can also use Pin Change Interrupts to capture the pulses--it's just that you usually don't need the full resolution available.

Yup looks like the PinChangeInt library is the way to go.

I definitely need the full resolution because my existing encoders are only 1000 PPR, and it's cheaper to go with software than buy better encoders. :~

Ok so I got the latest version of the PinChangeInt library, there were a couple places I had to change stuff to get it to compile (am using Arduino 1.0).

Ok now for the problem. I have Encoder1 on Pins 0 and 1, and Encoder2 on Pins 2 and 3 (on an Uno R3).

I've hooked four interrupts like so..

  PCintPort::attachInterrupt(ALT_enc_A, altFuncA, RISING);
  PCintPort::attachInterrupt(ALT_enc_B, altFuncB, RISING);

  PCintPort::attachInterrupt(AZ_enc_A, azFuncA, RISING);
  PCintPort::attachInterrupt(AZ_enc_B, azFuncB, RISING);

now my problem is that Encoder1 is running away (i.e. it is receiving tons of interrupts, whether real or not I don't know). I've enabled pullup/pulldown on the 4 pins as well (was getting spurious counts from both encoders without that).

Is there something special about Pins 0 and 1 that I have to avoid them? I'd hate having to rewire my proto shield...

Ok I moved the runaway encoder from pins (0,1) to pins (12,13). Everything is good now...

I knew that "TX/RX" label on pins (0,1) meant something... also I no longer have intermittent problems uploading.

So I take it pins (0,1) are connected to the USB-serial converter?

So I take it pins (0,1) are connected to the USB-serial converter?

Yes