4.1056 Vdc is actually 41,056.
41,056 * 2 = 82,112 which is larger than a word sized variable can hold.
82,112 - 65536 = 16,576 which is why you're seeing 1.6576 returned in AdVal1.
Try something like ADval1 = (ADval/10) * 2, and you should be back in the ball game.
This will return 8,211 so --
SEROUT2 PORTB.1,Baud,[dec ADval1 dig 3,".",dec3 ADval1," Vdc ADVal1",$0D,$0A]




Bookmarks