When I use this statement:
hserout [dec (12 * 10000),$0D, $0A] the result is 54464.
Why is the math not working?
Printable View
When I use this statement:
hserout [dec (12 * 10000),$0D, $0A] the result is 54464.
Why is the math not working?
The math is working great - you overflowed (went beyond 16 bits)
12*10000 = 120000 = $1D4C0 (hex)
keeping the lower 16 bits = $D4C0 = 54464
clear as mud?
Is there anyway to get around this?
Where are you sending the data? If sending to a PC, send the 12 and send the 10000. Let the program on the PC handle it.
Or, look at DIV32 in the manual.
or switch to a 18F, and use LONG variable type ;)