Hi,
We wish to program the PIC16F176X micro to be a constant off time controller for a Current mode Flyback SMPS.
Please could you say if this is possible?

All we wish to do is set up its comparator to “look” at the FET source sense resistor voltage. When the sense threshold is breached, it is then required to switch the FET off (via an external gate driver IC) for an off-time of 8us….then it should switch the FET back ON again……then repeat.

There are a few other stipulants…..

That is, the ON time is obviously usually governed by the breaching of the comparator sense threshold…however , also, the ON time should be no longer than 20us.

Also, the comparator threshold should be variable and should follow a divider voltage that’s connected into its ADC input…and this being multiplied by a scaling factor between 0.1 and 1. (What the scaling factor will be will be determined by an input to another of its ADC inputs.) The divider is connected to the half sinusoidal HV DC bus after the mains rectifier.

Do you know how much it would cost to get this code written?...or do microchip have a facility to generate this code by simply describing it, as I have done here.?

PIC16F176X datasheet
http://ww1.microchip.com/downloads/e...-40001775E.pdf