1. ADC采集比较简单,内部的10位的ADC,AIN0-AIN3的输入,主要是用的CSL的库函数#include <csl_adc.h>
Uint32 adc_sample_value = ;
Uint16 samplestoraage[]={,};
unsigned char adc_value_baiwei = ;
unsigned char adc_value_shiwei = ;
unsigned char adc_value_gewei = ;
int sysclkdiv=,convratediv=,sampletimediv=;
int counter=,index=;
int channel=,samplenumber=; /* Initialize CSL library - This is REQUIRED !!! */
/*初始化CSL库*/
CSL_init(); /*设置系统的运行速度为140MHz*/
PLL_config(&myConfig);
ADC_setFreq(sysclkdiv,convratediv,sampletimediv);
ADC_read(channel,samplestoraage,samplenumber); adc_sample_value = (samplestoraage[] + samplestoraage[])/;
adc_sample_value = (adc_sample_value * )/; adc_value_baiwei = adc_sample_value/; //ADC电压值个位
adc_value_shiwei = adc_sample_value%/; //ADC电压值小数点后一位
adc_value_gewei = adc_sample_value%;//ADC电压值小数点后两位