Reputation: 35
I found in a stepper driver datasheet L6472 the following description:
What is the "unsigned fixed point 0.28 format"?
I found information about the fixed point format itself, but what does the 0.28 mean?
Is there an easy implementation for this conversion from [step/s] to SPEED in C on a micro-controller without floating point unit?
Upvotes: 3
Views: 697
Reputation: 223814
The notation m.n for a fixed-point format means there are m bits representing an integer portion of a number and n bits represent a fractional portion of a number.
If you have m+n bits interpreted as some integer N, then the same bits would be interpreted as an m.n fixed-point number N/2n.
So, if you have 28 bits that, when interpreted as an integer, represent a value of N, then, when interpreted as a 0.28 fixed-point number, they represent a value of N/228.
Note that it is unusual for a register to have only 28 bits. If the register actually has 32 bits, then the high four bits should be ignored when interpreted the contents as a 0.28 fixed-point number, unless it is known they must be zero.
Upvotes: 4