TI中文支持网
TI专业的中文技术问题搜集分享网站

请问技术支持,28031 使用内部ADC采集9路模拟信号,软件触发ADCINT1中断,但死活进不去中断

如标题所示,程序调了很久,但死活不行,为毛28031的ADC这么的神奇,

9路模拟信号输入通道是ADCINA0~ADCINA4,ADCINA7,ADCINB0,ADCINB1,ADCINB7 这9路信号,

程序中使用的中断是ADCINT1,使用软件置位触发ADC中断,有关AD的程序全部提取如下:

main
{
     DINT;
     InitSysCtrl();
     asm(" RPT #8 || NOP ");
     DINT;

     /***************Interrupt****************/
     InitPieCtrl();
     IER = 0x0000;
     IFR = 0x0000;
     InitPieVectTable();

     EALLOW;
     PieVectTable.ADCINT1 = &adc_isr;//使用ADCINT1
     EDIS;

     InitAdcAio();
     InitAdc(void);

     IER |= M_INT1;////含有ADCINT1

     sw_soc_internal_adc();//启动ADC

     while(1)
     {
         其他程序;
     }
}

void InitAdcAio()
{

   EALLOW;

/* Configure ADC pins using AIO regs*/
// This specifies which of the possible AIO pins will be Analog input pins.
// NOTE: AIO1,3,5,7-9,11,13,15 are analog inputs in all AIOMUX1 configurations.
// Comment out other unwanted lines.

    GpioCtrlRegs.AIOMUX1.bit.AIO2 = 2;    // Configure AIO2 for A2 (analog input) operation
    GpioCtrlRegs.AIOMUX1.bit.AIO4 = 2;    // Configure AIO4 for A4 (analog input) operation
    //GpioCtrlRegs.AIOMUX1.bit.AIO6 = 2;    // Configure AIO6 for A6 (analog input) operation
    //GpioCtrlRegs.AIOMUX1.bit.AIO10 = 2;   // Configure AIO10 for B2 (analog input) operation
    //GpioCtrlRegs.AIOMUX1.bit.AIO12 = 2;   // Configure AIO12 for B4 (analog input) operation
    //GpioCtrlRegs.AIOMUX1.bit.AIO14 = 2;   // Configure AIO14 for B6 (analog input) operation

    EDIS;
}

