Part Number: TMS320F28027
Other Parts Discussed in Thread: C2000WARE
Hello,
I want to use one PWM to make two interruptions, but I'm not sure if I'm doing it right.
I detect the rising edge of my ePWM1A at Zero to make the first interruption:
EPwm1Regs.ETSEL.bit.SOCAEN = 1; // Enable INT for ePWM1A
EPwm1Regs.ETSEL.bit.SOCASEL = ET_CTR_ZERO; // Select INT on Zero
EPwm1Regs.ETPS.bit.SOCAPRD = ET_1ST; // Generate INT on 1st event
Then I detect the falling edge of my ePWM1B (CNT=CMPB) to make the second interruption:
EPwm1Regs.ETSEL.bit.SOCBEN = 1; // Enable INT for ePWM1B
EPwm1Regs.ETSEL.bit.SOCBSEL = ET_CTRU_CMPB; // Select INT when CNT = CMPB, up count
EPwm1Regs.ETPS.bit.SOCBPRD = ET_1ST; // Generate INT on 1st event
To link each trigger to the right interruption, I did this in my main function:
PieVectTable.EPWM1_INT = &epwm1_isr;
PieVectTable.EPWM1_INT = &adc_isr;
Is it enough ? I feel like something is missing...
Thank you