36.3.2.3.1 Correction By Offset Current

When the alternating waveform is referenced to the ground, as shown in the figure below, the zero-cross is detected too late as the waveform rises and too early as the waveform falls.
Figure 36-3. Sine Wave Referenced to Ground

When the waveform is referenced to VDD, as shown in the figure below, the zero-cross is detected too late as the waveform falls and too early as the waveform rises.
Figure 36-4. Sine Wave Referenced to VDD
The actual offset time can be determined for sinusoidal waveforms of a known frequency f using the equations shown below.
Equation 36-2. ZCD Event Offset

When the External Voltage source is referenced to ground:

T o f f s e t = sin -1 ( Z C P I N V V P E A K ) 2 π f

When the External Voltage source is referenced to VDD:

T o f f s e t = sin -1 ( V D D Z C P I N V V P E A K ) 2 π f

This offset time can be compensated by adding a pull-up or pull-down biasing resistor to the ZCD input pin. A pull-up resistor is used when the external voltage source is referenced to ground, as shown in the figure below.

Figure 36-5. External Voltage Source Referenced to Ground

A pull-down resistor is used when the voltage is referenced to VDD, as shown in the figure below.

Figure 36-6. External Voltage Source Referenced to VDD

The resistor adds a bias to the ZCD input pin so that the external voltage source must go to zero to pull the pin voltage to the ZCPINV switching voltage. The pull-up or pull-down value can be determined with the equations shown below.

Equation 36-3. ZCD Pull-Up/Pull-Down Resistor

When the External Voltage source is referenced to ground:

R p u l l u p = R S E R I E S ( V p u l l u p Z C P I N V ) Z C P I N V

When the External Voltage source is referenced to VDD:

R p u l l d o w n = R S E R I E S ( Z C P I N V ) ( V D D Z C P I N V )