|
用下面的例程试试:
#include "msp430x14x.h" // Standard Equations
void main(void)
{
unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL |= 0x01; // Ena××e A/D channel A0
//P6SEL |= 0x08;
ADC12CTL0 = ADC12ON+SHT0_2+REFON+REF2_5V; // Turn on and set up ADC12
ADC12CTL1 = SHP; // Use sampling timer
ADC12MCTL0 = SREF_1; // Vr+=Vref+
for ( i=0; i<0x3600; i++) // Delay for reference start-up
{
}
ADC12CTL0 |= ENC; // Ena××e conversions
while (1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
//while ((ADC12IFG & BIT0)==0);
while ((ADC12IFG & BIT0)==0);
_NOP(); // SET BREAKPOINT HERE
}
} |
|