This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] MSP430FR6989:ADC12_B_MEMORYX配置

Guru**** 2609285 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/657995/msp430fr6989-adc12_b_memoryx-configuration

部件号:MSP430FR6989

您好,

我无法配置 ADC12_B_MEMORY_1以获取ADC结果  

我只能配置 ADC12_B_MEMORY_0  

这是我的代码  

#include <driverlib.h>
#include <lcd.h>


uINT16_t i=0;
浮点ADC_Value=0;
UINT16_t ADC_Value1=0;

int main (void){


//停止看门狗计时器
WDT_A_HOLD (WDT_A_BASE);

pm_unlockLPM5();



//************** ADC12_B *************************** //
/*选择端口1
*将引脚8.4 设置为输出(或输入I/O x)三元模块功能(A7,C7)。
*/
GPIO_setAsPeripheralModuleFunctionOutputPin (
GPIO端口P8,
GPIO _PIN4,
GPIO三元模块函数
);
/*选择端口1
*将引脚8.6 设置为输出(或输入I/O x)三元模块功能(A5,C7)。
*/
GPIO_setAsPeripheralModuleFunctionOutputPin (
GPIO端口P8,
GPIO _PIN6,
GPIO三元模块函数
);

//初始化ADC12B模块
/*
* ADC12B模块的基本地址
*使用内部ADC12B位作为采样/保持信号开始转换
*使用MODOSC 5MHZ数字振荡器作为时钟源
*使用默认时钟分频器/前置分频器1
*不使用内部通道
*/
ADC12_B_initParam initParam ={0};
initParam.sampleHoldSignalSourceSelect = ADC12_B_SAMPLEHOLDSOURCE_SC;
initParam.clockSourceSelect = ADC12_B_CLOCKSOURCE_ADC12OSC;
initParam.clockSourceDivider = ADC12_B_CLOCKDIVIDER_1;
initParam.clockSourcePrediver= ADC12_B_CLOCKPREDIER__1;
initParam.internalChannelMap = 0x00;
ADC12_B_INIT(ADC12_B_base,&initParam);

//启用ADC12B模块
ADC12_B_ENABLE (ADC12_B_BASE);

/*
* ADC12B模块的基本地址
*用于内存缓冲区0-7采样/保持64个时钟周期
*对于内存缓冲区,8-15采样/保持,4时钟周期(默认值)
*禁用多重采样
*/
ADC12_B_setupSamplingTimer(ADC12_B_base,
ADC12_B_CYCLEHOLD_16_CYCLES,
ADC12_B_CYCLEHOLD_4_CYCLES,
ADC12_B_MULTIPLESAMPLESDISABLE);


//为A5配置内存缓冲区
/*
* ADC12B模块的基本地址
*配置内存缓冲区1
*将输入A6映射到内存缓冲区1
* Vref+= AVcc
*参考值-=平均值
*内存缓冲区0不是序列的结尾
*/
ADC12_B_configureMemoryParam配置MemoryParam1 ={0};
configureMemoryParam1.memoryBufferControlIndex = ADC12_B_memory_1;
configureMemoryParam1.inputSourceSelect = ADC12_B_INPUT_A5;
configureMemoryParam1.refVoltageSourceSelect = ADC12_B_VREFPOS_AVCC_VREFNEG_VSS;
configureMemoryParam1.endOfSequence = ADC12_B_NOTENDOFSEQUENCER;
配置内存Param1.windowComparatorSelect = ADC12_B_window_Comparer_disable;
configureMemoryParam1.DifferalModeSelect = ADC12_B_Different_mode_disable;
ADC12_B_configureMemory (ADC12_B_BASE,&configureMemoryParam1);


////////////////// ADC//////////////////////////////

LCDInit (LS_NONE);
同时(1)

ADC12_B_startConversion(ADC12_B_base,
ADC12_B_MEMORY_1,
ADC12_B_REQUITED_SEQOFCHANNELS);

ADC_Value1=ADC12_B_getResults (ADC12_B_BASE,ADC12_B_MEMORY_1);


LCDWriteIntXY(0,0,ADC_Value1,4);


用于(i=0;i<1万;i++);

}//While循环结束
}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好Mohamed:

    ADC12_B_MEMORY_1不是ADC12_B_startConversion的有效参数,因为ADC12_B_MEMORY_x术语为地址选择增加了两倍(ADC12_B_configureMemory的ADC12MCTLx和ADC12_B_getResults的ADC12MEMx),而设置正确的CADDCADT12L3的值则需要增加一个。 我也看不到多通道初始化,因此请使用ADC12_B_startConversion (ADC12_B_B_B_BASE,1,ADC12_B_REALIZED_SINGLECHANNEL);而不要使用。 https://e2e.ti.com/support/microcontrollers/msp430/f/166/t/58.5999万 

    此致,
    Ryan