Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem understanding Signed Fractional Format

Status
Not open for further replies.

electronicsman

Full Member level 5
Joined
May 4, 2012
Messages
291
Helped
11
Reputation
22
Reaction score
12
Trophy points
1,298
Activity points
3,737
I am bit confused with application note https://ww1.microchip.com/downloads/en/AppNotes/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.
 

Attachments

  • FixedPt.jpg
    FixedPt.jpg
    31.4 KB · Views: 120

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.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top