Hello,

Anyone has an algorithm for a sepic boost converter in picbasic ?
I have written a function that increments by one the duty cycle, but after further testing it is not a fats way to reach the necessary output. I have a voltage check on the output only (12v) and the duty cycle varies according to the output .
here is the code I have:
Code:
VoltageCheck:
     ADCON0.2 = 1			'Start Conversion
     
     adcin 4,VoltageInput
     
    If voltageInput < voltageREF then        ' voltageREF is 75 for 12v dc
        VoltageDiff = VoltageREF - VoltageInput     '=150+(150-115)=185
        DutyCycle = voltageREF + ( voltageREF - VoltageDiff)
        DutyCycle = DutyCycle/255 *100
        HPWM 1,DutyCycle,Frequency         'channel, dutycycle, frequency
        pause 20
    ENDIF
    
    If voltageInput = voltageREF then
        HPWM 1,DutyCycle,Frequency          'channel, dutycycle, frequency    
        pause 20
    else
        VoltageDiff =  VoltageInput - VoltageREF      '=127-(182-127)
        DutyCycle = voltageREF - ( VoltageDiff - voltageREF )
        DutyCycle = DutyCycle/255 *100
        HPWM 1,DutyCycle,Frequency 'channel, dutycycle, frequency
        pause 20
    endif

return
there must be better ways to accomplish this
regards,
K