main(){
InitSysCtrl();
EALLOW;
SysCtrlRegs.HISPCP.all = ADC_MODCLK; // HSPCLK = SYSCLKOUT/ADC_MODCLK
EDIS;
InitEPwm1Gpio();
InitEPwm2Gpio();
InitEPwm3Gpio();
InitEPwm4Gpio();
InitAdc();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
PieVectTable.ADCINT = &adc_isr;
PieVectTable.EPWM1_INT = &epwm1_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
InitPower_cal();
DataClear();
EALLOW;
GpioCtrlRegs.GPAMUX2.bit.GPIO25 = 0; // GPIO0 = GPIO0
GpioCtrlRegs.GPADIR.bit.GPIO25 = 1; EDIS;
GpioDataRegs.GPADAT.bit.GPIO25 = 1;
EALLOW;
PieVectTable.ADCINT = &adc_isr;
PieVectTable.EPWM1_INT = &epwm1_isr;
EDIS;
InitEPwm1Example();
GpioCtrlRegs.GPAMUX2.bit.GPIO25 = 0;
GpioCtrlRegs.GPADIR.bit.GPIO25 = 1; GpioDataRegs.GPADAT.bit.GPIO25 = 0;//////////////////0闭合继电器
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
// Enable EPWM INTn in the PIE: Group 3 interrupt 1-3
PieCtrlRegs.PIEIER3.bit.INTx1 = 1;
// Enable ADCINT in PIE
PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
IER |= M_INT1; // Enable CPU Interrupt 1
// Enable CPU INT3 which is connected to EPWM1-3 INT:
IER |= M_INT3;
/* EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;*/
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
for(;;)
{
asm(" NOP");
}
}
程序就指向asm(" NOP"); 不知道是怎么回事?这是正常的吗?我想让它进中断,可是进不去。
Yu Wang16:
回复 Hank Zhao:
假如程序暂停的时候停在asm(" NOP"); 然后我重新设置了一个断点,运行程序,那么程序会在断点处停止吗?还是依然会在asm(" NOP");处停下?
感觉DSP好难学啊。
main(){
InitSysCtrl();
EALLOW;
SysCtrlRegs.HISPCP.all = ADC_MODCLK; // HSPCLK = SYSCLKOUT/ADC_MODCLK
EDIS;
InitEPwm1Gpio();
InitEPwm2Gpio();
InitEPwm3Gpio();
InitEPwm4Gpio();
InitAdc();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
PieVectTable.ADCINT = &adc_isr;
PieVectTable.EPWM1_INT = &epwm1_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
InitPower_cal();
DataClear();
EALLOW;
GpioCtrlRegs.GPAMUX2.bit.GPIO25 = 0; // GPIO0 = GPIO0
GpioCtrlRegs.GPADIR.bit.GPIO25 = 1; EDIS;
GpioDataRegs.GPADAT.bit.GPIO25 = 1;
EALLOW;
PieVectTable.ADCINT = &adc_isr;
PieVectTable.EPWM1_INT = &epwm1_isr;
EDIS;
InitEPwm1Example();
GpioCtrlRegs.GPAMUX2.bit.GPIO25 = 0;
GpioCtrlRegs.GPADIR.bit.GPIO25 = 1; GpioDataRegs.GPADAT.bit.GPIO25 = 0;//////////////////0闭合继电器
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
// Enable EPWM INTn in the PIE: Group 3 interrupt 1-3
PieCtrlRegs.PIEIER3.bit.INTx1 = 1;
// Enable ADCINT in PIE
PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
IER |= M_INT1; // Enable CPU Interrupt 1
// Enable CPU INT3 which is connected to EPWM1-3 INT:
IER |= M_INT3;
/* EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;*/
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
for(;;)
{
asm(" NOP");
}
}
程序就指向asm(" NOP"); 不知道是怎么回事?这是正常的吗?我想让它进中断,可是进不去。
Yu Wang16:
回复 Hank Zhao:
非常感谢您!