PDA

View Full Version : Math Problems



willie
- 7th April 2015, 22:39
Hello Group,
I have 2 floating Point problem that I can't figure out.
The first is each time a switch closes I need to increment the value by .011 and have it display on a LCD with the correct value.
The second problem is each time a switch closes I need to increment the value 1.492 and show it on a LDC.
I have tried many things but I don't get the correct read outs.
Can someone help me with the code to have the correct read outs.

Than You
William Oliver

pedja089
- 7th April 2015, 23:00
Why you need to use FP for that :confused:
You can use integers for that simple math...


Counter VAR LONG
Main:
IF button1=pressed THEN Counter = Counter + 11
IF button2=pressed THEN Counter = Counter + 1492
LCDOUT $FE,1, DEC Counter /1000, ".", DEC3 Counter //1000
GOTO Main