This application note (PDF!) from TI details the design of Single Phase PLL:
Grid connected applications require an accurate estimate of the grid angle to feed power synchronously tothe grid. This is achieved using a software phase locked loop (PLL). This application report discusses different challenges in the design of software phase locked loops and presents a methodology to design phase locked loops using C2000 controllers for single phase grid connection applications.