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.

sensors - why 2's compliment mode ?

Status
Not open for further replies.

neddie

Full Member level 5
Joined
Feb 23, 2010
Messages
251
Helped
41
Reputation
82
Reaction score
35
Trophy points
1,308
Location
South Africa
Activity points
3,026
Hi all.
I'm currently using an accelerometer (LIS3DH).
It's output is given in 2's compliment format.
Why do they do this.
This is pretty common practice with lots of sensors and high res a2d's etc.
I know it makes subtraction easy , but is there any other reasons for outputting data
in 2's compliment form.
Cheers
Neddie
 

Hi,

It seems you complain about 2´s complement.
But don´t tell: what alternative do you see?

Binary addition and subtraction, 2´s complement or not, is always the same.

Klaus
 

I'm not complaining about it , I was just wondering why 2's compliment and not straight binary.
It's easy to convert 2's compliment , it's just an extra step.
 

Hi,

Straight binary is positive only: for an 8 bit code: 0....255 (= uint8. Zero is at the lower limit)
Two´s complement is positive and negative: -128 ... 0 ...127 (= int8. Zero is in the middle)

Examples:
Acceleration can be positive as well as negative. Therefore you can´t use straight binary.
Kelvin values or RMS values are positive only. Here you can use straight binary.

Klaus
 
  • Like
Reactions: Okada

    Okada

    Points: 2
    Helpful Answer Positive Rating
This is because signed arithmetic operations are much easier to do in 2's complement format (easier to design hardware for).

There're other methods to implement signed arithmetic - but 2's complement is the easiest to do in hardware (microcontroller / FPGA / etc...)

Watch this video:
https://www.youtube.com/watch?v=9W67I2zzAfo
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top