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.
工具与软件:
您好!
我使用 F28388D 控制卡为我的设计配置外设。 SoC 由 ePWM 触发、因此我已经将 ePWM 连接到 ADC 输入以验证时序。 因此、我预计 ADC 结果是0或4095、+/-噪声。
不过、我得到的一些转换结果却大于65000、就好像 ADC 配置为16位一样。
我已经检查了生成的源、它在源中配置为12位、因此这似乎不是 SysConfig 问题。
(问题似乎也是在 这篇文章中发现的、尽管它没有得到解决)。
Adrien、您好!
如何配置12位分辨率? 要设置分辨率、您需要根据 F2838x_adc.c 中 C2000ware 的头文件使用 AdcSetMode ()或 ADC_setMode ()函数 这些函数可确保将正确的修整加载到 ADC 修整寄存器中、并且您应在复位器件后至少调用它们一次。 通过直接写入 ADCCTL2寄存器来避免配置分辨率。
尊敬的 Masoud:
配置完全使用 SysConfig 完成:
生成的代码(board.c):
void MESURE_COURANT_init(){ // // Configures the analog-to-digital converter module prescaler. // ADC_setPrescaler(MESURE_COURANT_BASE, ADC_CLK_DIV_4_0); // // Configures the analog-to-digital converter resolution and signal mode. // ADC_setMode(MESURE_COURANT_BASE, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED); // // Sets the timing of the end-of-conversion pulse // ADC_setInterruptPulseMode(MESURE_COURANT_BASE, ADC_PULSE_END_OF_ACQ_WIN); // // Sets the timing of early interrupt generation. // ADC_setInterruptCycleOffset(MESURE_COURANT_BASE, 0U); // // Powers up the analog-to-digital converter core. // ADC_enableConverter(MESURE_COURANT_BASE); // // Delay for 1ms to allow ADC time to power up // DEVICE_DELAY_US(500); // // SOC Configuration: Setup ADC EPWM channel and trigger settings // // Disables SOC burst mode. // ADC_disableBurstMode(MESURE_COURANT_BASE); // // Sets the priority mode of the SOCs. // ADC_setSOCPriority(MESURE_COURANT_BASE, ADC_PRI_ALL_ROUND_ROBIN);
您可以看到、我正在"正确的方式"进行配置、生成的代码使用了您建议的函数。
此致、
Adrien
您好!
我发现了问题。 很显然、这是一个愚蠢的错误...在 sysctrl 中、ADC 被设置为由错误的内核控制。 修复磁芯可解决问题。
对此造成的不便、我深表歉意。
此致、
Adrien