You need a two resistor potential divider to drop that 400V down to 5V, so for 400V (lets call them units)...
top resistor needs to drop 395 units
bottom resistor needs to drop 5 units
therefore,
3.95K R1 (top resistor)
.5k R2
or
7.9k R1
1k R2
etc, & so on (use 1% tolerance resistors or better)
Ok, now you've got 5V AC peak to peak...you need to get that to RMS.
If you wnat a reasonable degree of accuracy, then personally, I'd feed the resulting 'to be measured' 5V AC into an ADC pin via an opamp to rebias it at mid point of 2.5V DC ....then use the PIC's special event trigger & 'sample' at a sufficiently high enough rate (presumably you're only thinking of measuring 50Hz/60hz AC)... to extract 'peak' in real(ish) time ...then it's a simple enough conversion, just multiply the result by 0.707 (though you'll need to get creative to work around PICbasics lack of decimals!)
Bookmarks