/**********************************************************************
*             - Exercice  - Application InfraRouge -
*              Quartz 20Mhz        PIC16F876
*              MikroC Pro
*              Fusibles par défaut
*              LED voyant sur RB0
*              LED IR emetteur sur RC2
*              IR Recepteur Tsop4838 out sur RC4
*              FB Aka Hearty Juin 2011
**********************************************************************/

void main() {
     TRISC = 0b00010000;         //portc sortie  sauf RC4 = entree
     TRISB = 0;                  //portb sortie
     PORTB = 0;
     ADCON1 = 0x0F;              //analogique desactive

     Pwm1_Init(38000);           //Pwm CC1 LED IR emission 38Khz
     PWM1_Set_Duty(60);          // ~23.5 % duty cycle
     Pwm1_Start();
     while(1){
              if(PORTC.F4 == 0)
                          PORTB.F0 = 1;
              else PORTB.F0 = 0;
   }

}