Hi I am working on a project analyzing the ac power line and I need to detect the zero-crossing point using an 16bit ADC, is there a smarter/better way of doing this than
I sample 128 times per period and I'm calculating the adc_average every period, by using the method above I'm still having some jitter when detecting the zero-crossing.
The question is what you exactly want to achieve with the zero crossing information. Due to waveform distortions, the zero crossing of the instantaneous voltage isn't identical with the zero of the fundamental wave. To determine the instantaneous zero more eaxctly, you'll interpolate between near zero samples with a straight line. To extract the fundatmental and it's phase, you'll apply a digital filter or run an "all-digital" PLL in the processor.
Applying a low pass filter could minimize jitter effect, and if high precision is not an issue for application, you could overestimate the detected point, just shifting ahead the average phase calculated from a big amount of samples.
Anyway, a PLL based solution as stated by FvM is safer.