PRATHAP96
Newbie level 6
Hi,
Here, I have configure by input capture for using MCC melody to easy setup method. I have generated PWM to 50HZ. and capture the value but output is not occurred. I have attached the code for here. please check and let me help.
The
Here, I have configure by input capture for using MCC melody to easy setup method. I have generated PWM to 50HZ. and capture the value but output is not occurred. I have attached the code for here. please check and let me help.
the result is the input capture.void SCCP1_InputCapture_Initialize(void)
{
// MOD Edge Detect; CCSEL enabled; TMR32 16 Bit; TMRPS 1:1; CLKSEL FOSC/2; TMRSYNC disabled; CCPSLP disabled; CCPSIDL disabled; CCPON disabled;
CCP1CON1L = 0x10; //The module is disabled, till other settings are configured.
//SYNC CLC2; ALTSYNC disabled; ONESHOT disabled; TRIGEN disabled; IOPS Each Time Base Period Match; RTRGEN disabled; OPSRC Timer Interrupt Event;
CCP1CON1H = 0x11;
//ASDG 0x0; SSDG disabled; ASDGM disabled; PWMRSEN disabled;
CCP1CON2L = 0x0;
//ICSEL None; AUXOUT Disabled; ICGSM Level-Sensitive mode; OCAEN disabled; OENSYNC disabled;
CCP1CON2H = 0x0;
//PSSACE Tri-state; POLACE disabled; OSCNT None; OETRIG disabled;
CCP1CON3H = 0x0;
//ICOV disabled; ICDIS disabled; SCEVT disabled; ASEVT disabled; TRCLR disabled; TRSET disabled; ICGARM disabled;
CCP1STATL = 0x0;
//TMRL 0x0000;
CCP1TMRL = 0x0;
//TMRH 0x0000;
CCP1TMRH = 0x0;
//PRL 0;
CCP1PRL = 0x0;
//PRH 0;
CCP1PRH = 0x0;
//CMPA 0;
CCP1RA = 0x0;
//CMPB 0;
CCP1RB = 0x0;
//BUFL 0x0000;
CCP1BUFL = 0x0;
//BUFH 0x0000;
CCP1BUFH = 0x0;
SCCP1_InputCapture_CallbackRegister(&SCCP1_InputCapture_Callback);
IFS0bits.CCP1IF = 0;
// Enabling SCCP1 interrupt
IEC0bits.CCP1IE = 1;
CCP1CON1Lbits.CCPON = 1; //Enable Module
}
void __attribute__ ( ( interrupt, no_auto_psv ) ) _CCP1Interrupt (void)
{
unsigned t1,t2;
if(NULL != SCCP1_InputCaptureHandler)
{
(*SCCP1_InputCaptureHandler)();
t1=SCCP1_InputCapture_DataRead();
t2=SCCP1_InputCapture_DataRead();
}
IFS0bits.CCP1IF = 0;
if (t2>t1)
{
result=t2-t1;
}
else
{
result=(0.00025-t1)+t2;
}
}
The