PDA

View Full Version : 2 variable



isaac
- 24th May 2004, 20:26
Hello All,
Could someone be kind enough to help me in adding those 2 variables
This is the story.

I have got 2 variable Fint & Fdec, Fint contains the integer part of my result(16bits) while Fdec contains
the decimal part of my result
so to display a result of 2717.6Hz on an lcd i do the following assuming the variables already contain the following
Fint = 2717
Fdec = 6
LCDout I, Line1,"Result = ",dec Fint ,".",dec Fdec,"Hz"

Now i need to modify the result so that i can also display Frequency squared (2716.2)2 divided by 1000
this means adding Fint & Fdec somehow to give 27176 then multply by itself before dividing using DIV32 to divide
Its combining them that i find a bit stricky could anyone help

Isaac

Melanie
- 24th May 2004, 20:37
This is your tricky bit solved...

BigWord=(Fint*10)+Fdec

Naturally, you cant have Fint bigger than 6552 to start with.

Now to do some easy stuff like turning Gold into Lead...

isaac
- 24th May 2004, 21:59
Thanks Mel
i really feel that i should have thought it through
my max Fint would be 6000 so i should be ok

Thanks for your help

Isaac