Hi, I'm using a 16F876A with a 20mhz resonator in a 2 motor robotic project. The program compiles and runs ok but can't get the A/D to run right. The input to Porta.0 and Porta.1 is a two axis joystick that outputs 2.5 volts in both axis's at center position. The output is the two PWM channels. The reverse is handled by seperate switches apart from the PIC. Below is a sample of the code:

ADVAL0 VAR BYTE 'FORWARD/BACKWARD A/D STORE
ADVAL1 VAR BYTE 'LEFT/RIGHT A/D STORE
ADVALL VAR BYTE 'LEFT MOTOR SLOWER VARIABLE
ADVALR VAR BYTE 'RITE MOTOR SLOWER VARIABLE
DEFINE OSC 20 'SYSTEM OSCILLATOR 20 mhz
DEFINE ADC_BITS 8 'NUMBER OF BITS = 8
DEFINE ADC_CLOCK 3 'INTERNAL A/D RC CLOCK
DEFINE ADC_SAMPLEUS 50 'SAMPLING TIME IN uS
DEFINE CCP1_REG PORTC 'PORT C HPWM1 OUTPUT PORTC.2 (LEFT)
DEFINE CCP1_BIT 2
DEFINE CCP2_REG PORTC 'PORT C HPWM2 OUTPUT PORTC.1 (RITE)
DEFINE CCP2_BIT 1
TRISA = %11111111 'PORT A ALL INPUTS
TRISB = %00000000 'PORT B ALL OUTPUTS
TRISC = %00000000 'PORT C ALL OUTPUTS

Can anyone look at this and tell me what I'm doing wrong - and what I need to make it right?
Thanks for all help!
Ron