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

请问如何 配置 pwm 中断 采集16路ad 为什么只能出adca0-8 而adcb0-8不能采集 ?

请问如何 配置 pwm 中断 采集16路ad   为什么只能出adca0-8  而adcb0-8不能采集 ?

Johnson Chen1:

楼主最好详细说明是使用哪一颗芯片,ADC死如何配置的,采样16路ADC肯定是可以的

请问如何 配置 pwm 中断 采集16路ad   为什么只能出adca0-8  而adcb0-8不能采集 ?

haha1981:

回复 Johnson Chen1:

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

 

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

 

 

    AdcRegs.ADCTRL3.all = 0x00E0;  // Power up bandgap/reference/ADC circuits    DELAY_US(ADC_usDELAY);         // Delay before converting ADC channels

      AdcRegs.ADCTRL1.bit.ACQ_PS = ADC_SHCLK;  // Sequential mode: Sample rate   = 1/[(2+ACQ_PS)*ADC clock in ns]                        //                     = 1/(3*40ns) =8.3MHz (for 150 MHz SYSCLKOUT)         //                     = 1/(3*80ns) =4.17MHz (for 100 MHz SYSCLKOUT)         // If Simultaneous mode enabled: Sample rate = 1/[(3+ACQ_PS)*ADC clock in ns]   AdcRegs.ADCTRL3.bit.ADCCLKPS = ADC_CKPS;   AdcRegs.ADCTRL1.bit.SEQ_CASC = 1;        // 1  Cascaded mode

   AdcRegs.ADCTRL1.bit.CONT_RUN = 1;       // Setup continuous run

   AdcRegs.ADCTRL1.bit.SEQ_OVRD = 1;       // Enable Sequencer override feature

   AdcRegs.ADCMAXCONV.all = 0x000F;       // Setup 2 conv's on SEQ1   AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0; // Setup ADCINA3 as 1st SEQ1 conv.   AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x1; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x2; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 0x3; // Setup ADCINA3 as 1st SEQ1 conv.   AdcRegs.ADCCHSELSEQ2.bit.CONV04 = 0x4; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ2.bit.CONV05 = 0x5; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ2.bit.CONV06 = 0x6; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ2.bit.CONV07 = 0x7; // Setup ADCINA3 as 1st SEQ1 conv.   AdcRegs.ADCCHSELSEQ3.bit.CONV08 = 0x8; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ3.bit.CONV09 = 0x9; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ3.bit.CONV10 = 0xA; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ3.bit.CONV11 = 0xB; // Setup ADCINA3 as 1st SEQ1 conv.   AdcRegs.ADCCHSELSEQ4.bit.CONV12 = 0xC; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ4.bit.CONV13 = 0xD; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ4.bit.CONV14 = 0xE; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ4.bit.CONV15 = 0xF; // Setup ADCINA2 as 2nd SEQ1 conv.         AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 = 1;// Enable SOCA from ePWM to start SEQ1   AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1;

}

 

 

 

 

 

 

   InitAdc(); 

   EPwm1Regs.ETSEL.bit.SOCAEN = 1;           EPwm1Regs.ETSEL.bit.SOCASEL = 0x5;          EPwm1Regs.ETPS.bit.SOCAPRD = 1;       

 

 

 

   PieCtrlRegs.PIEIER1.bit.INTx6 = 1;   PieCtrlRegs.PIEIER1.bit.INTx7 = 1;   IER |= M_INT1; // Enable CPU Interrupt 1   EINT;          // Enable Global interrupt INTM   ERTM;          // Enable Global realtime interrupt DBGM

 

 

   EPwm1Regs.ETSEL.bit.INTSEL = 4;                         EPwm1Regs.ETSEL.bit.INTEN = 1;                   EPwm1Regs.ETPS.bit.INTPRD = 0x1; 

是我的配置  adca1-8能正常采集  adcb1-8不能正常采集  我用soca去触发 然后中断里面去采集ad值,

请问如何 配置 pwm 中断 采集16路ad   为什么只能出adca0-8  而adcb0-8不能采集 ?

haha1981:

回复 haha1981:

28335  芯片

请问如何 配置 pwm 中断 采集16路ad   为什么只能出adca0-8  而adcb0-8不能采集 ?

Johnson Chen1:

回复 haha1981:

如果将通道按下面配置可以采样到ADCINB0-B7信号吗?

你所说的采样不到信号是指采样值不对,还是指CPU根本就只采样了8通道,而剩下的8通道根本没有采?

 AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0; // Setup ADCINA3 as 1st SEQ1 conv.   AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x8; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x9; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 0xA; // Setup ADCINA3 as 1st SEQ1 conv.   AdcRegs.ADCCHSELSEQ2.bit.CONV04 = 0xB; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ2.bit.CONV05 = 0xC; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ2.bit.CONV06 = 0xD // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ2.bit.CONV07 = 0xE; // Setup ADCINA3 as 1st SEQ1 conv.   AdcRegs.ADCCHSELSEQ3.bit.CONV08 = 0xF; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ3.bit.CONV09 = 0x9; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ3.bit.CONV10 = 0xA; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ3.bit.CONV11 = 0xB; // Setup ADCINA3 as 1st SEQ1 conv.   AdcRegs.ADCCHSELSEQ4.bit.CONV12 = 0xC; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ4.bit.CONV13 = 0xD; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ4.bit.CONV14 = 0xE; // Setup ADCINA2 as 2nd SEQ1 conv.   AdcRegs.ADCCHSELSEQ4.bit.CONV15 = 0xF; // Setup ADCINA2 as 2nd SEQ1 conv.

请问如何 配置 pwm 中断 采集16路ad   为什么只能出adca0-8  而adcb0-8不能采集 ?

Peizhong Zhang1:

回复 Johnson Chen1:

采用哪块AD芯片可以实现16路AD并行采集,可以有不通过FPGA连到C6678的方法吗?

赞(0)
未经允许不得转载:TI中文支持网 » 请问如何 配置 pwm 中断 采集16路ad 为什么只能出adca0-8 而adcb0-8不能采集 ?
分享到: 更多 (0)