Here's a different way to do it that should be a little more accurate.

https://www.picbasic.co.uk/forum/showthread.php?p=2010

Just change the Res1 and Res2 variables to match your voltage divider.
<br>