Problem with negative feedback control MCU:PIC16F73

Status
Not open for further replies.

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
899
Helped
24
Reputation
48
Reaction score
26
Trophy points
1,318
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,254
I'm generating a PWM duel clock to run an Inverter. The all the functions are working properly. But the problem is in feedback. The output voltage should be fixed. For this I'm using negative feedback. The feedback program is:
Code:
void neg_feed()
 {
      ADCON0=0b00000001;
     //avg_pwm2 = avg_pwm1;
     adc_rd0 = ADC_Read(0);
     avg_pwm1 = adc_rd0;
     while(avg_pwm1==51)
     {
      if(fb <36 && fb>=0)
      {
       feedback = fb;
       //Delay_ms(5);
      }
      else
      {
       feedback = feedback;
       Delay_ms(10);
      }
      break;
     }
     while(avg_pwm1>51)
     {
      if(fb<36)
      {
       fb+=1;
       //Delay_ms(5);
      }
      else
      {
       fb = fb;
      }
      break;
     }
     while(avg_pwm1<51)
     {
      if(fb>1)
      {
       fb-=1;
       //Delay_ms(5);
      }
      else
      {
       fb = fb;
      }
      break;
     }
     if(fb <36 && fb>=0)
      {
       feedback = fb;
      }
      else
      {
       feedback = feedback;
       Delay_ms(10);
      }
 }

The negative feedback is working properly when load is more than 200W. But below this, voltage is fluctuating, that means the value of 'feedback' is not fixed. The main clock is in TMR0 interrupt routine. What may be the reason of this?

Thanks in advance.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…