cc2530的原来的p0.0-0.7不是ADC通道,我现在要将其转换到ADC通道,我在网上看到一下这段程序是实现转换功能的,我不知道对错与否,请各位大虾看下,谢谢,不甚感激!
#define ADC_ENABLE_CHANNEL(ch) ADCCFG|=(0x01<<ch)
#define ADC_SINGLE_CONVERSION(setting)do{ADCCON3=setting;}while(0)
#define ADC_SAMPLE_SINGLE() \
do { ADC_STOP(); ADCCON1 |= 0x40; } while (0)
#define ADC_STOP() \
do { ADCCON1 |= 0x30; } while (0)
#define ADC_DISABLE_CHANNEL(ch) ADCCFG &= ~(0x01<<ch)
#define HAL_ADC_CHN_AIN2 0x07
#define HAL_ADC_CHN_AIN3 0x06
#define HAL_ADC_CHN_AIN4 0x04
#define HAL_ADC_CHN_AIN6 0x01
请问我现在是不是p0.7,0.6,0.4,0.1已经转换为ADC通道了?
谢谢! |