请教各位老师大侠专家.前两周一直调试5527这款单片机ADC12部分.查找了TI的资料手册.在论坛上找了很多资料.参考代码.ADC12内部参考电压怎么设置都没输出.用万用表量都是0.3~0.7V左右.请赐教.
#include<msp430f5527.h>
void main()
{
WDTCTL = WDTPW + WDTHOLD;
P3DIR |=BIT2;
P5SEL |=0x03; //设置VREF
P6SEL |=BIT4; //A4输入
ADC12CTL0 = ADC12ON+ADC12REFON+ADC12REF2_5V+ADC12MSC; // Turn on ADC12, set sampling time
ADC12CTL2 |=ADC12REFOUT; // set multiple sample conversion
ADC12CTL1 = ADC12SHP+ADC12SSEL1+ADC12DIV1+ADC12DIV0+ADC12CONSEQ_2; // Use sampling
ADC12MCTL0 =ADC12INCH_4;
ADC12IE = 0x01; // Enable ADC12IFG.0
ADC12CTL0 |= ADC12ENC; // Enable conversions
ADC12CTL0 |= ADC12SC; // Start conversion // Start conversion
// __bis_SR_register(LPM4+GIE); // Enter LPM4, Enable interrupts
while(1)
{
delay(65000);
P3OUT ^=BIT2;
}
}
中断程序没帖出...
此帖出自
小平头技术问答
一周热门 更多>