Dwayne Reid ha scritto: > In my case, I threw extra parts at the problem to make the software > easier and to allow the PIC pin to work as both an input and an > output. The 120Vac input is sampled with a 100K resistor, then > [...] > The software samples the input every 1.024ms and feeds a 16 times IIR > filter. The output of that filter is then fed into a peak detector > with a period of 20ms (20 ticks of 1.024ms each). > > This allows me to accurately measure the 120Vac line voltage and make > decisions on whether to allow system operation or not. this is perfectly good :) I will consider the shunting diodes, and I do have transformer so isolation should not be an issue. Do you have a quick link for the IIR filter? I know it has been published and commented tons of times but... thanks -- Ciao, Dario -- Cyberdyne -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist