I am using a current limit resistor in the input. All the port pins in the ST STM8AF5288 microcontroller have clamping diodes. Will I able to sense a +12V signal input? Below is the circuit used in my project:
Move your R1 resistor and place it in parallel with the C1 capacitor so that you get a voltage divider effect from the 12V signal down to the acceptable input voltage of the MCU. You may have to adjust the resistor values to get the correct divider ratio.
Do not rely on the input voltage clamps on the MCU to limit the input high voltage level. Clamps are put on the chip to protect the inputs for extreme conditions and are never meant to be used in normal usage application.
To quote the spec:
STM8A I/Os are designed to withstand current injection. For a negative injection current of 4 mA, the resulting leakage current in the adjacent input does not exceed 1 μA.
So yes, you can rely on clamping diodes to some extent and your circuit would work as is. However, for a 12V input constructing a voltage divider is trivial, and should be preferred as a safer, more scalable and universal solution.
The circuit you show may work in some conditions but is bad in general.
By depending on the internal protection network to clamp the voltages you can get unwanted and larger than anticipated leakage currents out of adjacent (on the die) pins. This can cause problems with high impedance digital or moderate impedance analog inputs (think about how many uA would cause 1 LSB error on an ADC). The long term reliability can also be questioned.
A Schottky clamp to Vdd is an easy way to deal with that (make sure that there is enough current draw Vdd that the current of all 12V inputs high does not raise Vdd out of regulation- note that this is also true when you use your circuit- there's a hidden path inside the chip to Vdd.
A suitable part number is BAT54A (you get two diodes per SOT-23).
As you don't share the ST part number I will gess that it is supplied from 1.8 to 3.3V. So you can't connect directly to the microcontroller input, it will be out of the specs. My recommendation will be to use a voltage divider to transform the 12V to a voltage inside the range of your microcontroller input.
As you can see from datasheet maximum ratings, the maximum voltage allowed will be vdd +0.3, in your case 5.3V. Any value above may/will harm the device.