11580 views|12 replies

79

Posts

0

Resources
The OP

Can you help me take a look, the AD sampling value jitter is serious, what method can be used to solve it? [Copy link]

Now the last two digits of the AD display result are always flashing. I have tried to lower the system frequency and increase the frequency division of the AD sampling timer, but the problem still exists. Is this method correct? Are there any other good methods?
The program is as follows:

#include
#define vref 3300

void clock_init(void)
{

DCOCTL = 0x00;
//XT2 crystal oscillator is turned on, high frequency mode, ALCK frequency division coefficient is 8, select the internal resistor frequency as the highest.
BCSCTL1 =XT2OFF+XTS+DIVA_0+DIVA_1+DIVA_2+DIVA_0+RSEL2+RSEL1+RSEL0;
//MCLK clock is a low-speed crystal oscillator
BCSCTL2=SELM_1+SELM_0+DIVM_1+DIVM_0+SELS+DIVS_3+DIVS_2+DIVS_1+DIVS_0;
}

/*ADC initialization*/
void adc_init(void)
{
ADC12CTL0=ADC12ON+MSC;
ADC12CTL1 =SHP+CONSEQ_1; ADC12MCTL0
= INCH_0
; ADC12MCTL1 = INCH_1;
ADC12MCTL2 = INCH_2;
ADC12MCTL3 = INCH_3;
ADC12MCTL4 = INCH_4;
ADC12MCTL5 = INCH_5;
ADC12MCTL6 = INCH_6;
ADC12MCTL7 = INCH_7+EOS;

ADC12IFG=0xff;
ADC12IE = 0x80;
ADC12CTL0 |= ENC;
ADC12CTL0 |= ADC12SC;
}

#pragma vector=ADC_VECTOR
__interrupt void ADC_ISR (void)
{
adc_rel0 = ADC12MEM0;
adc_rel1 = ADC12MEM1;
adc_rel2 = ADC12MEM2;
adc_rel3 = ADC12MEM3
;
adc_rel4 = ADC12MEM4;
adc_rel5 = ADC12MEM5;
adc_rel6 = ADC12MEM6; adc_rel7 = ADC12MEM7;

adc_rel0 = (unsigned int)(((unsigned long)((unsigned
adc_rel3 =

(unsigned int)(((unsigned long)((unsigned long)adc_rel3*vref))/0xfff);
adc_rel4 = (unsigned int)(((unsigned long)((unsigned long)adc_rel4*vref))/0xfff);
adc_rel5 = (unsigned int)(((unsigned long)((unsigned long)adc_rel5*vref))/0xfff);
adc_rel6 = (unsigned int)(((unsigned long)((unsigned long)adc_rel6*vref))/0xfff);
adc_rel7 = (unsigned int)(((unsigned long)((unsigned long)adc_rel7*vref))/0xfff);

}
This post is from Microcontroller MCU

Latest reply

The ripple of the power supply must be small.  Details Published on 2009-4-27 15:13

60

Posts

0

Resources
2
Try using the average method
This post is from Microcontroller MCU

83

Posts

0

Resources
3
Hfglq, could you please give me some details?
This post is from Microcontroller MCU

80

Posts

0

Resources
4
unint mov_××(unint * p_a)
{
unchar i;
unint k;
for (i=0;i<5;i++)
{
*p_a=ADC10MEM;
*(p_a+1)=*p_a;
p_a++;
}
k=*p_a; //Middle varia××ek;
for(i=0;i<5;i++)
{
p_a--;
k=k+*p_a;
}
k=(unint)k/6; //result=××arage value ;
return(k);
}


The returned k is the processed ok value. For reference.
This post is from Microcontroller MCU

80

Posts

0

Resources
5
Take 10 values, remove max/min and take the average
This post is from Microcontroller MCU

78

Posts

0

Resources
6
How is the noise before sampling? Is it filtered?
This post is from Microcontroller MCU

66

Posts

0

Resources
7
lonely88 May I ask what does the statement k=(unint)k/6 mean? Thank you!!!
This post is from Microcontroller MCU

64

Posts

0

Resources
8
//result=××arage value; Isn’t there a comment behind it?
This post is from Microcontroller MCU

73

Posts

0

Resources
9
"The last two digits flash", how high is the accuracy requirement?
This post is from Microcontroller MCU

80

Posts

0

Resources
10
References:

"The last two digits flash", how high is the accuracy requirement?
0.001v ~ 0.002v
This post is from Microcontroller MCU

74

Posts

0

Resources
11
ADC12 is not configured correctly. SHP=1 is to use the internal sampling timer, and SHT0 and SHT1 need to be configured to match the impedance of the input signal source.
For example:
// Input channel 0-7 sampling time is set to 1024 ADC12 clocks
ADC12CTL0 = ADC12ON+SHT0_15+REFON+REF2_5V;
// Use internal sampling timer
ADC12CTL1 = SHP + ADC12SSEL_3 + CONSEQ_0;
// Wait for 10ms to ensure that the reference voltage is stable (MCLK=4MHz)
__delay_cycles(40000);
This post is from Microcontroller MCU

75

Posts

0

Resources
12
When I was doing the MSP430F448 A/D conversion experiment, the AD input terminal introduced the power supply voltage, that is, 0~5VDC. At the beginning, the display bit was designed to be 4 digits, one integer and three decimal places. After writing and burning the program, the integer digit of the number displayed on the dot matrix LCD screen was stable, the first decimal place was stable, but the last two digits kept changing, and no matter what, I couldn't find a stable point. The reasons should be the following:
1. The power supply voltage fluctuates slightly;
2. The power supply voltage has ripples and is not pure;
3. The internal resistance of the power supply is too large, causing unstable power supply;
4. There is interference on the line;
5. The most fundamental point is that this AD conversion system designed under amateur conditions is not suitable for measuring the accuracy of four decimal places at all, and it should be solved by converting the range. The v gear can be designed to one decimal place; if the detection accuracy needs to be more than 2 decimal places, the mv gear or even nv gear conversion should be added.
This post is from Microcontroller MCU

79

Posts

0

Resources
13
The ripple of the power supply must be small.
This post is from Microcontroller MCU

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

    EEWorld
    subscription
    account

    EEWorld
    service
    account

    Automotive
    development
    circle

    Robot
    development
    community

    Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
    快速回复 返回顶部 Return list