Here is my code. I must be doing something wrong becaue I keep getting strange values for the result. I get a 10bit ADC result, convert that result to a flow value with a lookup table with interpolation.

I then take the result and multiply it by a scalar value located in eeprom devided by 6601.

result2 = (slalar/6601)* result

scalar = 13202 so

13202/6601 = 2

this should double my result but for some reason it's not working.

Any ideas??
Code:
doloop2:
 usbservice
  Adcin 9, mafin  ' take value from an9 place it in mafin
  READ 253, mafscalar  ' read eeprom value at location 253 place it in mafscalar
 tempval = mafin >> 3    ' shift input for table lookup devide by 8
 tempval2 = tempval & %1111111111111110 ' clear last bit for WORD lookup
    'get table high and low values
 READcode (inputtable+tempval2+2),tablehigh.BYTE0
 READcode (inputtable+tempval2+3),tablehigh.BYTE1
 READcode (inputtable+tempval2),tablelow.BYTE0
 READcode (inputtable+tempval2+1),tablelow.BYTE1
    'Table Interpolation
 tempval = mafin & %0000000000001111 ' get interpolation value add 1 less than table spacing to mafin 15
 IF tablehigh >= tablelow THEN       ' get space between table values
 tempval2 = tablehigh - tablelow     '
 ELSE                                '
 tempval2 = tablelow - tablehigh     '
 ENDIF                               '
 tempval = tempval2 * tempval        'multiply high/low diff by interp value
 flow = tempval >> 4            'divide by table spacing 16
 IF tablehigh >= tablelow THEN       ' offset table value by calculated
 flow = flow + tablelow    ' interpolation value
 ELSE                                '
 flow = tablelow - flow    '
 ENDIF                               '
flowsub:
 usbservice
 mafscalar2 = mafscalar/6601   'mafscalar is 13202 right now to get a value of flow that is doubled
 flowfinal = flow * mafscalar2 'multiply flow value by maf housing size scalar