程序源代码附上,进不了AD中断?请大神指点。
EALLOW;
// —–ePWM1—–
// TB
EPwm1Regs.TBPHS.all = 0;
EPwm1Regs.TBCTL.all = 0x2012 ;
// CC
EPwm1Regs.CMPCTL.all = 0x0100 ;
// AQ
EPwm1Regs.AQCTLA.all = 0x0069;
EPwm1Regs.AQSFRC.all = 0x0 ;
EPwm1Regs.AQCSFRC.all = 0x0 ;
// DB
EPwm1Regs.DBCTL.all = 0x000B;
EPwm1Regs.TZCLR.all = 0x07;
EPwm1Regs.TZSEL.bit.CBC3 = 1 ;
EPwm1Regs.TZSEL.all = 0x04;
EPwm1Regs.TZCTL.all = 0x0A ;
EPwm1Regs.TZEINT.all = 0 ;
// ET
EPwm1Regs.ETSEL.all = 0;
EPwm1Regs.ETPS.all = 0;
// —–ePWM2—–
// TB
EPwm2Regs.TBPHS.all = 0;
EPwm2Regs.TBCTL.all = 0x2006;
// CC
EPwm2Regs.CMPCTL.all = 0x0100;
// AQ
EPwm2Regs.AQCTLA.all = 0x0069;
EPwm2Regs.AQSFRC.all = 0x0;
EPwm2Regs.AQCSFRC.all = 0x0;
// DB
EPwm2Regs.DBCTL.all = 0x000B;
// TZ
EPwm2Regs.TZCLR.all = 0x07;
EPwm2Regs.TZSEL.bit.CBC3 = 1 ;
EPwm2Regs.TZSEL.all = 0x04;
EPwm2Regs.TZCTL.all = 0x0A;
EPwm2Regs.TZEINT.all = 0x00;
// ET
EPwm2Regs.ETSEL.all = 0;
EPwm2Regs.ETPS.all = 0;
// —–ePWM3—–
// TB
EPwm3Regs.TBPHS.all = 0;
EPwm3Regs.TBCTL.all = 0x2036;
// CC
EPwm3Regs.CMPCTL.all = 0x0100;
// AQ
EPwm3Regs.AQCTLA.all = 0x0069;
EPwm3Regs.AQSFRC.all = 0x0;
EPwm3Regs.AQCSFRC.all = 0x00;
// DB
EPwm3Regs.DBCTL.all = 0x000B;
// TZ
EPwm3Regs.TZCLR.all = 0x07;
EPwm3Regs.TZSEL.bit.CBC3 = 1 ;
EPwm3Regs.TZSEL.all = 0x04;
EPwm3Regs.TZCTL.all = 0x0A;
EPwm3Regs.TZEINT.all = 0x00;
// ET
EPwm3Regs.ETSEL.all = 0;
EPwm3Regs.ETPS.all = 0;
EPwm1Regs.TBPRD = 0x186A;
EPwm2Regs.TBPRD = 0x186A;
EPwm3Regs.TBPRD = 0x186A;
EPwm1Regs.ETSEL.bit.SOCAEN = 1;
EPwm1Regs.ETPS.bit.SOCAPRD = 1;
EDIS;
SetVREF(0, 1, 0);
SetVREF(1, 1, 0);
SetVREF(2, 1, 0);
EALLOW;
AdccRegs.ADCCTL2.bit.PRESCALE = 1;
AdccRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdccRegs.ADCCTL1.bit.ADCPWDNZ = 1;
// Dely for steady
DELAY_US(5000) ; // 5000us
AdccRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdccRegs.ADCSOC0CTL.all = 0x4A;
AdccRegs.ADCSOC1CTL.all = 0x4A;
AdccRegs.ADCSOC2CTL.all = 0x18A;
AdccRegs.ADCSOC3CTL.all = 0x14A;
AdccRegs.ADCSOC4CTL.all = 0x18A;
AdccRegs.ADCSOC5CTL.all = 0x14A;
AdccRegs.ADCSOC6CTL.all = 0x08A;
AdccRegs.ADCSOC7CTL.all = 0x08A;
AdccRegs.ADCSOC8CTL.all = 0x4A;
AdccRegs.ADCSOC9CTL.all = 0x4A;
PieVectTable.ADCC2_INT= &adc_over_isr ;
EDIS;
PieCtrlRegs.PIEIER10.bit.INTx10= 1 ; // ADC,INT 8
IER |= M_INT10 ;
mangui zhang:EPWM触发ADC进行转换有没有触发?
程序源代码附上,进不了AD中断?请大神指点。
EALLOW;
// —–ePWM1—–
// TB
EPwm1Regs.TBPHS.all = 0;
EPwm1Regs.TBCTL.all = 0x2012 ;
// CC
EPwm1Regs.CMPCTL.all = 0x0100 ;
// AQ
EPwm1Regs.AQCTLA.all = 0x0069;
EPwm1Regs.AQSFRC.all = 0x0 ;
EPwm1Regs.AQCSFRC.all = 0x0 ;
// DB
EPwm1Regs.DBCTL.all = 0x000B;
EPwm1Regs.TZCLR.all = 0x07;
EPwm1Regs.TZSEL.bit.CBC3 = 1 ;
EPwm1Regs.TZSEL.all = 0x04;
EPwm1Regs.TZCTL.all = 0x0A ;
EPwm1Regs.TZEINT.all = 0 ;
// ET
EPwm1Regs.ETSEL.all = 0;
EPwm1Regs.ETPS.all = 0;
// —–ePWM2—–
// TB
EPwm2Regs.TBPHS.all = 0;
EPwm2Regs.TBCTL.all = 0x2006;
// CC
EPwm2Regs.CMPCTL.all = 0x0100;
// AQ
EPwm2Regs.AQCTLA.all = 0x0069;
EPwm2Regs.AQSFRC.all = 0x0;
EPwm2Regs.AQCSFRC.all = 0x0;
// DB
EPwm2Regs.DBCTL.all = 0x000B;
// TZ
EPwm2Regs.TZCLR.all = 0x07;
EPwm2Regs.TZSEL.bit.CBC3 = 1 ;
EPwm2Regs.TZSEL.all = 0x04;
EPwm2Regs.TZCTL.all = 0x0A;
EPwm2Regs.TZEINT.all = 0x00;
// ET
EPwm2Regs.ETSEL.all = 0;
EPwm2Regs.ETPS.all = 0;
// —–ePWM3—–
// TB
EPwm3Regs.TBPHS.all = 0;
EPwm3Regs.TBCTL.all = 0x2036;
// CC
EPwm3Regs.CMPCTL.all = 0x0100;
// AQ
EPwm3Regs.AQCTLA.all = 0x0069;
EPwm3Regs.AQSFRC.all = 0x0;
EPwm3Regs.AQCSFRC.all = 0x00;
// DB
EPwm3Regs.DBCTL.all = 0x000B;
// TZ
EPwm3Regs.TZCLR.all = 0x07;
EPwm3Regs.TZSEL.bit.CBC3 = 1 ;
EPwm3Regs.TZSEL.all = 0x04;
EPwm3Regs.TZCTL.all = 0x0A;
EPwm3Regs.TZEINT.all = 0x00;
// ET
EPwm3Regs.ETSEL.all = 0;
EPwm3Regs.ETPS.all = 0;
EPwm1Regs.TBPRD = 0x186A;
EPwm2Regs.TBPRD = 0x186A;
EPwm3Regs.TBPRD = 0x186A;
EPwm1Regs.ETSEL.bit.SOCAEN = 1;
EPwm1Regs.ETPS.bit.SOCAPRD = 1;
EDIS;
SetVREF(0, 1, 0);
SetVREF(1, 1, 0);
SetVREF(2, 1, 0);
EALLOW;
AdccRegs.ADCCTL2.bit.PRESCALE = 1;
AdccRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdccRegs.ADCCTL1.bit.ADCPWDNZ = 1;
// Dely for steady
DELAY_US(5000) ; // 5000us
AdccRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdccRegs.ADCSOC0CTL.all = 0x4A;
AdccRegs.ADCSOC1CTL.all = 0x4A;
AdccRegs.ADCSOC2CTL.all = 0x18A;
AdccRegs.ADCSOC3CTL.all = 0x14A;
AdccRegs.ADCSOC4CTL.all = 0x18A;
AdccRegs.ADCSOC5CTL.all = 0x14A;
AdccRegs.ADCSOC6CTL.all = 0x08A;
AdccRegs.ADCSOC7CTL.all = 0x08A;
AdccRegs.ADCSOC8CTL.all = 0x4A;
AdccRegs.ADCSOC9CTL.all = 0x4A;
PieVectTable.ADCC2_INT= &adc_over_isr ;
EDIS;
PieCtrlRegs.PIEIER10.bit.INTx10= 1 ; // ADC,INT 8
IER |= M_INT10 ;
sam liu:
回复 mangui zhang:
AdccRegs.ADCINTSEL1N2.bit.INT2SEL = 7;AdccRegs.ADCINTSEL1N2.bit.INT2E = 1;
有触发