采用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;
}
未经允许不得转载:TI中文支持网 » DSP28335ADC采样正弦信号波形失真的问题
相关推荐
- IWRL6432: Is it possible to bypass IF filter before ADC
- IWR1843BOOST: 关于MRR 的profile 配置,一个子帧配置中配置两个profile是否能使用不同的adcstartTime?
- TMS320F28069: ADC采样结果寄存器ADCRESULTx和SOCx通道发生错位,向后移了一位,但仍然一一对应
- TMS320F28069: DPLib使用遇到了错误: Type unresolved symbol _ADCDRV_8ch_RltA, first referenced in ./Main.obj
- INA827: INA827
- LAUNCHXL-F280049C: C2000WARE中提供的ePWM样例代码debug时ecap部分出现波形异常+ADC采集异常
- RM44L520: ADC中调用while(adcIsConversionComplete(adcREG1,1)==0);后不再向下执行
- ADC12QJ800: 204B模式,如何配置该芯片的SYSREF寄存器