First of all, I wish my brain and math got along with each other - but I guess I can't have everything.

I'm trying to measure the input voltage of the circuit and display it on the LCD. To that end, I have a voltage divider with the mid-point hooked up to (it so happens) ADC 2. The idea was that 15V input would give a full-scale 5V to the pin, using Vdd as the reference. It so happens that my Vdd is exactly 5V.

When my power supply is sending 14.7V to the circuit, my ADC value (in decimal) is 732. So I took 732 / 14.7 = 49.8.

This is what I did. Multiply my ADC value by 10 and divide by 498. And the decimal is the result mod 10 since I multiplied by 10. What I get for the decimal is .04 not the .70 I expect - what the heck am I doing wrong? BTW, VOLTS_IN and VOLTS_FRAC are both word variables. Below is the code I have, any help is appreciated.


Code:
MEASURE_VOLTS:
	ADCIN 2, VOLTS_IN 'READ CURRENT VALUE OF INPUT VOLTAGE DIVIDER
	VOLTS_IN = (VOLTS_IN * 10) / 498
	VOLTS_FRAC = VOLTS_IN MOD 10
	
	LCDOUT $FE, 1, "CURRENT INPUT"
	LCDOUT $FE, $C0,   "VOLTAGE IS: ", DEC2 VOLTS_IN, ".", DEC2 VOLTS_FRAC