X-ray generator is mainly used for non-destructive testing, security check areas and so on. In order to accurately adjust cross voltage and through current of the X-ray tube, this paper adopts full-digital PID algorithm to control PWM output waveforms.The tube voltage adjustable range is 40 to 120 kV and the tube current range is 0.1 to 1.5 mA. We can set up work parameters and get the working status by LCD and Console on the generator. It also can be fully controlled by a computer so as to enhance the safety of the operator, simplify operation and so on.