Interrupts and rotation sensors

I want to be able to make dead reckoning code based on almost the exact position of the robot. To do this I need rotation sensors for at least one of the wheels, and I need to be able to use interrupts in the code. I’m out of my depth with the interrupt code - All I want to do is to increment a rotation count whenever I receive certain values from an analog input rotation sensor (for example, “the input”%16). I’ve looked over the heavily commented example code but I am still not sure what I need to change to make it work for one specific input. I also need a rotation sensor with which to use this code, and I have no idea where to get it. There has to be some sort of potentiometer or something that functions like the Lego rotation sensors (i.e., it can keep on turning indefinitely), but I have no idea what it would be called or where I can get it.
If anyone can help me out on either of these issues I would really appreciate it. Simply put, I need some tips on using interrupts, and I also need information on where to get rotation sensors.

http://www.chiefdelphi.com/forums/papers.php?s=&action=single&paperid=272

I have included a link to a white paper written by Daniel Katanski which is an excellent place to start learning about this capability.

You say you want to use interrupts to increment a rotation count, but then you describe an analog measurement. The interrupts are digital inputs, typically a pulse and the pic controller can be configured to generate an interrupt on rising edge, falling edge, and (for some inputs) both edges. One method to apply this to determine the displacement of the machine would be to use a encoder on one of the drive train shafts that would generate a specific number of pulses for each revolution of the shaft. The interrupt routine would accumulate the number of pulses from a starting point and this would be directly related to displacement of the machine.

Try Kevin’s encoder code, found here: Kevin’s Code

Take the encoder code, and take a look at that. A few changed need to be made (don’t know what specifically) and the encoder.c and encoder.h files need to be added to the frc code for it to work.

To order encoders, try digi-key. Aim for a good pulse per revolution, and make sure you don’t try to get too much feedback from encoders (try to stay at around 1000? maybe 1500?) and goodluck!

Encoders is the keyword you’re looking for and they are discussed in several forum threads.
Do a search on “encoder”. One such thread is /t/using-digi-key-shaft-encoders/40571/1