Eisermann, Phil [Ridg/CO] wrote : > 110V input throught two 10K resistors in series an H11AA814A > optocoupler. collector of optocoupler pulled to 5V via a 22k resistor. Or use the "weak pullup" and save a resistor... > collector fed into GP2 a 12F629. the PIC is running on > interal clock. GP is configured as an external interrupt, > so it should be a ST. I expect the pulse length to vary between > devices due to variations in current transfer ratio of the opto. > To get a better reading of the actual zero crossing point, I would > measure the typical pulse length before the application does > anything. Half of the pulse length should get me pretty close > to the true zero crossing point. So you'd detect the start of the zero-crossing, and then wait for half of the the former calculated zero-crossing width ? Seem OK. Note that you can flip the INTEDG on each interrupt to capture *both* edges using interrupts. > > The application will remain in service maybe 10 to 20 > minutes before it is powered down. would the oscillator frequency > remain stable enough during this point, Stable enough for what ? Are you thinking on "free wheeling" during this 10-20 min period without further zero-crossing detection ? > or am I making this too complicated? It is > for phase control, and I will always be switching "very soon" > after the zero-crossing point; What are you switching ? And what is "very soon" ? For a Triac, you must at least wait until there is enough current to hold the Triac conducting. > I do not need a large control range. What is "a large range" ? Or rather, what is "not a large range" ? Jan-Erik. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.