void InitAdc(void)
{
    extern void DSP28x_usDelay(Uint32 Count);

    EALLOW;
    SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;
    (*Device_cal)();
    EDIS;

    EALLOW;
    AdcRegs.ADCCTL1.bit.ADCBGPWD  = 1;      // Power ADC BG
    AdcRegs.ADCCTL1.bit.ADCREFPWD = 1;      // Power reference
    AdcRegs.ADCCTL1.bit.ADCPWDN   = 1;      // Power ADC
    AdcRegs.ADCCTL1.bit.ADCENABLE = 1;      // Enable ADC
    AdcRegs.ADCCTL1.bit.ADCREFSEL = 0;      // Select interal BG
    EDIS;

    DELAY_US(ADC_usDELAY);         // Delay before converting ADC channels

 AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1;    //ADCINTs trigger at end of conversion
 AdcRegs.ADCCTL1.bit.TEMPCONV = 0;

 AdcRegs.ADCSAMPLEMODE.all = 0x00;//single sample
 
 AdcRegs.ADCSOC0CTL.bit.CHSEL = 0x00;   //soc channel choose,9路
 AdcRegs.ADCSOC1CTL.bit.CHSEL = 0x01;
 AdcRegs.ADCSOC2CTL.bit.CHSEL = 0x02;
 AdcRegs.ADCSOC3CTL.bit.CHSEL = 0x03;
 AdcRegs.ADCSOC4CTL.bit.CHSEL = 0x04;
 AdcRegs.ADCSOC5CTL.bit.CHSEL = 0x07;
 AdcRegs.ADCSOC6CTL.bit.CHSEL = 0x08;
 AdcRegs.ADCSOC7CTL.bit.CHSEL = 0x09;
 AdcRegs.ADCSOC8CTL.bit.CHSEL = 0x0F;

 AdcRegs.ADCSOC0CTL.bit.ACQPS = 6;   //sample time
 AdcRegs.ADCSOC1CTL.bit.ACQPS = 6;
 AdcRegs.ADCSOC2CTL.bit.ACQPS = 6;
 AdcRegs.ADCSOC3CTL.bit.ACQPS = 6;
 AdcRegs.ADCSOC4CTL.bit.ACQPS = 6;
 AdcRegs.ADCSOC5CTL.bit.ACQPS = 6;
 AdcRegs.ADCSOC6CTL.bit.ACQPS = 6;
 AdcRegs.ADCSOC7CTL.bit.ACQPS = 6;
 AdcRegs.ADCSOC8CTL.bit.ACQPS = 6;

 AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 0;//software trigger
 AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 0;
 AdcRegs.ADCSOC2CTL.bit.TRIGSEL = 0;
 AdcRegs.ADCSOC3CTL.bit.TRIGSEL = 0;
 AdcRegs.ADCSOC4CTL.bit.TRIGSEL = 0;
 AdcRegs.ADCSOC5CTL.bit.TRIGSEL = 0;
 AdcRegs.ADCSOC6CTL.bit.TRIGSEL = 0;
 AdcRegs.ADCSOC7CTL.bit.TRIGSEL = 0;
 AdcRegs.ADCSOC8CTL.bit.TRIGSEL = 0;

 
    // Enabled ADCINT1 
    AdcRegs.INTSEL1N2.bit.INT1E = 1;
    
    // Disable continuous sampling for ADCINT1 
    AdcRegs.INTSEL1N2.bit.INT1CONT = 0;
    
    // Setup ADCINT1 trigger source
    AdcRegs.INTSEL1N2.bit.INT1SEL = 1;      //EOC1 triggers ADCINT1
    
    // Setup each SOC's ADCINT trigger source
    AdcRegs.ADCINTSOCSEL1.bit.SOC0  = 1;    //ADCINT1 starts SOC0-7
    AdcRegs.ADCINTSOCSEL1.bit.SOC1  = 1;
    AdcRegs.ADCINTSOCSEL1.bit.SOC2  = 1;
    AdcRegs.ADCINTSOCSEL1.bit.SOC3  = 1;
    AdcRegs.ADCINTSOCSEL1.bit.SOC4  = 1;
    AdcRegs.ADCINTSOCSEL1.bit.SOC5  = 1;
    AdcRegs.ADCINTSOCSEL1.bit.SOC6  = 1;
    AdcRegs.ADCINTSOCSEL1.bit.SOC7  = 1;
    AdcRegs.ADCINTSOCSEL2.bit.SOC8  = 1;    //ADCINT1 starts SOC8 

    DELAY_US(ADC_usDELAY);                  // Delay before converting ADC channels
}

void sw_soc_internal_adc(void)
{
    //ADC Conversion
    EALLOW;
    AdcRegs.ADCSOCFRC1.all = 0xFFFF;  // 软件触发ADCINT1,Force Start SOC0-15 to begin ping-pong sampling
    EDIS;
}

interrupt void adc_isr(void)
{

 while(AdcRegs.ADCINTFLG.bit.ADCINT1 == 0){}  //Wait for ADCINT1

 internal_adc_interrupt_flag = 1;//自定义的变量,标志成功进入ADCINT1中端,已经采集到了9路模拟量
 
 AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;   //Clear ADCINT1 flag reinitialize for next SOC
 PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;   // Acknowledge interrupt to PIE

}

请指点一二,看看有啥问题,愁!!!!!!

yansong zhang:

为何没有技术支持?

赞(0)
未经允许不得转载:TI中文支持网 » 请问技术支持,28031 使用内部ADC采集9路模拟信号,软件触发ADCINT1中断,但死活进不去中断
分享到: 更多 (0)