Wide Voltage Automotive Status To Microcontroller Input
Using a resistor and Zener diode will work fine.  The simulation below shows what you get with a 4.7V zener.

You can use a very large resistor, because the microcontroller I/O pin draws virtually no current.  With a 100kOhm resistor and approximately 5V output voltage, the power dissipation is (40-5)^2 / (100,000) = 12mW, well within what the resistor can handle.







simulate this circuit &ndash; Schematic created using CircuitLab