我在SDK中看到motor_control例程中,初始化ADC时,它进行寄存器配置,使用的基地址是ADC1的地址,而使用的地址偏移是使用ADC0的偏移,如以下程序
adc_base = CHIPDBBaseAddress(CHIPDB_MOD_ID_ADC1, 0);//0x4834C000 ADC1 Registers
HWREG(adc_base + ADC0_CTRL) = 0 | \
((ADC0_CTRL_HW_PREEMPT_NOPREEMPT << ADC0_CTRL_HW_PREEMPT_SHIFT) | \
((ADC0_CTRL_HW_EVT_MAPPING_HWEVTINPUT << ADC0_CTRL_HW_EVT_MAPPING_SHIFT)) | \
(ADC0_CTRL_TOUCH_SCREEN_EN_DISABLE << ADC0_CTRL_TOUCH_SCREEN_EN_SHIFT) | \
(ADC0_CTRL_STEPCONFIG_WRITEPROTECT_N_NOTPROTECTED << ADC0_CTRL_STEPCONFIG_WRITEPROTECT_N_SHIFT) | \
(ADC0_CTRL_EN_DISABLE << ADC0_CTRL_EN_SHIFT) | \
(ADC0_CTRL_STEP_ID_TAG_WRZERO << ADC0_CTRL_STEP_ID_TAG_SHIFT));
其adc_base是 ADC1 寄存器地址,为什么偏移用 ADC0_CTRL?
Shine:
看上去像是笔误,你可以跑一下这段代码看是否是给ADC1寄存器赋值了?
域闷了:
回复 Shine:
是的,连上板子跑的时候,是给ADC1寄存器赋值了。
Eggsy Pang:
回复 域闷了:
其实ADC0和ADC1他们的base地址不一样,但是偏移地址是是一样的,你可以查看datasheet