在线时间16 小时
UID3445139
注册时间2021-10-8
NXP金币0
该用户从未签到
注册会员
- 积分
- 148
- 最后登录
- 2022-5-12
|
楼主 |
发表于 2021-11-18 10:52:13
|
显示全部楼层
本帖最后由 yf910404 于 2021-11-19 18:09 编辑
差分信号我是直接接的3.3V的开关电源,接到到9脚DP0,10脚DM0上,11脚DP0,12脚DM0上,仿真时RA寄存器数据正常,但是函数 ADC16Value = ADC16_GetChannelConversionValue(DEMO_ADC16_BASE, DEMO_ADC16_CHANNEL_GROUP);读不到数据。
ADC16Value 值一直为0.
另外RB寄存器无数据,这里面数据是什么数据?
11脚DP0,12脚DM0对应的应该时RB的值,请问11脚DP0,12脚DM0上 是属于ADC0 3通道吗?
我无法通过ADC16_GetChannelConversionValue函数获取AD转换的值,您给看下我的代码,附件有工程。
停止仿真时,程序运行在如下代码处。
LDR R0, =DefaultISR
adc16_channel_config_t ADC0_channelsConfig[2] = {
{
.channelNumber = 0U,
.enableDifferentialConversion = true,
.enableInterruptOnConversionCompleted = true,
},
{
.channelNumber = 3U,
.enableDifferentialConversion = true,
.enableInterruptOnConversionCompleted = true,
}
};
const adc16_config_t ADC0_config = {
.referenceVoltageSource = kADC16_ReferenceVoltageSourceVref,
.clockSource = kADC16_ClockSourceAsynchronousClock,
.enableAsynchronousClock = true,
.clockDivider = kADC16_ClockDivider8,
.resolution = kADC16_ResolutionDF16Bit,
.longSampleMode = kADC16_LongSampleDisabled,
.enableHighSpeed = false,
.enableLowPower = false,
.enableContinuousConversion = true
};
const adc16_channel_mux_mode_t ADC0_muxMode = kADC16_ChannelMuxA;
const adc16_hardware_average_mode_t ADC0_hardwareAverageMode = kADC16_HardwareAverageDisabled;
static void ADC0_init(void) {
/* Initialize ADC16 converter */
ADC16_Init(ADC0_PERIPHERAL, &ADC0_config);
/* Make sure, that software trigger is used */
ADC16_EnableHardwareTrigger(ADC0_PERIPHERAL, false);
/* Configure hardware average mode */
ADC16_SetHardwareAverage(ADC0_PERIPHERAL, ADC0_hardwareAverageMode);
/* Configure channel multiplexing mode */
ADC16_SetChannelMuxMode(ADC0_PERIPHERAL, ADC0_muxMode);
/* Initialize channel */
ADC16_SetChannelConfig(ADC0_PERIPHERAL, ADC0_CH0_CONTROL_GROUP, &ADC0_channelsConfig[0]);
/* Initialize channel */
ADC16_SetChannelConfig(ADC0_PERIPHERAL, ADC0_CH1_CONTROL_GROUP, &ADC0_channelsConfig[1]);
/* Enable interrupt ADC0_IRQn request in the NVIC. */
EnableIRQ(ADC0_IRQN);
}
/***********************************************************************************************************************
* Initialization functions
**********************************************************************************************************************/
void BOARD_InitPeripherals(void)
{
/* Initialize components */
ADC0_init();
}
/***********************************************************************************************************************
* BOARD_InitBootPeripherals function
**********************************************************************************************************************/
void BOARD_InitBootPeripherals(void)
{
BOARD_InitPeripherals();
}
|
|