共2条
1/1 1 跳转至页
ADC12,5V 请问使用ADC12内部参考源2.5V,如何进行零度和满度调整。

问
请问我使用ADC12内部参考源2.5V,如何进行零度和满度调整。我是这样做的,把参考源选为Vref+,Vref-,把输入通道选为Vref-,但这样转换后,中断后结果始终为0.不知道是不是达到零度调整。请们指点小妹。非常感谢!!!我在作毕业设计,程序调不出来啊。那如何进行满度调整呢,输入通道没有定义Vref+,啊????
答 1:
Vref+,Vref-,需要外接!
答 2:
既然想使用内部参考源就不需外接参考源了。
#include "MSP430x44x.h" // Standard Equations
#define Num_of_Results 8
static unsigned int A0results[Num_of_Results]; // These need to be global in
static unsigned int A1results[Num_of_Results]; // this example. Otherwise, the
static unsigned int A2results[Num_of_Results]; // compiler removes them because
static unsigned int A3results[Num_of_Results]; // they are not used
void main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL = 0x0F; // Enable A/D channel inputs
ADC12CTL0 = ADC12ON+MSC+SHT0_8+REF2_5V; // Turn on ADC12, extend sampling time
// to avoid overflow of results
ADC12CTL1 = SHP+CONSEQ_3+ADC12DIV_7; // Use sampling timer, repeated sequence
ADC12MCTL0 = INCH_0; // ref+=AVcc, channel = A0
ADC12MCTL1 = INCH_1; // ref+=AVcc, channel = A1
ADC12MCTL2 = INCH_2; // ref+=AVcc, channel = A2
ADC12MCTL3 = INCH_3+EOS; // ref+=AVcc, channel = A3, end seq.
ADC12IE = 0x08; // Enable ADC12IFG.3
ADC12CTL0 |= ENC; // Enable conversions
_EINT(); // Enable interrupts
ADC12CTL0 |= ADC12SC; // Start conversion
_BIS_SR(LPM0_bits); // Enter and stay in LPM0
}
interrupt[ADC_VECTOR] void ADC12ISR (void)
{
static unsigned int index = 0;
A0results[index] = ADC12MEM0; // Move A0 results, IFG is cleared
A1results[index] = ADC12MEM1; // Move A1 results, IFG is cleared
A2results[index] = ADC12MEM2; // Move A2 results, IFG is cleared
A3results[index] = ADC12MEM3; // Move A3 results, IFG is cleared
index = (index+1)%Num_of_Results; // Increment results index, modulo
} 答 3: 大侠提供的程序,我觉得还是没进行内部参考源零度和满度调整啊,我只是想把内部参考源进行零度和满度调整,不知道该怎么办 答 4: 引用:
#include "MSP430x44x.h" // Standard Equations
#define Num_of_Results 8
static unsigned int A0results[Num_of_Results]; // These need to be global in
static unsigned int A1results[Num_of_Results]; // this example. Otherwise, the
static unsigned int A2results[Num_of_Results]; // compiler removes them because
static unsigned int A3results[Num_of_Results]; // they are not used
void main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL = 0x0F; // Enable A/D channel inputs
ADC12CTL0 = ADC12ON+MSC+SHT0_8+REF2_5V; // Turn on ADC12, extend sampling time
// to avoid overflow of results
ADC12CTL1 = SHP+CONSEQ_3+ADC12DIV_7; // Use sampling timer, repeated sequence
ADC12MCTL0 = INCH_0; // ref+=AVcc, channel = A0
ADC12MCTL1 = INCH_1; // ref+=AVcc, channel = A1
ADC12MCTL2 = INCH_2; // ref+=AVcc, channel = A2
ADC12MCTL3 = INCH_3+EOS; // ref+=AVcc, channel = A3, end seq.
ADC12IE = 0x08; // Enable ADC12IFG.3
ADC12CTL0 |= ENC; // Enable conversions
_EINT(); // Enable interrupts
ADC12CTL0 |= ADC12SC; // Start conversion
_BIS_SR(LPM0_bits); // Enter and stay in LPM0
}
interrupt[ADC_VECTOR] void ADC12ISR (void)
{
static unsigned int index = 0;
A0results[index] = ADC12MEM0; // Move A0 results, IFG is cleared
A1results[index] = ADC12MEM1; // Move A1 results, IFG is cleared
A2results[index] = ADC12MEM2; // Move A2 results, IFG is cleared
A3results[index] = ADC12MEM3; // Move A3 results, IFG is cleared
index = (index+1)%Num_of_Results; // Increment results index, modulo
} 答 3: 大侠提供的程序,我觉得还是没进行内部参考源零度和满度调整啊,我只是想把内部参考源进行零度和满度调整,不知道该怎么办 答 4: 引用:
共2条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
高校联络员开始招募啦!有惊喜!! | |
【工程师专属福利】每天30秒,积分轻松拿!EEPW宠粉打卡计划启动! | |
送您一块开发板,2025年“我要开发板活动”又开始了! | |
分享开发笔记,赚取电动螺丝刀(便携轻巧与无刷电机两款可选) | |
【活动延期至2025年6月30日】写试用笔记分享开发经验,换取手持数字示波器 | |
【有奖活动】伙伴们:您的“需求”解决了吗? | |
打赏了!打赏了!打赏了! |