Precision voltage clamping 0V to +5V with +/-12V input
I assume here that you want the 0-5v signal to be processed by an A/D.
If you want to protect the input then use a device such as the TLV6001 to buffer the input signals.

A simple circuit such as this will provide accurate translation of the 0-5v signal for any application.







simulate this circuit &ndash; Schematic created using CircuitLab

The TLV6001 is rated for rail-rail operation and so allows the full range of MCU or A/D input ...in addition it is rated to carry 10mA in the input protection diodes. This would allow the configuration above to withstand voltages of +/-200 V on the input resistor R2 (providing your resistors are rated for this voltage).

Since the TLV600 is powered by the MCU +5 V supply it cannot produce an output voltage above 5 V or below 0 V, so the input is accurately clamped WITHOUT impacting the A/D range at all. You must make sure that your MCU solution is always drawing a minimum current greater than your expected protection current (this is only an issue if you put things into a sleep state).