Search this site (

CCS C Compiler for Microchip PIC micros

Your ad here


Why a common ground point for analogue/digital?

[taken from PIClist]

This is the best discussion I have seen of why a common ground point for mixed
analogue/digitial circuits is needed. It is particularly relevant for PIC micros that
use radio chips - Shane.


Current flowing through wiring will develop voltage drops that shift the
supposed "ground" reference to something other than the desired ZERO point.

The problem is not just an analog versus digital problem. It can rear its ugly
head in almost ANY analog circuit, and can even wreak havoc in an all-digital
circuit. It is, however, particularly prevalent in mixed analog/digital systems.

Ground wires serve two different functions. Sometimes they are used to carry
currents. At other times you want the ground to serve as a rock-solid reference
point for making precision measurements. This is especially true in A/D circuits
with more than 8 bits of desired resolution.

The best way to handle the ground problem is to have different ground systems
that connect at only one point. The precision analog REFERENCE ground should
always be designed so that an absolute minimum of current actually flows through
it. In practice this is accomplished by having all reference ground connections
terminating at a SINGLE POINT.

Firstly, all MEASUREMENT ground connections should use individual traces that
converge at a single REFERENCE POINT. The idea is to not allow any current flow
through one reference trace to affect any other reference trace. What you want
to avoid is having one long trace that snakes all over the board, with many
different ground connections being made at differnt points along this trace. The
currents will add up, causing differnt voltages to appear along the trace. This
is bad news.

Secondly, all GROUND POWER supplied to the analog section should use another
ground system. This ground system should have a single connection to the
REFERENCE ground point.

Thirdly, a COMMON ground connection to any major DIGITAL GROUND system should
ALSO be made to the single REFERENCE ground point.

If properly constructed, the REFERENCE ground point becomes a nice rock-solid
point from which measurements can be made. It will be COMMON to all other system
grounds, but this common connection should NOT itself experience any current
flow. Or at least the current flow should be absolutely minimal.

In extremely noisy systems the analog section may be floated or isolated from
other sections. In this case data is communicated from one section to another
via opto-isolators, transformers, or using other isolation techniques. Complete
isolation is also desired in medical systems where even small currents can do
great damage to a patient.

The tendency when laying out a printed circuit board is to just run a ground
trace around the board and have all kinds of things attach themselves to this
running ground. But if you desire precision measurements you MUST have a
precision reference POINT to which ALL measurements are referenced.

Fr. Tom McGahee


I've seen it mentioned here a few times about "seperating" the digital and
analog ground plains from each other.

Since everything eventually has to be connected to the same common ground
somehow (at least in my circuit), how exactly is that done? I mean, how does one
keep the digital signals from getting mixed into the analog ground plane? With a
signal diode, a cap? An example diagram (draw me a picture ;-), or a URL to a
page/circuit that outlines that would help.

Sorry for the stupid question, I've never had to worry about this in my little
analog circuits.



Not stupid - this is a basic problem when mixing analog and digital. Less
important for slow signals and low sampling resolution [ie, 8-bits]. More
important for faster signals, high-sensitivity [ie, less a few mV], and high-
resolution [ie, = 12 bit sampling].

The general solution to successfully mixing analog and digital probably doesn't
exist, but everyone has a dozen or so partial solutions, and there are "very
long" threads about this on piclist - if you can find them. This whole area is
probably more art than science.

"High-Speed Digital Design" by Howard Johnson is one place to look.

The basic idea to separating digital and analog grounds is simply just that -
keep them physically and electrically separate from one another all over your
circuit, and tie them together at ONE point only - at the place where the power
comes onto your board. This point usually has wide traces with low impedances
[meaning the digital currents will devleop relatively low noise signals --
Vnoise = Idigital * Z]. Also, a "one-point" connection helps prevent ground
loops. Think of the various grounds emanating from that point kind of like the
legs of an octopus. That is the common solution.

OTOH, if you look at the datasheets for various high-performance A/D converters
[downloadable from National Semi, Linear Tech and Maxim], you will see many of
them recommend making the "one-point connection" directly under the A/D itself,
which is usually not at the power insertion point of the board. So this kind of
goes against the common solution just described.

This being said, however, does not mean that simply separating the gnds is going
to magically make your analog circuitry noise-free. This is not a stupid or
trivial problem by any means - and many engineers spend their entire lives
trying to figure it out -[and some are still working in it - he, he].

hope this helps,
- dan michaels


Okay, I guess that "leads" me to another question or two. How should I tie in
the 2nd ground pin on an F876? And why is it even there for that matter? I was
just going to connect it to the other ground pin by running a trace underneath
the part between them.


First, you have to realize that this is EE, and not CS, and there is a lot of
art and black magic here [as Johnson mentions in his book], and that everyone
seems to have a different experience and opinions with this stuff. There is
probably no one true answer, regarding pcb layouts/etc.

Some people think one of those gnds is for analog and the other is for digital,
and should be used that way. However, I just measured several chips with my DMM,
and got about 2 ohms between the gnd pins - which is actually same reading as
between the 2 Vdd pins. So looks like they are simply tied together inside the
chips. Personally, I always use a pcb trace between them. (see next message - Ed.)


I spoke briefly with one of the Microchip fellows in Arizona, and he
confirmed that the ground pin next to the port A pins is used internally
in a way that is much closer to the A/D converter, and is thus meant to
be the analog ground.

The issue was never that important with the 8 bit converter, which Dr.
Seuss could make work. The issue will become more and more important
with 10 and especially 12 bit converters in the 873, 773 and others.

The important thing to remember is reference point. If the octopus
leaves the analog pin on the converter, and the signals are all
referenced to that point, and extraneous currents are not expected to
pass through the net to the digial side, then I predict that you will
have arrived at electron narvana. The last piece of the puzzle, if you
have a ground more like a tree of branches, is where to link in the
power supply.

I had a design with lots of real high gain low noise stuff on it, in
addition to a whole raft of A/D and D/A and a PC104 processor. The
first design worked like shit. The digital noise was crushing the
signals. We then made two seperate boards, one for analog and one for
digital. Seperate supplies. And optos for digital signals, and coax
with differential recievers for analog signals. The results were
breathtaking. The digital noise was nearly absent, and the final result
was an A+. I know that this is an extreme example, but just consider
doing some of these things on the board itself. Seperate ground
planes. Seperate regulators for analog and digital. Deliver signals
differential and use an IA at the receiver.

This all presumes you have identified a real fault to begin with. If
you run the converter without a software filter, and put a fixed input
to the front end, and display the value, if properly done you should be
able to sit on a bit. Some assume that if you add a software filter,
who cares about 4 bits of noise? This is a lazy approach to the
problem, especially when the answer is a change in the pattern on the

Also, I never used anti alias filters before, as I always said that none
of my signals had frequencies over the sample rate (/2). I was
mistaken. I have no initial sources of higher frequencies, but after
adding power supply noise, opamp noise, thermal noise, resistor noise,
and noise of my kids playing in the background, do not be suprised to
find 3 bits of noise on your signal. Just put a Salen Key in front of
your A/D. You will be impressed with the lack of noise. This method is
especially important when you have 12 bits or more.



There is no short answer to this. You need to analyze what current circulates
between the various chips (computer programs for this really analyze EACH wire -
but they are out of reach for amateurs), and make sure that this current is
'closed' through a ground (and/or) power line such that it cannot upset other
circuits. This cannot be achieved in practice (except if you only have two parts
or a completely star-wired power grid).

So there is a compromise made between reality and theory, and all the digital
grounds are tied together, and all the analog grounds are tied together, each in
a single ground point, and these two are tied together at the ground entry point
to the circuit. This requirement can place the ground entry point under a chip
(common in A/D and RF applications). Sometimes designers play more tricks with
the grounds (esp. the analog grounds). These are special cases that invariably
lead to lower fiability (if the analog and the digital gnd on a chip manage to
develop some potential difference - usually 0.6V or less - then the chip will

If your project is MP3 or high end audio related you can use the ground-under-
the-chip approach and feed the PSU (or battery) ground exactly there. Even if
it's in the middle of the board ;-)



This is one of those points with multiple opinions. As I mentioned, some people
think this gnd pin is for your analog signals. OTOH, you have Dave's answer. In
my case, I have always used a small gnd trace "island" encircling my xtal and
bypass caps, which I have always tied to this gnd, and my analog circuitry
[opamps/etc] has a separate gnd trace that goes striaght back to the power
injection point on the board.

Unfortunately, you can see that this violates the idea of having a short noise-
free gnd connection from the analog circuitry to the A/D converter [in this case
on the PIC] with a single-point gnd connection between analog and digital under
the A/D. It seems you cannot have it both ways :).

This site is non-profit. Ad revenue almost covers hosting costs.

We welcome any suggesions or comments! Send them to Shane Tolmie on This site is a completely separate site to, and is maintained independently of Microchip Ltd., manufacturers of the PIC micro. All code on this site is free for non-commercial use, unless stated otherwise. Commercial use normally free, however, it is prohibited without contacting for permission. All content on this site created by Shane Tolmie is copyrighted by Shane Tolmie 1999-2009. Click to advertise on this website - $29.90 for a banner ad which will reach 55,000 user sessions per month. One months free trial!