Which chip are you using?

I do not see the need for the math
potpos= 1+(((255-1)*A2D_V)/255)

The same is
potpos = A2D_V

???