想把这部分的代码用DIO_8管脚实现,应该DIO_8映射到Board_ADCBUF0呢?
void ADC_Sample_Init(void)
{
/*ADCBuf_Handle adcBuf;
ADCBuf_Params adcBufParams;
ADCBuf_Conversion continuousConversion;*/
unsigned char ret;
//Set up an ADCBuf peripheral in ADCBuf_RECURRENCE_MODE_CONTINUOUS
ADCBuf_Params_init(&adcBufParams);
adcBufParams.callbackFxn = adcBufCallback;
adcBufParams.recurrenceMode = ADCBuf_RECURRENCE_MODE_CONTINUOUS;
adcBufParams.returnMode = ADCBuf_RETURN_MODE_CALLBACK;
adcBufParams.samplingFrequency = 200;
adcBuf = ADCBuf_open(Board_ADCBUF0, &adcBufParams);
//Configure the conversion struct
continuousConversion.arg = NULL;
continuousConversion.adcChannel = Board_ADCBUF0CHANNEL0;
continuousConversion.sampleBuffer = sampleBufferOne;
continuousConversion.sampleBufferTwo = sampleBufferTwo;
continuousConversion.samplesRequestedCount = ADCBUFFERSIZE;
if (adcBuf == NULL){
// ADCBuf failed to open.
while(1);
}
//Start converting.
ret = ADCBuf_convert(adcBuf, &continuousConversion, 1);
if (ret !=
ADCBuf_STATUS_SUCCESS) {
//Did not start conversion process correctly.
while(1);
}
}
Viki Shi:
修改CC1310_LAUNCHXL.h
user6340973:
回复 Viki Shi:
看到这个头文件关于ADC的就这边,没看出来要修改哪里,请指教一下!
/*! * @def CC1310_LAUNCHXL_ADCBufName * @brief Enum of ADCBufs */typedef enum CC1310_LAUNCHXL_ADCBufName { CC1310_LAUNCHXL_ADCBUF0 = 0,
CC1310_LAUNCHXL_ADCBUFCOUNT} CC1310_LAUNCHXL_ADCBufName;
/*! * @def CC1310_LAUNCHXL_ADCBuf0SourceName * @brief Enum of ADCBuf channels */typedef enum CC1310_LAUNCHXL_ADCBuf0ChannelName { CC1310_LAUNCHXL_ADCBUF0CHANNEL0 = 0, CC1310_LAUNCHXL_ADCBUF0CHANNEL1, CC1310_LAUNCHXL_ADCBUF0CHANNEL2, CC1310_LAUNCHXL_ADCBUF0CHANNEL3, CC1310_LAUNCHXL_ADCBUF0CHANNEL4, CC1310_LAUNCHXL_ADCBUF0CHANNEL5, CC1310_LAUNCHXL_ADCBUF0CHANNEL6, CC1310_LAUNCHXL_ADCBUF0CHANNEL7, CC1310_LAUNCHXL_ADCBUF0CHANNELVDDS, CC1310_LAUNCHXL_ADCBUF0CHANNELDCOUPL, CC1310_LAUNCHXL_ADCBUF0CHANNELVSS,
CC1310_LAUNCHXL_ADCBUF0CHANNELCOUNT} CC1310_LAUNCHXL_ADCBuf0ChannelName;
/*! * @def CC1310_LAUNCHXL_ADCName * @brief Enum of ADCs */typedef enum CC1310_LAUNCHXL_ADCName { CC1310_LAUNCHXL_ADC0 = 0, CC1310_LAUNCHXL_ADC1, CC1310_LAUNCHXL_ADC2, CC1310_LAUNCHXL_ADC3, CC1310_LAUNCHXL_ADC4, CC1310_LAUNCHXL_ADC5, CC1310_LAUNCHXL_ADC6, CC1310_LAUNCHXL_ADC7, CC1310_LAUNCHXL_ADCDCOUPL, CC1310_LAUNCHXL_ADCVSS, CC1310_LAUNCHXL_ADCVDDS,
CC1310_LAUNCHXL_ADCCOUNT} CC1310_LAUNCHXL_ADCName;
user6340973:
回复 YiKai Chen:
把这个改为
#define CC1310_LAUNCHXL_DIO23_ANALOG IOID_8
还是不能映射到IOID8,测得还是IOID23的电压,除了这边哪边还要做改动吗
user6340973:
我想把DI0_8作为ADC采样的管脚,在CC1310_LAUNCHXL.h头文件中修改了以下IO口对应
#define CC1310_LAUNCHXL_DIO23_ANALOG IOID_8
发现测得的电压还是IOID_23管脚上的电压,还有哪边需要修改吗?请指点一下,谢谢!
YiKai Chen:
回复 user6340973:
你CC1310封裝是7×7,5×5,還是4×4?
user6340973:
回复 YiKai Chen:
5*5
YiKai Chen:
回复 user6340973:
既然是5×5為什麼還會发现测得的电压还是IOID_23管脚上的电压?5×5就沒有IOID_23管脚了不是嗎?
user6340973:
回复 YiKai Chen:
我自己的板子是5*5,现在使用TI官方的开发板跑的
YiKai Chen:
回复 user6340973:
TI官方的开发板是7×7,IOID_8不能當ADC,當然會有問題