#include <msp430x14x.h>
#define ADCDeltaOn 12 // ~2 Deg C delta
static unsigned int FirstADCVal; // holds 1st ADC result
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog
P1OUT = 0x00; // Clear P1
P1DIR = 0x01; // P1.0 as output
ADC12CTL1 = SHS_1 + SHP + CONSEQ_2; // TA trig., rpt conv.
ADC12MCTL0 = SREF_1 + INCH_10; // Channel A10, Vref+
ADC12IE = 0x01; // Enable ADC12IFG.0
ADC12CTL0 = SHT0_8 + REF2_5V + REFON + ADC12ON + ENC; // Config ADC12
TACCTL1 = OUTMOD_4; // Toggle on EQU1 (TAR = 0)
TACTL = TASSEL_2 + MC_2; // SMCLK, cont-mode
while (!(0x01 & ADC12IFG)); // First conversion?
FirstADCVal = ADC12MEM0; // Read out 1st ADC value
_BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt
}
#pragma vector=ADC_VECTOR
__interrupt void ADC12ISR (void)
{
if (ADC12MEM0 <= FirstADCVal + ADCDeltaOn)
P1OUT &= ~0x01; // LED off
else P1OUT |= 0x01; // LED on
}
请问“ADC12MEM0 <= FirstADCVal + ADCDeltaOn”这句是什么意思?为什么要加上12?
还有SHS_1选择定时器A触发采样,而“TACCTL1 = OUTMOD_4; ”选择toggle又是什么意思?
这个程序时测量芯片内部的温度吗?
