??? 11/24/04 10:32 Read: times |
#81819 - More thoughts on filtering Responding to: ???'s previous message |
For filtering the zero cross input, you have a few choices. The obvious one is in software but things are made easier if your part has the programmable count array as it has input capture and output compares. Other choices are to do it in analog before it gets to the micro - a two pole filter does well but causes a phase shift, this can be corrected by another stage of a phase shifter. This is fairly easy as your mains frequency isn't expected to change. The other method that comes to mind is using a PLL chip like a 4046. The loop filter has the effect of a mechanical flywheel - once up to speed, it doesn't want to change speed too fast - you would want the response to be around 10 cycles worth - as most interference is sporadic. In using the PLL you can have it multiply the frequency for you - even up to the 10KHz your timer is set to AND in phase with the mains. That frees up a timer. The multiplied frequency is then connected to an external interrupt and the zero cross signal to a port pin. Google will provide more info on the 4046 PLL. |