PDA

View Full Version : Multiplication on a PIC??



Tom Gonser
- 31st March 2005, 16:37
I am still not sure how the math functions work on the PIC level -- so much different than in say 'MS Excel'....

I have a value (address) which is ranging from 0 to 64,000.

I want to compute and display the %age of memory full. Pretty simple.

(Address/64000)*100 = my_value

If Address = 30,000, then my_value = 46.88 ..

However, in my PicBasicPro world, the formula

(Address/64000)*100 nets me '0'....

I want to be able to display on an LCD -

Memory: %46.8

Figure using the my_value dig 2, my_value dig 1,".",my_value

might do it, but alas.. nothing..

What's the trick? (Yes, I've read the manual.. I am not strong in math and it does not make much sense to me)

Help!

Tom

Dwayne
- 31st March 2005, 16:43
Hello Tom...


Tom>>However, in my PicBasicPro world, the formula

(Address/64000)*100 nets me '0'....<<

Divide by 64 then move your decimal over
lets say you have

30,000

30000/64 = 468

Which represents 46.8

Dwayne

Tom Gonser
- 31st March 2005, 17:09
Ahh!! Easy, huh! Thanks. Works great

Dwayne
- 31st March 2005, 17:17
You're welcome anytime!

Dwayne