Question : Problem: 2's complement output..

I have CS5550 from cirrus logic. The output register is of the form

-(2^0)  (2^-1)  (2^-2) .......... (2^-23)

This is a 24-bit register. It is given in the datasheet that : These register contain the last value of the measured results of AIN1 and AIN2. The results will be within the range of -1.0 <= AIN1, AIN2 < 1.0. The value is represented in 2's complement notation, with the binary point place to the right of the MSB (MSB have a negative weighting. These values are 22 bits in length. The 2 least significant bits,(located at the far right-side) have no meaning, and will always have a value of "0". I use this ADC for weighing scale application. How can I use the output from ADC to calculate the weight? So far I dealt with ADC's which give output in binary coding and I can directly map into corresponding weight. I have no idea with the 2's complement form.

Answer : Problem: 2's complement output..

If they said the value is going to be in the range of -1 to 1 and is in 2's complement, then the most significant bit (MSB) is the leftmost bit and zero means you have a positive number, while one means you have a negative number.  You still have to scale the maximum values to the limits of -1 and 1, so if this were an 8-digit register and you read 01111111, that would translate to 127, and since this is the maximum positive number, you would scale it to 1.  01000000 would translate to 64, which would scale to 64/127, and so on.  For negative numbers, 10000000 would translate to -128, scaled as maximum negative number would make it -1, 10000001 would translate to -127, and would scale to -127/128.  The negative numbers have a slightly different scaling because there is no negative 0, and so 10000000 is an actual value.  Expand the example to 22-digits and you should have your solution.
Random Solutions  
 
programming4us programming4us