title: PWM resolution in pic 16F877
body: <p>here im using pic 16f877 MCU and mikroc for pic compilerto understand PWM signels.
   the data sheet says that this MCU is having a 10 bit resolution in PWM. I cant understand what this resolution means. does it means that if i use it to power a motor I can get 1024 different speeds.
    here is a program I wrote in mikroc to gradully increase the light of a LED and again decrease it. </p>
  
  <pre><code>int i=0;
  
  void blink_up(){
    i++;
    PWM1_Set_Duty(i);
    Delay_ms(10);
  }
  
  void blink_down(){
    i--;
    PWM1_Set_Duty(i);
    Delay_ms(10);
  }
  
  
  void main() {
    trisc=0;
    portc=0;
  
    PWM1_Init(5000); //initilize PWM 1 at 5kHz
    PWM1_Start();
    PWM1_Set_Duty(i);
  
   while(1){
      while(i != 1023){
       blink_up();
      }
  
      while(i!=0) {
       blink_down();
    }
  
  }
  </code></pre>
  
  <p>but this wont give the expected results. the LED gradully bilnks up and suddnly switch off and again gradully blinks up. but when i change the line
  <code>while(i != 1023)</code> to `while(i != 255) it gives the expected results.</p>
  
  <p>so I want toi know whats the 10 bit resolution means, did i understand it wrong or am i doing enything wrong. </p>
  
  <p>please help....</p>