The Short Answer
Every M12 connector has the same 12 mm thread, so without coding a Gigabit Ethernet cable could be screwed onto a power socket. Coding adds a key and a pin layout unique to each use, so the connector physically refuses the wrong partner.
-
//
A-coded Sensors, actuators, DC power and general signals; 3 to 12 pins.
-
//
B-coded PROFIBUS fieldbus; usually 5 pins.
-
//
D-coded 4-pin 10/100 Mbps Ethernet, used for PROFINET and EtherNet/IP.
-
//
X-coded 8-pin Gigabit and 10 Gigabit Ethernet.
-
//
L, S, K and T-coded Power: L and T for DC, S and K for AC.
Each Coding in Detail
Coding on Industrial Computers
On a rugged or waterproof computer, the Ethernet ports are usually X-coded for Gigabit or D-coded for 100 Mbps, while serial, USB and DC power use A-coded connectors with different pin counts. Our guide to M12 connectors has the full coding table and pinouts.