I have these 3 variables:
a and b can be anywhere from 0 to 999.Code:a VAR WORD
b VAR WORD
I need to work out a way of displaying an a/b percentage on my LCD to 1 decimal place.
I thought of this;
which would give me the percent, with the last decimal being the decimal place. But this wont work if a=999 becuase 999*1000 is lager than a WORD can be.Code:a VAR WORD
b VAR WORD
pct VAR WORD
pct=(a*1000)/b
I'm using PBP 2.46 so I cant use LONGs.
Any ideas? I'm sure this is possible, but i'm having a brain freeze.