微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > MSP430F149的ADC12模块

MSP430F149的ADC12模块

时间:11-27 来源:互联网 点击:

DC12MCTL2 = INCH_2; // ref+=AVcc, channel =2

ADC12MCTL3 = INCH_3+EOS; // ref+=AVcc, channel = A3, end seq.

ADC12IE = 0x08; // Enable ADC12IFG.3

ADC12CTL0 |= ENC; // Enable conversions

ADC12CTL0 |= ADC12SC; // Start conversion

_BIS_SR(LPM0_bits + GIE); // Enter LPM0, Enable interrupts

#pragma vector=ADC12_VECTOR

__interrupt 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; Set Breakpoint here

}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top