I think your problem is here:
Code:
Adcin 2, x ' Read ADC value on AN2 (PORTA.2)
you are reading the value of AN2, then storing in x
You should be storing in potval

And WELCOME to the forum!!