VM = ((Dist * 36)/Time) * 10
No problem... your calaculation equates to...
VM=Dist *360/Time
So just write it as...
TempB=360
TempA=Dist * TempB
VM=DIV32 Time
where all the variables used are words...
Dist var Word
TempA var word
TempB var Word
Time var Word
VM var Word
The Dist * TempB produces a 32 bit answer which you cannot directly access, but by running immediately the DIV32 you return a 16-bit answer. See section 4.17.8 in the PBP manual.
Melanie
Bookmarks