I've separately coded and tested most of the functions that I want on a balancing robot but I now have to put them together in one program on a 16F877. I'm now wondering if that is even possible and was hoping that somebody with a feel for this type of thing could offer some insight. I'm got functions for the following: 1. A gyro input. I use timer_o to create a 1500 uS pulse. 2. A gyro output. I use CCP_2 to get the duty cycle. 3. Accelerometer output. I use CCP_1 to get the duty cycle. 4. PWM for 2 motors. I previously used CCP_1 and CCP_2 for these. 5. I have a future need for a timing cycle for 2 wheel encoders. I think I can use timer_2 for function 5. but obviously I can't do 4. with 2. & 3. Any suggestions? Thanks.....Harry -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist