zika1212 said:
i'm controlling a 220 V ,50 Hz AC heater using PIC 16F876 (4 MHz clock) by Pulse Width Modulation ... do i need a synchronising circuit ?? if yes, how should i connect it ??
There are a number of things here, none of which you really explain?.
Firstly, what type of heater is it?, is it just an element (like a bar fire), or is it one which includes a motor - like a fan heater.
Anyway, aside from that, you don't use PWM to control an AC heater, PWM is a DC technique, not an AC one. For AC it's far easier, and yes you do need to syncronise to zero-crossing. To control an AC heater you use a technique called 'burst fire', which simply means you turn the element ON and OFF over a certain number of cycles, syncronised with zero-crossing to avoid causing inreference.
For an example, with 50Hz mains there will be 500 cycles in a 10 second period, if you turn it ON for 250 cycles, and OFF for 250 cycles, you will get half power - averaged over a 10 second period, which is usually perfect for a heater, with it's large thermal inertia. By using a 10 second period, with 500 cycles, you can adjust the power with 0.2% resolution, which is going to more than enough.
You can either count the incoming cycles, or simply use a delay loop for the timing - but with a delay loop you will have to wait for zero-crossing before turing the heater ON.