#include "msp430x41x2.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
ADC10CTL0 = SREF_1 + ADC10SHT_2 + REFON + ADC10ON + ADC10IE;
TACCR0 = 30; // Delay to allow Ref to settle
TACCTL0 |= CCIE; // Compare-mode interrupt.
TACTL = TASSEL_2 + MC_1; // TACLK = SMCLK, Up mode.
__bis_SR_register(CPUOFF + GIE); // LPM0, TA0_ISR will force exit
TACCTL0 &= ~CCIE; // Disable timer Interrupt
ADC10AE0 |= 0x01; // P7.4 ADC option select
P5DIR |= 0x02; // Set P5.1 to output direction
for (;;)
{
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit
if (ADC10MEM < 0x88) // ADC10MEM = A0 > 0.2V?
P5OUT &= ~0x02; // Clear P5.1 LED off
else
P5OUT |= 0x02; // Set P5.1 LED on
}
}
我想请问 ADC10MEM<0x88 是什么意思? 和后面注释里 ADC10MEM = A0 > 0.2V 是怎么对应的?
我是初学者,问题可能比较基础,忘前辈们指导。
[
本帖最后由 杜大壮 于 2011-10-27 13:40 编辑 ]
此帖出自
小平头技术问答
这个你得结合#include的.h头文件来看才行
一周热门 更多>