Read High voltage from PIC16F [duplicate]

This question already has an answer here:

I have planned to build a circuit to display voltage and time value using PIC16F877A micro controller.To do this i tested the circuit using Proteus software as i attached here. It can display up to 5V.

my question is can i read up to 300V using this micro controller?(I planned to use LR8N3G voltage regulator to give input voltage to PIC).will it damage the PIC? If so how can I read high voltage from this?

marked as duplicate by dim, JRE, pipe, Elliot Alderson, Warren HillFeb 7 at 10:58

• What's the lower limit of the voltage to be read? If it's too low (e.g. 1V) then a simple voltage divider may not work. I mean, you may need to build a "smart" divider (i.e. activates/deactivates divider networks based on the input voltage). It also depends on whether the voltage is AC or DC. – Rohat Kılıç Feb 5 at 4:46

$$\begin{split} &\frac{V_\mathrm{in}} {Z1 + Z2} \cdot Z_2 = V_\mathrm{out}\\ \\ &\frac{(V_\mathrm{in} - V_\mathrm{out})^2}{Z_1} =\text{ Power dissipated by }Z_1 \end{split}$$
I suggest choosing $$\Z_1\$$ first.