设置为
// Configure ADC10 – Pulse sample mode; ADC10SC trigger
ADC10CTL0 &= ~ADC10ENC; // Ensure ENC is clear
ADC10CTL0 = ADC10SHT_5 + ADC10ON; // 16 ADC10CLKs; ADC ON
ADC10CTL1 = ADC10SHP + ADC10CONSEQ_0; // s/w trig, single ch/conv
ADC10CTL2 = ADC10RES; // 10-bit conversion results
ADC10MCTL0 = ADC10SREF_1 + ADC10INCH_11; // AVcc/2 // Configure internal reference
while(REFCTL0 & REFGENBUSY); // If ref generator busy, WAIT
REFCTL0 |= REFVSEL_1+REFON;
__delay_cycles(10000); // Delay for Ref to settle
VccValue = (10*ADC10MEM0)>>8;
而数据手册里看到Nadc=1023*(Vin-Vr-)/Vr+-Vr-
Vin=ADC10MEM0*2/1024 才对,为什么例子里剩10再除256。应该直接可除512
Lina Lian:
xinglong qi1,
看程序,你ADC的参考电压选择的是内部REF, 2.0V, 我认为你的算法是正确的,Vin=ADC10MEM0*2/1023。请问你的例程是哪里来的?我查看了MSP430Ware中对应的例程,没有你这个例程的。
希望对你有帮助!O(∩_∩)O~
xinglong qi1:
回复 Lina Lian:
这个例子是Home Automation Application里的,CC3000+MSP430FR5739的板,这ADC应该和CC3000没有关系。