+ Post New Thread
Results 1 to 2 of 2
  1. #1
    Full Member level 4
    Points: 2,317, Level: 11
    Achievements:
    7 years registered

    Join Date
    May 2012
    Posts
    222
    Helped
    10 / 10
    Points
    2,317
    Level
    11

    Problem understanding Signed Fractional Format

    I am bit confused with application note http://ww1.microchip.com/downloads/e...tes/01017A.pdf

    regarding the signed fraction format, I see in the document -1.0 6000 RPM Reverse and 0.99997 6000 RPM Forward, but -1 is 6000 RPM reverse then ideally +1 should be 6000 RPM Forward. Am i correct? I downloaded the source code it seems to be ok I mean 6000 Rpm reverse and Forward are matching.

    Code:
    // CONDITION RPM SFRAC16 SINT HEX
     // Max Speed CW -> 6000 RPM -> 0.996805 -> 32663 -> 0x7F97
     // Min Speed CW -> 60 RPM -> 0.009984 -> 327 -> 0x0147
     // Min Speed CCW -> -60 RPM -> -0.009984 -> -327 -> 0xFEB9
     // Max Speed CCW -> -6000 RPM -> -0.996805 -> -32663 -> 0x8069
    But main questions are

    1. How 0x7F97 is 0.996805 i tried hard to understand but not able to decode.

    My analysis is something like this. I am assuming it is 16 bit and Q15 Format. 1 Integer and 15 Fractional bits

    0x7F97
    B15 is signed bit,
    (2^-1) + (2^-2) + (2^-3)+
    (2^-4)+(2^-5)+(2^-6)+(2^-7)+
    (2^-8)+2(^-11)+
    (2^-13)+(2^-14)+(2^-15) = 0.996795654 but it does not match with 0.996805.

    2. The other related question why he should select 32663?



    Please help.

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 30,790, Level: 42
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,087
    Helped
    1692 / 1692
    Points
    30,790
    Level
    42

    Re: Problem understanding Signed Fractional Format

    They use .996795654 for .996805 because you can't get closer to the actual value with only 15-bits. You would have to have an extra 4-bits minimum to obtain a result that is correct to the 6th fractional digit (you should have 6-bits more if you want to guarantee it will be correct to the 6th digit.)

    Calculate 0x7F975 = 0.996805191

    You can think of it this way 2^-21 = 0.00000047684 six 0's followed by a digit, so any number with that bit set will have at least 6 digits that are correct in the number as you are now contributing to a 7th bit to get the value closer to the 6 fractional bit number.



--[[ ]]--