Megahertz
- 29th June 2012, 14:35
My readings from an analog sensor go from 724 to 3604. These valid readings measure angle of 0 - 90 degrees. My initial code is the following:
If Value<724 then
Value=0 : Dummy=0 : Goto Jump4 : Endif
Value=Value-724
Jump4:
Dummy=Value*9
Angle=Dummy/288
Temp=(Dummy*10)/288
Angle2=Temp DIG 0
I want to display increments of 0.1 but the problem is that it works fine upto the reading of - 6552 (in Dummy variable) as readings after it goes beyond the 16 bit limit.
So as a result
Temp=(Dummy*10)/288 starts overflowing and results after the decimal digit stored in Angle2 start getting messed up. Anyone has any idea on how to deal with this situation please. Thanks
If Value<724 then
Value=0 : Dummy=0 : Goto Jump4 : Endif
Value=Value-724
Jump4:
Dummy=Value*9
Angle=Dummy/288
Temp=(Dummy*10)/288
Angle2=Temp DIG 0
I want to display increments of 0.1 but the problem is that it works fine upto the reading of - 6552 (in Dummy variable) as readings after it goes beyond the 16 bit limit.
So as a result
Temp=(Dummy*10)/288 starts overflowing and results after the decimal digit stored in Angle2 start getting messed up. Anyone has any idea on how to deal with this situation please. Thanks