Originally posted by JohnnyS
Please post the schematic that goes along with this code.
BTW, the 2313 is not a particularly good device for our brushless controllers. RC BL controllers potentially need 5-6 channels of higher resolution A/D - 3 for position sensing, one for current sense, one for temp, and one for battery voltage. The ATmega series has 6-8 channels of 8 and 10-bit A/D and can clock to 16MHz.
PIC 16Fxxx parts have 6 channels of 10 bit A/D and clock to 20Mhz. They also have a PWM module among other things. If you feel the need for speed 18Fxxx parts clock to 40Mhz similar peripheral capabilities.