首先说说问题, 感觉这个Code Compose Studio 比较奇怪
#include "TFT\TFT_Driver.h"
找不到文件, 无法打开
没有include 仅在同一工程下就可以使用函数
每次运行程序结果不同
下面给出一个使用ADC的实例:
ADC初始化函数:
void ConfigureAdcTempSensor(void)
{
/* Configure ADC Temp Sensor Channel */
ADC10CTL1 = INCH_10 + ADC10DIV_0 + CONSEQ_2; // Temp Sensor ADC10CLK/4
ADC10CTL0 = SREF_1 + ADC10SHT_3 + MSC + REFON + ADC10ON + ADC10IE;
// __delay_cycles(1000); // Wait for ADC Ref to settle
ADC10DTC1=0xfe;
ADC10CTL0&=~ENC;
while(ADC10CTL1&BUSY);
ADC10SA=0x0200; //(unsigned int)tempMeasured;
//data buffer start
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // LPM0 with interrupts enabled
tempAverage = tempMeasured