PDA

View Full Version : Math Problem



willie
- 21st September 2014, 23:06
Hello group,
Well I have a math problem I'm trying to figure out is decimal math.
I have an input that is .011 per input, now I am trying to figure out how to multiply that by that decimal value and display it with LCDout command.
I have tried several things but it just does not work.
I guess I am just a dummy when it comes to math in PBP3.
I am just lost right now. Any help would be just great.
Thank you
Willie

HenrikOlsson
- 22nd September 2014, 08:31
Hi,
You mean you're sampling a signal with the ADC and each "count" in the returned ADC resulut equals a real value of 0.011? Ie, if the ADC returns 455 you want your LCD to display 5.005?

You could start by multiplying the ADC result by 11. That would, with the above example, give you the value 5005. From there it's as simple as

LCDOUT $FE, 1, "Value: ", #Result/1000, ".", DEC3 Result//1000

That's one way....

/Henrik.