I am doing my final year project on designing constant current pic controlled boost converter, boost converter which as the load resistance changed the output current still remained constant.
  • Also Up to now i have a boost converter circuit and i managed to use pwm module to produce varying duty cycle, i managed to use this varying duty cycle to produce varying output voltage.
My problems until now
  • Earlier i adviced to use adc to read feedback signal i managed to do that but i failed to continue
  • I don't know how to do so that to have a constant current at the load, i lack a technique here on how to link this code so that to accomplish my task
i attached my circuit and code so that you can help me

duty      VAR WORD  ' Duty cycle value (CCPR1L:CCP1CON<5:4>)
Feedback  var word
Result    var  word
Reference var word
Value     var  word   
   TRISA = %11111111
   TRISB = %11111111
   TRISC = %11111011       ' Set PORTC.2 (CCP1) to output
   CCP1CON = %00001100  ' Set CCP1 to PWM 
   T2CON = %00000101    ' Turn on Timer2, Prescale=4
' Use formula to determine PR2 value for a 1KHz signal, 
' 4MHz clock, and prescale=4. (4E6/(4*4*1E3))-1=249
   PR2 = 249      ' Set PR2 to get 1KHz out
' Use formula to determine CCPR1L:CCP1CON<5:4> value for
' ends of range 0% to 100%.  (249+1)*4*0.2=0 (0% value)
' (249+1)*4*1=1000 (100% value)
   duty = 0      ' Set duty cycle to 0%
   LED1   VAR  PORTB.1
   adcin 0, feedback
   adcin 1, reference         
   CCP1CON.4 = duty.0   ' Store duty to registers as
   CCP1CON.5 = duty.1   ' a 10-bit word
   CCPR1L = DUTY >> 2
   duty = duty + 10     ' Increase duty cycle
' Since the total sweep of duty is 600 (1000-0) and 
' we are adding 10 for each loop, that results in 100
' steps min to max. 1 second divided by 60 = 10mS            
   Pause  10  
    TOGGLE LED1          ' Pause 1/60 of second
   IF (duty < 1000) Then mainloop  ' Do it again unless 80% duty cycle
   duty = 0           ' Reset to 0% duty cycle
   GoTo mainloop        ' Do it forever

Hi, we are pleased to see that you are using our forum.

We'd like you to become a member of our community. Membership is FREE, please REGISTER and view our forums without these annoying reminders!

Once registered you may post on the forums, download from the file areas and use the WIKI without interruption.