Maths advise needed


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2009
    Location
    London
    Posts
    251

    Exclamation Maths advise needed

    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:
    Code:
    					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
    Code:
    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

  2. #2
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default Re: Maths advise needed

    Problem Sorted. Taking the remainder and multiplying it by 10 and dividing again.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts