Electronic – Digital GPIO vs Analogue inputs on microcontroller

analogdigital-logicgpiomicrocontroller

A general question that I can't find an answer to so easily. Why is it that each digital input pin to a microcontroller doesn't require an extra pin for ground? Each analogue input requires two inputs , + and -. I would have thought that all inputs, be it digital and analogue would need a reference voltage (ground).

I am talking specifically about using a development prototyping board. The one I am using Atmel is Xplained pro for SAMD21 chip.

Thanks in advance.

Best Answer

The digital inputs all share the same common ground as the microcontroller.

Not all analog inputs are differential (i.e. having + and - inputs), many microcontrollers allow you to configure them as single-ended or differential for example.

The differential inputs allow you to be more accurate for very low level signals by rejecting common mode signals and ground errors.

This is not as necessary for ordinary low speed digital signals as they have the built in noise margin from the logic level specifications.