I'm using the AD2S1210 to read a motors speed but I'm confused with the LSB conversion and the max speed...
The datasheet states that the maximum speed the IC can measure at 16-bit resolution is +/-125 rps. At the maximum speeds, the corresponding values within the register are:
125 = 0x7FFF
-125 = 0x8000
where the LSB resolution is 0.004
however, I can't seem to get the correct values with the code I've written:
Thanks! I've corrected that, Although I think I still might be missing something for the 10-bit conversion, here's the code I have so far:
float rotationOutputDataToSpeed_10Bit(int32_t binRep){
//Checks whether or not the number is negative
int negFac = ((binRep >> 15) != 0 ? -1 : 1);
//Correct -1 for twos compliment
if (negFac == -1) binRep -= 1;
return negFac*(0xFFFF&binRep)*0.00381481368; //was 0.004
}
Now, I get 2500 for binRep = (0x1FF << 6) (great!), but I get -5000 for binRep = (0x3FF << 6)...