使用MSP430自带的ADC对一个低频周期信号(1-100Hz的正弦波或方波)进行采样,采样结果通过DAC7811输出,输出波形的噪声很大是怎么回事呢?下面是我的配置
1.时钟
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
2.与DAC7811通信的SPI配置
UCA0CTL1 |= UCSSEL_2;
UCA0BR0 |= 0x01;
UCA0BR1 = 0;
UCA0CTL0 |= UCCKPL + UCMSB + UCMST + UCSYNC;
UCA0MCTL = UCBRS0;
ADC10CTL1 = ADC10DIV_7 + INCH_6 + SHS_1 + CONSEQ_2;
3.ADC配置
ADC10CTL0 = SREF_0 + ADC10SHT_3 + MSC + ADC10IE + ADC10ON;
TACCTL1 = OUTMOD_4;
TACTL = TASSEL_2 + MC_2;
4.AD转换完成后结果存在int型变量data中,然后通过SPI发送。
P1OUT |= BIT0;//P1.0连接DAC7811的SYNC
while(!(IFG2 & UCA0TXIFG));
P1OUT &= ~BIT0;
UCA0TXBUF = 0x10 | (data>>8 & 0x0f);
data &= 0x00ff;
while(!(IFG2 & UCA0TXIFG));
UCA0TXBUF = data;
data = 0;
while(!(IFG2 & UCA0TXIFG));
__delay_cycles(4);
P1OUT |= BIT0;
输出的波形不只是有量化噪声,还有尖锐的毛刺。
此帖出自
小平头技术问答
一周热门 更多>