Other Parts Discussed in Thread: C2000WARE
Tool/software:
Hi,
I try to step into the interrupt function adc_isr() but it goes directly to the next InitCpuTimer(). How can I do it right?
Thanks,
-Hoongmei Wan
-----------------------------------------------------------------------------
The whole main code is below.
void main(void)
{
// Step 1. Initialize System Control:
// This example function is found in the F2837xD_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initialize GPIO:
// This example function is found in the F2837xD_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
InitGpio();
InitEPwmGpio_TZ();
InitEPwmGpio();
EALLOW;
GPIO_SetupPinOptions(72, GPIO_OUTPUT, GPIO_PUSHPULL);
GPIO_SetupPinOptions(84, GPIO_OUTPUT, GPIO_PUSHPULL);
EDIS;
// 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 F2837xD_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 function is found in F2837xD_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.ADCD1_INT = &adc_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
// Step 4. Initialize the Device Peripherals:
InitCpuTimers(); // For this example, only initialize the Cpu Timers
EALLOW;
CpuSysRegs.PCLKCR0.bit.TBCLKSYNC =0;
ClkCfgRegs.PERCLKDIVSEL.bit.EPWMCLKDIV = 0;
EDIS;
initEpwms();
EALLOW;
CpuSysRegs.PCLKCR0.bit.TBCLKSYNC =1;
EDIS;
//Configure the ADCs and power them up
ConfigureADC();
//Setup the ADCs for software conversions
SetupADCEpwm();
// Configure DAC
DAC_debug();
// Initialization
dcParam_Init((dcParam_t*)&dc);
// Step 5. User specific code, enable interrupts:
IER |= M_INT1;
// Enable PIE: Group 1 interrupt 1
PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
//Begin infinite for loop
for (;;)
{
GPIO_WritePin(72, 1);
GPIO_WritePin(84, 1);
}//end of infinite loop
}//end of main function