You are on page 1of 1

#include "pwm.

h"
void conf_ccp1(void){
PR2 = 255;
CCP1CONbits.CCP1M = 0B1100;
CCP1CONbits.P1M = 0;
CCP1CONbits.DC1B = 0;
CCPTMRS0bits.C1TSEL = 0;
TMR2IF = 0;
T2CONbits.T2CKPS = 0B11;
T2CONbits.T2OUTPS = 15;
T2CONbits.TMR2ON = 1;
}
void conf_ccp2(void){
PR4 = 255;
CCP2CONbits.CCP2M = 0B1100;
CCP2CONbits.P2M = 0;
CCP2CONbits.DC2B = 0;
CCPTMRS0bits.C2TSEL = 1;
TMR4IF = 0;
T4CONbits.T4CKPS = 0B11;
T4CONbits.T4OUTPS = 15;
T4CONbits.TMR4ON = 1;
}
void pwm_ccp1(unsigned char Valor){
CCPR1L = Valor;
TMR2IF=0;
}
void pwm_ccp2(unsigned char Valor){
CCPR2L = Valor;
TMR4IF = 0;
}

You might also like