ADC配置为
ADC12CTL0 = ADC12ON+ADC12SHT0_4+ADC12MSC;
ADC12CTL1 = ADC12SHP+ADC12CONSEQ_3;
双通道10次采样取平均值,手册上脉冲采样时间如图,按(4 x ADC12CLK x N) + ( 13 xADC12CLK/Fadc12clk))计算得29ms,调试时总是MSP430F5529要快一些,希望得到帮助,谢谢
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
图上传不了,翻转波形连续10次采样为26ms
#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR (void)
{
static unsigned int m,count = 0;
float factor=0.80566;
results1[count]=ADC12MEM0;
results2[count]=ADC12MEM1;
count++;
for(m=0;m<10;m++)
{
sum1+=results1[m];
sum2+=results2[m];
}
sum1/=10;
com1=sum1*factor;
sum2/=10;
com2=sum2*factor/flag;
sum3=com1*com2;
com3=sum3;
sum4+=sum3;
com4=sum4*0.026;
sum5+=2.6;
shijian=sum5;
P7OUT ^= BIT0;
if (count == 10)
{
count = 0;
ADC12IE = 0x00;
}
}