Hi,
With PBPW a multiplication results in an internal 32bit result. The */ operator returns the middle 16 bits (inherent division by 256) while the ** operator returns the top 16bits (inherent division by 65536) of this 32bit intermediate result. You need a WORD variable to accommodate the "full" result.
With PBPL a multiplication results in an internal 48bit result. The */ operator returns the middle 32 bits (inherent division by 256) while the ** operator returns the top 32bits (inherent division by 65536) of this 48bit intermediate result. You need a LONG variable to accommodate the full result.
Yes */ can only result in a word the same applies to DIV32 in PBP2.xx as LONGs are not supported.
You don't need PBP3 to use LONGs. Support for that was introduced in PBP2.50, 7 years ago. But you DO need to use an 18F part.
And, finally, DIV32 isn't supported (not needed) with PBPL since it uses a 32bit division routine by default.
All this according to the manual.
EDIT: Both the */ and ** operators supports variables on both sides of the operator while DIV32 requires a constant on the right side. You can't do
Code:
Dummy = 1000*1000
Result = DIV32 myVAR ' Won't work, DIV32 requires division by a constant.
EDIT again, about that DIV32 requiring a constant.....I'm not sure any more. Must try it on actual hardware so you may want to disregard that for the moment :-)
/Henrik.
Bookmarks