Hi,
I'm planning to use this kind of rotational encoder with my robot: http://abigmagnet.blogspot.com/2008/10/dc-motor-control-part-one.html It's scavenged from an old HP printer and has 18,000 lines. My robot's motors are going to max out at ~2RPM, so I get a maximum of 36K encoder impulses per second (72K since I have two motors). The encoders have two pins, one for the counter and one for direction.
I plan an interrupt routine that triggers on the counter, checks the value on the direction pin and adds or subtracts from a rotation count. Basically,
if(PORTB&DIRMASK) counter++; else counter--;
This routine will be called up to 72,000 times per second.
Can Arduino handle this? My calculation is that for an Arduino running at 16MHz and an ISR called at 72kHz, I have 222 clock cycles per interrupt service routine; if I assume the above computation to use 50 clock cycles, I'd be using 22% of the device, leaving plenty of room for other stuff. But I'd like to hear from someone with more experience on this.
Any advice is much appreciated!
Regards, Björn