The problems of ADC12
ling1995
Posts: 3
in Propeller 1
Good morning~I don't know if I chose the right forum to put forward my troubles,but I hope someone here could help me out!
I met a troubles about ADC12,please looking the following states:
The P6.4 pin belongs to msp430f5438A. I inputted A4 imitatively and then change it by using ADC after initialization. Unfortunately,whatever I puted A4 into the electrical grounding or collected the actual voltage ,the AD valut that it connected always in about 2000.
Thank you in advance!
I met a troubles about ADC12,please looking the following states:
The P6.4 pin belongs to msp430f5438A. I inputted A4 imitatively and then change it by using ADC after initialization. Unfortunately,whatever I puted A4 into the electrical grounding or collected the actual voltage ,the AD valut that it connected always in about 2000.
void Init_Timer_A1(){ TA1CCTL0 = CCIE; // CCR0 interrupt enabled TA1CCR0 = 30000; //设置时钟中断周期为30ms //TA1CCTL2 = OUTMOD_7 + CCIE; // CCR2 set/reset Interrupt enabled TA1CTL = TASSEL_1 + MC_1 + TACLR; // ACLK, upmode, clear TAR } void InitADC12() { P6SEL |= 0x10; // Enable P6.4 as A/D channel input ADC12CTL0 = ADC12ON + ADC12SHT0_2; // Turn on ADC12, set sampling time, 16ADC12CLK cycles ADC12CTL1 = ADC12SHP + ADC12CONSEQ_0 + ADC12SSEL_2; //MEM0,IFG0 // Use sampling timer, single time single channel,MCLK=4M ADC12MCTL1 = ADC12SREF_2 + ADC12INCH_4; // ref+ = VeREF+, ref- = AVSS, channel = A4 } #pragma vector=TIMER1_A0_VECTOR __interrupt void TIMER_A0(void) { //P6OUT ^= 0x01; // Toggle触发 P11.0 ADC12IE = ADC12IE0; ADC12CTL0 |= ADC12SC + ADC12ENC; //开始ADC转换 while((ADC12IFG & 0x0001) == 0); Point_now = ADC12MEM0; __no_operation();Is there any wrong in my pin? Could anyone help me out ?This is the datasheet of msp430f5438A.
Thank you in advance!
Comments
OK,thanks a lot!