Thank You for advice.
According to your advice,use NPN transistor nad pull up resistor,
Do not use op-amp. Use NPN transistor and pull-up resistor to 10v supply.
I want to ask NPN transistor use 2n3904 is it ok?
As I connected the 10V dc supply to C-gate through 1K ohm, and PWMOUT to B-Gate, and use CRO to measure the result at C-gate.
I found out the waveform is not what I want.. is it because the parameter of resistor setting wrong?
For the task3, input PWM detection:
Using an R-C filter an analog input, you can get 10-bit resolution, but at the expense of response time. How fast do you need the system to respond to changes in the PWM? This mechanism is potentially sensitive to the voltage of the PWM input, but you can avoid that by passing it through a logic gate prior to the R-C filter.
As I need to continuous measure the PWM input and adjust it to new PWM output to MOSFET for the control of sepic converter in HID ballast, I think it is a must for the system to continuous supply PWM output signal such that the converter able to provide power to lamp. It may still ok even there is system delay.
Once again, Thank You for all advice.=]