It's possible to show on LCD decimal numbers;
value = SQR 10 ' give 3,16
i use this:
Lcdout $fe,1, DEC (value DIG 2), "." ,DEC (value DIG 1) ,DEC (value DIG 0)
but not show correct.
It's possible to show on LCD decimal numbers;
value = SQR 10 ' give 3,16
i use this:
Lcdout $fe,1, DEC (value DIG 2), "." ,DEC (value DIG 1) ,DEC (value DIG 0)
but not show correct.
Last edited by skimask; - 30th March 2007 at 20:25.
Hi savnik,
This is a very common problem.
A similar question is asked here.
Be sure to see Darrel's great explanation:
http://www.picbasic.co.uk/forum/showthread.php?t=5545
-Adam-
Ohm it's not just a good idea... it's the LAW !
i have two variables:
x var word
y var word
and x < y.
How to show on lcd the result of x/y , or the value = SQR x/y
Last edited by savnik; - 31st March 2007 at 09:11.
This has worked for me. Play with it.
Note DEC2 and // after the dummy “.”Code:RESULT VAR WORD LCDOUT $FE,1,DEC RESULT/100,".",DEC2 RESULT//100
The DEC2 gives the last two digits and // gives the remainder or MOD of a number.
I use this to monitor battery voltage to the hundredths place.
Dave
Always wear safety glasses while programming.
Right...I understand that. I'm still trying to make you understand.
Again, I ask you to do a search in the PBP manual for floating point math and tell me what you come up with (same hint: we've already been through this in January, see post #8 of the "16f877 with LM335 problem" thread ).
I have read the manual for floating point very well and i have see post #8 of the "16f877 with LM335 problem" thread.
i use this:
Code:' forwardpower = 400 ' reflectedpower = 20 B0 = forwardpower/reflectedpower ' = 400/20 = 20 B1 = 10000/B0 ' = 10000*1/20 = 500 B2 = SQR B1 ' = 22,360679 B3 = (10000+B2*100)/(100-B2) ' = (10000+22*100)/(100-22) = 12200/78 = 156,4 Lcdout $fe,$90, "SWR : ",DEC (B3 DIG 2),".", DEC (B3 DIG 1),DEC (B3 DIG 0)
Bookmarks