??? 01/17/07 17:26 Read: times |
#130970 - Why make simple matters worse? Responding to: ???'s previous message |
There is one application note in Atmel which gives
simple method for zero crossing detector. You just connect micro ground 0V with to Neutral (return of 240V system)thru 1MEG resistor and P3.3 ( INT1) with another 1Meg resistor. Set INT1 with Falling Edge and not level type. The internal protection diodes of micro take care of the excess voltage. If not sure then connect anode of 1N4148 diode to P3.3 pin and Cathode to +5V. Similarly use other 1N4148 with anode to GND of +5V supply and cathode to P3.3pin. Now you will get very precision interrupt when Mains voltage is just falling to zero! Presently what is your connection is absoultely wrong as pointed by others. The emitter of OC should be connected to 0V and collector to P3.3.If no internal pullup used then use external pull up of 10K ohm resistor. However this will be incorrect by many degrees. The method described above gives precison gives fraction of a degree!( By degree I mean there are 360 degrees in one cycle) |