This is probably way too late, but, Here's one possibility for getting the decimal result of a division.
Code:
' Display Decimal result of a division
define OSC 4
define LOADER_USED 1
DEFINE HSER_TXSTA 24h ' Use this for Higher Baud Rates
DEFINE HSER_SPBRG 25 ' 9600 Baud at 4mhz
i var byte
x var byte
y var byte
Res var byte
DD var word
clear
i = 4
y = 3
x = i / y ' do the division
Res = i // y ' get the remainder
DD = 10000 ' Multiply remainder * 10,000
DD = Res * DD
DD = div32 y ' Divide remainder by original divisor
Hserout [ Dec x,".",dec4 DD,13,10,13,10] ' Sends 1.3333 out the hardware serial port
'Lcdout Dec x,".",dec4 DD ' Displays 1.3333 on LCD
end
Best regards,
Darrel Taylor
Bookmarks