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 1. 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 2. 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.
Figure 3. ZCD Event Offset

When the External Voltage source is referenced to ground

Toffset=sin-1(ZCPINVVPEAK)2πf

When the External Voltage source is referenced to VDD

Toffset=sin-1(VDDZCPINVVPEAK)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 4. 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 5. 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.

Figure 6. ZCD Pull-up/Pull-down Resistor

When the External Voltage source is referenced to ground

Rpullup=RSERIES(VpullupZCPINV)ZCPINV

When the External Voltage source is referenced to VDD

Rpulldown=RSERIES(ZCPINV)(VDDZCPINV)