在函数的注释中有说明,The Device_cal function MUST be called for the ADC and oscillators to function according to specification. The clocks to the ADC MUST be enabled before calling this function
szoldman 发表于 2018-10-11 20:08 在函数的注释中有说明,The Device_cal function MUST be called for the ADC and oscillators to function according to specification. The clocks to the ADC MUST be enabled before calling this function
Hi, Hank, 多谢回答!
我的疑问不在于Device_cal的调用,我并没有把Device_cal()的调用注释掉,包括Device_cal调用前的打开ADC时钟的代码(AnalogClockEnable())和调用后的关闭ADC时钟的代码(AnalogClockDisable());这些代码都在 InitSysCtrl()中;
我注释掉的部分是void InitPeripheralClocks()中:(斜体部分)
void InitPeripheralClocks(void)
[
// LOSPCP prescale register settings, normally it will be set to default
// values
EALLOW;
SysCtrlRegs.LOSPCP.all = 0x0002;
EDIS;
EALLOW;
while((**AnalogClockEnable)(AnalogConfig1,ADC1_ENABLE)); // Enable ADC 1
while((**AnalogClockEnable)(AnalogConfig2,ANALOGCONFIG2ALL)); // Enable ADC 2, COMP1,2,3,4,5,6
(**ReadAnalogClockStatus)(AnalogConfig2); // Wait for AnalogClockEnable function to finish
......
]
请问,是不是这部分代码和Device_cal()也有关系?
或者开发板上控制的LED灯的GPIO(PC6_GPIO70和PC6_GPIO71)也和ADC时钟有关系?
谢谢!