View Full Version : how to display division on lcd
alexandro34
- 2nd August 2009, 14:54
Very stuepied queastation ,but (((.
for pic16F84A
for example if we have :
dc var word
dc=1/5
how to display on lcd
i have tried
lcdout $FE,1 , dec4 dc....
the result is "0"
P.S I am in the beginning of pic basic pro...
aratti
- 2nd August 2009, 15:27
Since PBP cannot deal with decimal you have to overcome the limitation in this way:
dc = 100/5 (dc=20)
LCDOUT $FE,1 ,"0.0",#dc
display 0.020
Al.
alexandro34
- 2nd August 2009, 17:14
Since PBP cannot deal with decimal you have to overcome the limitation in this way:
dc = 100/5 (dc=20)
LCDOUT $FE,1 ,"0.0",#dc
display 0.020
Al.
ok ,thanks a lot
Please give me one example : 1/8 =0,125
Archangel
- 2nd August 2009, 17:22
Since PBP cannot deal with decimal you have to overcome the limitation in this way:
dc = 100/5 (dc=20)
LCDOUT $FE,1 ,"0.0",#dc
display 0.020
Al.Must be that "new math" ;) , .20, you can display that as a string by putting it in quotes, LCDOUT $FE, 2, "1/5" , or as Al pointed out LCDOUT $FE,1 ,"0.",#dc , where the STRING "0." are just symbols for you humans to get your mind around and the real data follows from #dc
Archangel
- 2nd August 2009, 17:39
ok ,thanks a lot
Please give me one example : 1/8 =0,125 Just as before, 1/8 *1000 = 125, do this because PBP only does integer math, this gives you the answer 125. Display as before LCDOUT $FE, 2, "0."#dc , Or as a European display LCDOUT $FE,2,"0,"#dc .
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.