DIV32...it's in the book.
thanks shimask
ive done this:
The only problem im having now is with rounding. If the real percentage is 65.28% id like it to display 65.3%, but of course im getting 65.2 because its just truncating the result.Code:a VAR WORD b VAR WORD pct VAR WORD temp VAR WORD temp=a*1000 pct=DIV32 b
"I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams
???????
Add .05 to everything...but that's a good trick since PBP doesn't support decimal points.The only problem im having now is with rounding. If the real percentage is 65.28% id like it to display 65.3%, but of course im getting 65.2 because its just truncating the result.
So how are you handling that?
If I get it right;
Why not this way?
Something like this way???Code:<font color="#000000"> A <font color="#000080"><b>VAR WORD </b></font>B <font color="#000080"><b>VAR WORD </b></font>Solid <font color="#000080"><b>VAR WORD </b></font>Liquid <font color="#000080"><b>VAR BYTE </b></font>DoMath: '....get values from somewhere.. Solid = A/B Liquid = A//B <font color="#000080"><b>IF </b></font>Liquid <font color="#000080"><b>DIG </b></font><font color="#FF0000"><b>0 </b></font>>= <font color="#FF0000"><b>5 </b></font><font color="#000080"><b>THEN </b></font>Liquid = Liquid + <font color="#FF0000"><b>10 </b></font>Liquid = Liquid <font color="#000080"><b>DIG </b></font><font color="#FF0000"><b>1 </b></font><font color="#000080"><b>LCDOUT </b></font><font color="#FF0000"><b>$fe</b></font>,<font color="#FF0000"><b>1</b></font>, <font color="#008000"><b>"A:"</b></font>,<font color="#000080"><b>DEC </b></font>A, <font color="#008000"><b>" B:"</b></font>,<font color="#000080"><b>DEC </b></font>B <font color="#000080"><b>LCDOUT </b></font><font color="#FF0000"><b>$fe</b></font>,<font color="#FF0000"><b>$c0</b></font>,<font color="#008000"><b>"%"</b></font>,<font color="#000080"><b>DEC </b></font>Solid,<font color="#008000"><b>"."</b></font>,<font color="#000080"><b>DEC </b></font>Liquid <font color="#000080"><b>PAUSE </b></font><font color="#FF0000"><b>30 </b></font><font color="#000080"><b>GOTO </b></font>DoMath
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Hi, Sayzer
You' re to it ...
With showing the Half, now ( was DS 1820 Degrees with 3 Digits Leds...)
Have a nice dayCode:IF ( TEMP > 2631 and Temp < 3731) THEN ' -10 to 100°C Virgule = 1 ' round to 1/2 degré et show the 5/10 IF(Tempa // 10) < 3 THEN Tempa = ( Tempa/10)* 10 : GOTO AFF IF(Tempa // 10) < 8 THEN Tempa = (Tempa/10)*10 + 5 : GOTO AFF IF(Tempa // 10) > 7 THEN Tempa = (Tempa/10)*10 + 10 : GOTO AFF ENDIF Virgule = 0 IF (Tempa // 10) > 4 THEN Tempa = Tempa + 10 Tempa = Tempa/10 ' Show Degrees without tenths
Alain
Last edited by Acetronics2; - 16th February 2008 at 10:57.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks