This paper presents the analysis, control strategy and realization of a digital frequency controller of a two stage ballast for HID Lamps. First, the small signal phasor model of the LCSCP resonant inverter is established and verified. Based on this model, a double loop digital compensator is designed to control the current and power of the lamp. Then the overall control strategy for the long term stability of the ballast is designed and realized on a PIC MCU controller. Finally, a electronic ballast for a 400 W MH lamp is designed based on this scheme, and the experimental results are provided.