Hello dear specialists! =)
I am using F2808 MCU. I set settings for my PWM interrupt to CompareA. How I can set setting for my PWM to Interrupt by CompareA and Period?
I want to receive interrupt by CompareA and by Period.
// Step 3. Clear all interrupts and initialize PIE vector table: ... PieVectTable.IntVectorCompPWM1_ARM1=&InterruptCompPWM1_ARM1; ... // Step 4. Initialize the Device Peripheral ... InitPWM(&PWM1_ARM1_3Ph, &PWM1_ARM2_3Ph, &PWM1_ARM3_3Ph); ... // Step 5. User specific code, enable interrupts: ... IER|=M_INT3; // PWM 1, 2, 3, 4, 5, 6 ... PieCtrlRegs.PIEIER3.bit.INTx1=ENA; // PWM - EPWM1_INT Group 3, interrupt 1 ... /* ===== Initializations PWM ===== */ struct EPWM_REGS *ARM1 ARM1->TBPRD=REG_PERIOD_PWM1_3Ph; // Period ARM1->CMPA.half.CMPA=REG_PERIOD_PWM1_3Ph/2; // Q=2 ARM1->TBPHS.half.TBPHS=0; // Set Phase register to zero ARM1->TBCTL.bit.FREE_SOFT=2; // Ena FreeRun mode ARM1->TBCTL.bit.PHSEN=TB_DISABLE; // Master module ARM1->TBCTL.bit.PRDLD=TB_SHADOW; // Ena shadow ARM1->TBCTL.bit.SYNCOSEL=TB_CTR_ZERO; // Sync down-stream module ARM1->TBCTL.bit.CLKDIV=CLK_TB_DIV; // Div=8 ARM1->TBCTL.bit.HSPCLKDIV=TB_DIV2; // Div=2 ARM1->CMPCTL.bit.SHDWAMODE=CC_SHADOW; // Ena shadow ARM1->CMPCTL.bit.SHDWBMODE=CC_SHADOW; // Ena shadow ARM1->CMPCTL.bit.LOADAMODE=CC_CTR_ZERO; // Load on CTR=Zero ARM1->CMPCTL.bit.LOADBMODE=CC_CTR_ZERO; // Load on CTR=Zero ARM1->AQCTLA.bit.PRD=AQ_NO_ACTION; // Set actions for EPWMxA in PERIOD ARM1->AQCTLA.bit.CAU=AQ_NO_ACTION; // Set actions for EPWMxA in UP ARM1->DBCTL.bit.OUT_MODE=DB_DISABLE; // Disable Dead-band module ARM1->ETCLR.bit.INT=1; // Reset ARM1->ETSEL.bit.INTSEL=ET_CTRU_CMPA; // Interrupt by CMPA when the timer is incrementing ARM1->ETSEL.bit.INTEN=ENA; // Enable interrupt ARM1->ETPS.bit.INTPRD=ET_1ST; // Interrupt Event (on the first event)