I need to divide an integer by a real number with the following constraints or conditions...

Integer value is in the range 0 to 1023

Real Divisor value is in the range 50 to 500 with 2 decimal precision

16bit Integer calculations only (maximum 65535)

Output precision = 2 decimal place

The output is used only for display (not further calculations)

The divisor is multiplied by 100 at start

Using basic programming with 16bit integer...

div = 4144 ' Enter data in integer form (41.44*100)

ain0 = 450 ' Integer value to divide

voltint = (ain0 / div) * 100 ' This gives the integer output (Left of dp)

Tmp1 = ain0 * 10 / div * 1000 '

The above line gives 0 due to division part of the equation results in a value less than 1 before multiply by 1000.

Voltdp = Tmp1 - (voltint * 100) ' this line removes the integer portion before display value for right of dp.

Correct result would be 10.85

Any suggestions on how to obtain the value for the right of Decimal Point considering the constraints mentioned.

Thanks

Toni

----------------------------------

complete subroutine

Display volt:

div = 4144 ' Scale factor (41.44*100)

ain0 = 450 ' Integer value to divide

Voltint = (ain0 / div) * 100 ' Build integer part

Tmp1 = ain0 * 10 / div * 1000 ' Build fractional part

Voltdp = Tmp1 - (Voltint * 100) ' Remove int

Print #voltint, "."

{code here for 0 insertion}

Print #voltdp, "V "

Return