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

DSP28335ADC采样正弦信号波形失真的问题

采用28335ADC采样一个由信号发生器发出的正弦信号,信号频率为220Hz(模仿交流电信号频率,因为最终要采样交流电),方法是将数据由串口传PC,然后matlab绘图,但是结果波形有失真。主要程序和绘图结果如下。请问这主要是什么原因。

 Configure ADC
   AdcRegs.ADCTRL1.bit.ACQ_PS = ADC_SHCLK;
   AdcRegs.ADCMAXCONV.all = 0;       // Setup 2 conv's on SEQ1
   AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x3; // Setup ADCINA3 as 1st SEQ1 conv.
   AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 = 1;// Enable SOCA from ePWM to start SEQ1
   AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1;  // Enable SEQ1 interrupt (every EOS)
Assumes ePWM1 clock is already enabled in InitSysCtrl();
   EPwm1Regs.ETSEL.bit.SOCAEN = 1;        // Enable SOC on A group
   EPwm1Regs.ETSEL.bit.SOCASEL = 4;       // Select SOC from from CPMA on upcount
   EPwm1Regs.ETPS.bit.SOCAPRD = 01;        // Generate pulse on 1st event
   EPwm1Regs.CMPA.half.CMPA = 0x0080;   // Set compare A value
   EPwm1Regs.TBPRD = 0x1D4B;              // Set period for ePWM1
   EPwm1Regs.TBCTL.bit.CTRMODE = 00;   // count up and start

interrupt void  adc_isr(void)
{
  VoltageH[ConversionCount] = AdcRegs.ADCRESULT0 >>12;
  VoltageL[ConversionCount] = AdcRegs.ADCRESULT0 >>4;
  // If 40 conversions have been logged, start over
  if(ConversionCount == 127)
  {
    for (ConversionCount=0;ConversionCount<128;ConversionCount++)
    {
     scib_xmit(VoltageH[ConversionCount]);

     scib_xmit(VoltageL[ConversionCount]);
    }
    for(;;);
     ConversionCount = 0;
  }
  else ConversionCount++;
  // Reinitialize for next ADC sequence
  AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1;         // Reset SEQ1
  AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;       // Clear INT SEQ1 bit
  PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;   // Acknowledge interrupt to PIE
  return;
}
赞(0)
未经允许不得转载:TI中文支持网 » DSP28335ADC采样正弦信号波形失真的问题
分享到: 更多 (0)