Electromagnetic Compatibility (EMC) is a critical part of electronic design. EMC is achieved when a device is protected from external EMI / RFI, does not generate EMI / RFI itself significantly enough to affect other devices, and the components within the device do not interfere with each other. Governmental bodies and industry organizations such as the Federal Communications Commission and the SAE International have written comprehensive laws and guidelines for EMC that electronic devices must meet before being sold. Achieving EMC is no small feat.
Most EMC is achieved through good circuit design. Opposing magnetic fields cancel each other out, therefore circuits are designed so that the field from one part nullifies the field of another part. However, this does not eliminate all EMI / RFI. Shielding is commonly required to capture the residuals.
A very basic example of EMC being achieved through a combination of design and shielding is shielded twisted pair wiring. Two wires are run in opposite directions and twisted together so that their electromagnetic fields cancel each other out. The twisted pair is then put into a metal tube that eliminates residual emissions.