main() { InitSysCtrl(); // 初始化system DINT; // 初始化PIE InitPieCtrl(); // 初始化ADC InitPieVectTable(); MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart); InitFlash(); //AdcOffsetSelfCal(); InitAdc(); IER = 0x0000; IFR = 0x0000; // 初始化中斷向量表 InitEPwm1Gpio(); GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // GPIO0 = PWM1A GpioCtrlRegs.GPADIR.bit.GPIO0 = 1; //GPIO0 = output EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0; InitEPwm1Example(); InitCpuTimers(); ConfigCpuTimer(&CpuTimer0, 1, 3906); //必須先配置 再致能 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CpuTimer0Regs.TCR.all = 0x4000; // 致能CPUTIMER0 EDIS; // 設定中斷向量表位置 EALLOW; PieVectTable.XINT1 = &xint1_isr; PieVectTable.XINT2 = &xint2_isr; PieVectTable.ADCINT1 = &adc_isr; PieVectTable.TINT0 = &cputimer_isr; EDIS; // 設置外部中斷腳位及燈號腳位 EALLOW; GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 0; // GPIO ADC開關 GpioCtrlRegs.GPADIR.bit.GPIO1 = 0; // input GpioCtrlRegs.GPAQSEL1.bit.GPIO1 = 0; // XINT1 Synch to SYSCLKOUT only GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL = 1; // XINT1 is GPIO1 GpioCtrlRegs.GPAPUD.bit.GPIO1 = 0; GpioCtrlRegs.GPAMUX1.bit.GPIO2 = 0; // GPIO GpioCtrlRegs.GPADIR.bit.GPIO2 = 1; // OUTput GpioDataRegs.GPACLEAR.bit.GPIO2 = 1; // 當ADC ON/OFF 標示燈 GpioCtrlRegs.GPAMUX1.bit.GPIO3 = 0; // GPIO ePWM開關 GpioCtrlRegs.GPADIR.bit.GPIO3 = 0; GpioCtrlRegs.GPAQSEL1.bit.GPIO3 = 0; // XINT2 Synch to SYSCLKOUT only GpioIntRegs.GPIOXINT2SEL.bit.GPIOSEL = 3; // XINT2 is GPIO3 GpioCtrlRegs.GPAPUD.bit.GPIO3 = 0; // GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 0; // GPIO GpioCtrlRegs.GPADIR.bit.GPIO4 = 1; // OUTput GpioDataRegs.GPACLEAR.bit.GPIO4 = 1; // 當 ePWM ON/OFF 標示燈 GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 0; // GPIO GpioCtrlRegs.GPADIR.bit.GPIO6 = 1; // OUTput 閃爍用 GpioDataRegs.GPACLEAR.bit.GPIO6 = 1; EDIS; IER |= M_INT1; // 開啟GROUP1中斷 EINT; ERTM; EALLOW; PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // 致能PIE(非必要) PieCtrlRegs.PIEIER1.bit.INTx1 = 0; PieCtrlRegs.PIEIER1.bit.INTx4 = 1; PieCtrlRegs.PIEIER1.bit.INTx5 = 1; //PieCtrlRegs.PIEIER1.bit.INTx7 = 1; // !!!!!!!! 不能同時開啟 , 否則打架 !!!!!!!!! XIntruptRegs.XINT1CR.bit.POLARITY = 3; // interrupt occur on both falling and rising edge XIntruptRegs.XINT1CR.bit.ENABLE = 1; // Enable Xint1 XIntruptRegs.XINT2CR.bit.POLARITY = 3; // interrupt occur on both falling and rising edge XIntruptRegs.XINT2CR.bit.ENABLE = 1; // Enable Xint2 EDIS; LoopCount = 0; ConversionCount = 0; // Configure ADC // Note: Channel ADCINA4 will be double sampled to workaround the ADC 1st sample issue for rev0 silicon errata EALLOW; AdcRegs.ADCCTL1.bit.ADCENABLE = 0; // 不致能ADC (在initadc中已經致能) AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1; //ADCINT1 trips after AdcResults latch AdcRegs.INTSEL1N2.bit.INT1E = 0; //disabled ADCINT1 AdcRegs.INTSEL1N2.bit.INT1CONT = 0; //Disable ADCINT1 Continuous mode AdcRegs.INTSEL1N2.bit.INT1SEL = 0; //setup EOC0 to trigger ADCINT1 to fire AdcRegs.ADCSOC0CTL.bit.CHSEL = 1; //set SOC0 channel select to ADCINA1 AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 1; //set SOC0 start trigger on CPUtimer AdcRegs.ADCSOC0CTL.bit.ACQPS = 6;//set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1) //AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; EDIS; //GpioCtrlRegs.AIOMUX1.bit. &= ~(0x08); // ADCINA1 // EALLOW; SysCtrlRegs.XCLK.bit.XCLKOUTDIV = 2; EDIS; for (;;) { //volatile long double n; //for (n = 0; n < 5000; n++) // ; //EALLOW; //GpioDataRegs.GPATOGGLE.bit.GPIO6 = 1; //EDIS; if (GpioDataRegs.GPADAT.bit.GPIO1 == 1) { Voltage1[array] = AdcResult.ADCRESULT0; if (Voltage1[array] > 5000) { EALLOW; SysCtrlRegs.PCLKCR1.bit.EPWM1ENCLK = 0; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0; SysCtrlRegs.LPMCR0.bit.LPM = 3; // 全部休眠 EDIS; EALLOW; SysCtrlRegs.CLKCTL.bit.WDHALTI = 1; // 從休眠中開啟 , 全部重設!! EDIS; } v1 = 3031; v2 = (int)Voltage1[array]; k1 = 0.3; //0.0001; k2 = 0.000055; verr = v1 - v2; vk2 = verr + z1; z1 = verr; vko2 =(int) vk2 * k2; if (vko2 >= 1400) { vko2 = 1400; } else if (vko2 <= -1300) /////////////////////// { vko2 = -1300; } vou2 = vko2 + z2; z2 = vou2; vk1 = verr; vko1 =(int) vk1 * k1; vout =(int)( vou2 + vko1); if (vout >= 1400) { vout = 1400; } else if (vout <= 0) { vout = 0; } EALLOW; EPwm1Regs.CMPA.half.CMPA = 1500 - vout; // Set compare A value EDIS; if (array < 255) array++; else array = 0; } } }
main() { phase=0; w=2*3.1415927*100; // Frequencia fundamental do sinal gerado = 100Hz Ts=1/10000.0; // Interrupção do ePWM1 =10kHz -> taxa de amostragem offset=7500; j=0; segundos_count=0; // Step 1. InitSysCtrl(); // Step 2. Initialize GPIO: // This example function is found in the DSP2833x_Gpio.c file and // illustrates how to set the GPIO to it's default state. // InitGpio(); // Skipped for this example // Step 3. DINT; // Initialize the PIE control registers to their default state. InitPieCtrl(); // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). InitPieVectTable(); // Interrupts that are used in this example are re-mapped to // ISR functions found within this file. EALLOW; // This is needed to write to EALLOW protected register PieVectTable.ADCINT = &adc_isr; EDIS; // This is needed to disable write to EALLOW protected registers // Step 4. Initialize all the Device Peripherals: EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0; //desabilita clk para ePWMx EDIS; InitEPwm1Example(); //Configura ePWM1 EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;//habilita clk para ePWMx EDIS; InitAdc(); // For this example, init the ADC Config_ADC(); // For this example, config the ADC // Step 5. User specific code, enable interrupts: EALLOW; GpioDataRegs.GPACLEAR.bit.GPIO31 = 1; // Reset output latch - Turn on LED1 GpioCtrlRegs.GPAMUX2.bit.GPIO31 = 0; // GPIO31 = GPIO31 GpioCtrlRegs.GPADIR.bit.GPIO31 = 1; // GPIO31 = output GpioDataRegs.GPBCLEAR.bit.GPIO34 = 1; // Reset output latch - Turn on LED2 GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0; // GPIO34 = GPIO34 GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1; // GPIO34 = output //Configure ePWM-1 pins using GPIO regs //Enable internal pull-up for the selected pins */ GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0; // Enable pull-up on GPIO0 (EPWM1A) GpioCtrlRegs.GPAPUD.bit.GPIO1 = 0; // Enable pull-up on GPIO1 (EPWM1B) GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // Configure GPIO0 as EPWM1A GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 1; // Configure GPIO1 as EPWM1B EDIS; // Enable ADCINT in PIE PieCtrlRegs.PIEIER1.bit.INTx6 = 1; IER |= M_INT1; // Enable CPU Interrupt 1 EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM // Wait for ADC interrupt ConversionCount = 0; while(1) //loop infinito { asm(" NOP"); if(segundos_count >=2) { segundos_count=0; //Zera contador de segundos ConversionCount = 0; // habilita gravação da aquisição nos vetores a cada 2 segundos A3=A3+200; //Incrementa amplitude do terceiro harmônico - sinal de controle PWM if (A3>=2000) A3=0; } } }
void main(void) { // Step 1. Initialize System Control: // PLL, WatchDog, enable Peripheral Clocks // This example function is found in the DSP2803x_SysCtrl.c file. InitSysCtrl(); // Step 2. Initialize GPIO: // This example function is found in the DSP2803x_Gpio.c file and // illustrates how to set the GPIO to it's default state. // InitGpio(); // Skipped for this example // For this case just init GPIO pins for ePWM1, ePWM2, and TZ pins InitEPwm1Gpio(); InitEPwm2Gpio(); InitEPwm3Gpio(); InitTzGpio(); // Step 3. Clear all interrupts and initialize PIE vector table: // Disable CPU interrupts DINT; // Initialize the PIE control registers to their default state. // The default state is all PIE interrupts disabled and flags // are cleared. // This function is found in the DSP2803x_PieCtrl.c file. InitPieCtrl(); // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // This will populate the entire table, even if the interrupt // is not used in this example. This is useful for debug purposes. // The shell ISR routines are found in DSP2803x_DefaultIsr.c. // This function is found in DSP2803x_PieVect.c. InitPieVectTable(); // Interrupts that are used in this example are re-mapped to // ISR functions found within this file. EALLOW; // This is needed to write to EALLOW protected registers PieVectTable.EPWM1_TZINT = &epwm1_tzint_isr; PieVectTable.EPWM2_TZINT = &epwm2_tzint_isr; PieVectTable.EPWM3_TZINT = &epwm3_tzint_isr; EDIS; // This is needed to disable write to EALLOW protected registers // Step 4. Initialize all the Device Peripherals: // Not required for this example EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0; EDIS; InitEPwm1Example(); InitEPwm2Example(); InitEPwm3Example(); EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1; EDIS; // Step 5. User specific code, enable interrupts // Initialize counters: EPwm1TZIntCount = 0; EPwm2TZIntCount = 0; EPwm3TZIntCount = 0; // Enable CPU INT3 which is connected to EPWM1-3 INT: IER |= M_INT2; // Enable EPWM INTn in the PIE: Group 2 interrupt 1-3 PieCtrlRegs.PIEIER2.bit.INTx1 = 1; PieCtrlRegs.PIEIER2.bit.INTx2 = 1; PieCtrlRegs.PIEIER2.bit.INTx3 = 1; // Enable global Interrupts and higher priority real-time debug events: EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM // Step 6. IDLE loop. Just sit and loop forever (optional): for(;;) { __asm(" NOP"); } }
void main(void) { ADC_Handle myAdc; CPU_Handle myCpu; PLL_Handle myPll; WDOG_Handle myWDog; // Initialize all the handles needed for this application myAdc = ADC_init((void *)ADC_BASE_ADDR, sizeof(ADC_Obj)); myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj)); myComp = COMP_init((void *)COMP1_BASE_ADDR, sizeof(COMP_Obj)); myCpu = CPU_init((void *)NULL, sizeof(CPU_Obj)); myFlash = FLASH_init((void *)FLASH_BASE_ADDR, sizeof(FLASH_Obj)); myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj)); myPie = PIE_init((void *)PIE_BASE_ADDR, sizeof(PIE_Obj)); myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj)); myPwm1 = PWM_init((void *)PWM_ePWM1_BASE_ADDR, sizeof(PWM_Obj)); myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj)); // Perform basic system initialization WDOG_disable(myWDog); CLK_enableAdcClock(myClk); (*Device_cal)(); CLK_disableAdcClock(myClk); //Select the internal oscillator 1 as the clock source CLK_setOscSrc(myClk, CLK_OscSrc_Internal); // Setup the PLL for x10 /2 which will yield 50Mhz = 10Mhz * 10 / 2 PLL_setup(myPll, PLL_Multiplier_10, PLL_DivideSelect_ClkIn_by_2); // Disable the PIE and all interrupts PIE_disable(myPie); PIE_disableAllInts(myPie); CPU_disableGlobalInts(myCpu); CPU_clearIntFlags(myCpu); // If running from flash copy RAM only functions to RAM #ifdef _FLASH memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize); #endif // For this case just init GPIO pins for ePWM1 GPIO_setPullUp(myGpio, GPIO_Number_0, GPIO_PullUp_Disable); GPIO_setPullUp(myGpio, GPIO_Number_1, GPIO_PullUp_Disable); GPIO_setMode(myGpio, GPIO_Number_0, GPIO_0_Mode_EPWM1A); GPIO_setMode(myGpio, GPIO_Number_1, GPIO_1_Mode_EPWM1B); // Setup a debug vector table and enable the PIE PIE_setDebugIntVectorTable(myPie); PIE_enable(myPie); // Register interrupt handlers in the PIE vector table PIE_registerPieIntHandler(myPie, PIE_GroupNumber_2, PIE_SubGroupNumber_1, (intVec_t)&epwm1_tzint_isr); // Enable Clock to the ADC CLK_enableAdcClock(myClk); // Comparator shares the internal BG reference of the ADC, // must be powered even if ADC is unused ADC_enableBandGap(myAdc); // Delay to allow BG reference to settle. DELAY_US(1000L); // Enable clock to the Comparator 1 block CLK_enableCompClock(myClk, CLK_CompNumber_1); // Power up Comparator 1 locally COMP_enable(myComp); // Connect the inverting input to pin COMP1B COMP_disableDac(myComp); ////////////////Uncomment following 4 lines to use DAC instead of pin COMP1B ////////////////// // // Connect the inverting input to the internal DAC // COMP_enableDac(myComp); // // Set DAC output to midpoint // COMP_setDacValue(myComp, 512); ////////////////////////////////////////////////////////////////////////////////////////////// CLK_disableTbClockSync(myClk); InitEPwm1Example(); CLK_enableTbClockSync(myClk); // Initialize counters EPwm1TZIntCount = 0; // Enable CPU INT3 which is connected to EPWM1-3 INT CPU_enableInt(myCpu, CPU_IntNumber_2); // Enable EPWM INTn in the PIE: Group 2 interrupt 1-3 PIE_enablePwmTzInt(myPie, PWM_Number_1); // Enable global Interrupts and higher priority real-time debug events CPU_enableGlobalInts(myCpu); CPU_enableDebugInt(myCpu); for(;;) { __asm(" NOP"); } }
void main(void) { // Step 1. Initialize System Control: // PLL, WatchDog, enable Peripheral Clocks // This example function is found in the DSP2803x_SysCtrl.c file. InitSysCtrl(); // Step 2. Initalize GPIO: // This example function is found in the DSP2803x_Gpio.c file and // illustrates how to set the GPIO to it's default state. // InitGpio(); // Skipped for this example // For this case just init GPIO pins for ePWM1, ePWM2, ePWM3 // These functions are in the DSP2803x_EPwm.c file InitEPwm1Gpio(); InitEPwm2Gpio(); // Step 3. Clear all interrupts and initialize PIE vector table: // Disable CPU interrupts DINT; // Initialize the PIE control registers to their default state. // The default state is all PIE interrupts disabled and flags // are cleared. // This function is found in the DSP2803x_PieCtrl.c file. InitPieCtrl(); // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // GPIO0 = PWM1A GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 1; // GPIO1 = PWM1B GpioCtrlRegs.GPAMUX1.bit.GPIO2 = 1; // GPIO2 = PWM2A GpioCtrlRegs.GPAMUX1.bit.GPIO3 = 1; // GPIO3 = PWM2B GpioCtrlRegs.GPADIR.bit.GPIO0 = 1; //GPIO0 = output GpioCtrlRegs.GPADIR.bit.GPIO1 = 1; //GPIO0 = output GpioCtrlRegs.GPADIR.bit.GPIO2 = 1; //GPIO0 = output GpioCtrlRegs.GPADIR.bit.GPIO3 = 1; //GPIO0 = output // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // This will populate the entire table, even if the interrupt // is not used in this example. This is useful for debug purposes. // The shell ISR routines are found in DSP2803x_DefaultIsr.c. // This function is found in DSP2803x_PieVect.c. InitPieVectTable(); // Interrupts that are used in this example are re-mapped to // ISR functions found within this file. EALLOW; // This is needed to write to EALLOW protected registers // PieVectTable.EPWM1_INT = &epwm1_isr; // PieVectTable.EPWM2_INT = &epwm2_isr; EDIS; // This is needed to disable write to EALLOW protected registers // Step 4. Initialize all the Device Peripherals: // This function is found in DSP2803x_InitPeripherals.c // InitPeripherals(); // Not required for this example // For this example, only initialize the ePWM EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0; EDIS; InitEPwm1Example(); InitEPwm2Example(); EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1; EDIS; // Step 5. User specific code, enable interrupts: // Enable CPU INT3 which is connected to EPWM1-3 INT: IER |= M_INT3; // PieCtrlRegs.PIEIER3.bit.INTx1 = 1; // PieCtrlRegs.PIEIER3.bit.INTx2 = 1; EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM // Step 6. IDLE loop. Just sit and loop forever (optional): for(;;) { asm(" NOP"); } }
void main(void) { CPU_Handle myCpu; PLL_Handle myPll; WDOG_Handle myWDog; // Initialize all the handles needed for this application myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj)); myCpu = CPU_init((void *)NULL, sizeof(CPU_Obj)); myFlash = FLASH_init((void *)FLASH_BASE_ADDR, sizeof(FLASH_Obj)); myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj)); myPie = PIE_init((void *)PIE_BASE_ADDR, sizeof(PIE_Obj)); myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj)); myPwm1 = PWM_init((void *)PWM_ePWM1_BASE_ADDR, sizeof(PWM_Obj)); myPwm2 = PWM_init((void *)PWM_ePWM2_BASE_ADDR, sizeof(PWM_Obj)); myPwm3 = PWM_init((void *)PWM_ePWM3_BASE_ADDR, sizeof(PWM_Obj)); myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj)); // Perform basic system initialization WDOG_disable(myWDog); CLK_enableAdcClock(myClk); (*Device_cal)(); CLK_disableAdcClock(myClk); //Select the internal oscillator 1 as the clock source CLK_setOscSrc(myClk, CLK_OscSrc_Internal); // Setup the PLL for x10 /2 which will yield 50Mhz = 10Mhz * 10 / 2 PLL_setup(myPll, PLL_Multiplier_10, PLL_DivideSelect_ClkIn_by_2); // Disable the PIE and all interrupts PIE_disable(myPie); PIE_disableAllInts(myPie); CPU_disableGlobalInts(myCpu); CPU_clearIntFlags(myCpu); // If running from flash copy RAM only functions to RAM #ifdef _FLASH memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize); #endif // Initialize GPIO GPIO_setPullUp(myGpio, GPIO_Number_0, GPIO_PullUp_Disable); GPIO_setPullUp(myGpio, GPIO_Number_1, GPIO_PullUp_Disable); GPIO_setMode(myGpio, GPIO_Number_0, GPIO_0_Mode_EPWM1A); GPIO_setMode(myGpio, GPIO_Number_1, GPIO_1_Mode_EPWM1B); GPIO_setPullUp(myGpio, GPIO_Number_2, GPIO_PullUp_Disable); GPIO_setPullUp(myGpio, GPIO_Number_3, GPIO_PullUp_Disable); GPIO_setMode(myGpio, GPIO_Number_2, GPIO_2_Mode_EPWM2A); GPIO_setMode(myGpio, GPIO_Number_3, GPIO_3_Mode_EPWM2B); GPIO_setPullUp(myGpio, GPIO_Number_4, GPIO_PullUp_Disable); GPIO_setPullUp(myGpio, GPIO_Number_5, GPIO_PullUp_Disable); GPIO_setMode(myGpio, GPIO_Number_4, GPIO_4_Mode_EPWM3A); GPIO_setMode(myGpio, GPIO_Number_5, GPIO_5_Mode_EPWM3B); // Setup a debug vector table and enable the PIE PIE_setDebugIntVectorTable(myPie); PIE_enable(myPie); // Register interrupt handlers in the PIE vector table PIE_registerPieIntHandler(myPie, PIE_GroupNumber_3, PIE_SubGroupNumber_1, (intVec_t)&epwm1_isr); PIE_registerPieIntHandler(myPie, PIE_GroupNumber_3, PIE_SubGroupNumber_2, (intVec_t)&epwm2_isr); PIE_registerPieIntHandler(myPie, PIE_GroupNumber_3, PIE_SubGroupNumber_3, (intVec_t)&epwm3_isr); CLK_disableTbClockSync(myClk); InitEPwm1Example(); InitEPwm2Example(); InitEPwm3Example(); CLK_enableTbClockSync(myClk); // Enable CPU INT3 which is connected to EPWM1-3 INT: CPU_enableInt(myCpu, CPU_IntNumber_3); // Enable EPWM INTn in the PIE: Group 3 interrupt 1-3 PIE_enablePwmInt(myPie, PWM_Number_1); PIE_enablePwmInt(myPie, PWM_Number_2); PIE_enablePwmInt(myPie, PWM_Number_3); // Enable global Interrupts and higher priority real-time debug events CPU_enableGlobalInts(myCpu); CPU_enableDebugInt(myCpu); for(;;) { __asm(" NOP"); } }