PIC24FV16KM202 捕捉模块CCP1设置成功能输入捕捉中断,同样的设置CCP2却未成功捕捉输入进中断。可能是什么原因呢?
void initCCP2()
{
CCP2TMRH=0;
CCP2TMRL=0xFFFF;
CCP2PRH=0xFFFF;
CCP2PRL=0x0;
IEC0bits.CCP2IE = 0; //????????
CCP2CON1Lbits.CCPON=1; //??????
CCP2CON1Lbits.CLKSEL=0; //????????
CCP2CON1Lbits.TMRPS=0; //????????
CCP2CON1Lbits.T32=1; //??32????
CCP2CON1Lbits.CCSEL=1; //??1???0?????
CCP2CON1Lbits.MOD=0b0010; //????????????
CCP2CON1Hbits.RTRGEN=1; // ????????
CCP2CON1Hbits.OPS3=0; //??????????
CCP2CON1Hbits.TRIGEN=0; //?????????
CCP2CON1Hbits.ONESHOT=0; // ???????
CCP2CON2Lbits.ASDG=0; //????????
CCP2CON2Hbits.ICS=0x11; //??????0-input capture IO; 0x011-?comparator 3 output
CCP2STATLbits.TRSET=1; //???????
CCP2STATLbits.TRCLR=1; //???????
IPC0bits.CCP2IP=0b011; //???????
IPC0bits.T1IP=0b010; //???1?????
CCP2CON1Lbits.CCPON=1; //??????
IFS0bits.CCP2IF = 0; //?????
IEC0bits.CCP2IE = 1; //Enable CCP2 interrupt.
} |