谢谢大神回复,配置是这样的,没查出配置的问题
SYS->GPB_MFPH &= ~(SYS_GPB_MFPH_PB14MFP_Msk | SYS_GPB_MFPH_PB15MFP_Msk);
SYS->GPB_MFPH |= (SYS_GPB_MFPH_PB14MFP_UART3_RXD | SYS_GPB_MFPH_PB15MFP_UART3_TXD);
/* Set I2C1 multi-function pins */
SYS->GPC_MFPL &= ~(SYS_GPC_MFPL_PC4MFP_Msk | SYS_GPC_MFPL_PC5MFP_Msk);
SYS->GPC_MFPL |= (SYS_GPC_MFPL_PC5MFP_I2C1_SCL | SYS_GPC_MFPL_PC4MFP_I2C1_SDA);
/* I2C clock pin enable schmitt trigger */
PC->SMTEN |= GPIO_SMTEN_SMTEN5_Msk; //PC5
/* Configure PC.4 as 开漏 mode */
GPIO_SetMode(PC, BIT4, GPIO_MODE_OPEN_DRAIN);
//EADC0
//单通道采集
SYS->GPB_MFPH &= ~(SYS_GPB_MFPH_PB9MFP_Msk | SYS_GPB_MFPH_PB8MFP_Msk ); //| SYS_GPB_MFPH_PB10MFP_Msk
SYS->GPB_MFPH |= (SYS_GPB_MFPH_PB9MFP_EADC0_CH9 | SYS_GPB_MFPH_PB8MFP_EADC0_CH8 );
SYS->GPB_MFPL &= ~(SYS_GPB_MFPL_PB0MFP_Msk | SYS_GPB_MFPL_PB1MFP_Msk|SYS_GPB_MFPL_PB2MFP_Msk | SYS_GPB_MFPL_PB3MFP_Msk|SYS_GPB_MFPL_PB4MFP_Msk | SYS_GPB_MFPL_PB5MFP_Msk);
SYS->GPB_MFPL |= (SYS_GPB_MFPL_PB0MFP_GPIO | SYS_GPB_MFPL_PB1MFP_GPIO|SYS_GPB_MFPL_PB2MFP_GPIO | SYS_GPB_MFPL_PB3MFP_GPIO|SYS_GPB_MFPL_PB4MFP_GPIO | SYS_GPB_MFPL_PB5MFP_GPIO);
//避免对AD产生干扰
GPIO_SetMode(PB, BIT10|BIT11, GPIO_MODE_OPEN_DRAIN);
PB10=PB11=0;
GPIO_SetMode(PD, BIT0, GPIO_MODE_OPEN_DRAIN);//漏极开路 工作指示灯
GPIO_SetMode(PD, BIT1|BIT2, GPIO_MODE_QUASI);//准双向口 压力开关
GPIO_SetMode(PB, BIT0|BIT1|BIT2|BIT3|BIT4|BIT5, GPIO_MODE_QUASI);//准双向口 电子秤采样用准双向口
GPIO_SetMode(PA, BIT0|BIT1|BIT2|BIT3|BIT4|BIT5|BIT6|BIT7|BIT8|BIT9|BIT10|BIT11|BIT12|BIT13|BIT14|BIT15, GPIO_MODE_OUTPUT); //推挽输出
/* Disable the GPB0 - GPB3 digital input path to avoid the leakage current. */
GPIO_DISABLE_DIGITAL_PATH(PB, BIT6|BIT7| BIT8|BIT9|BIT10| BIT11);
EADC_Open(EADC, EADC_CTL_DIFFEN_SINGLE_END);
EADC_SetExtendSampleTime(EADC,0,0xFF);//Set ADC extend sample time
EADC_SetExtendSampleTime(EADC,1,0xFF);//Set ADC extend sample time
EADC_ConfigSampleModule(EADC, 0, EADC_ADINT0_TRIGGER, 9); //|EADC_SOFTWARE_TRIGGER EADC_ADINT0_TRIGGER
EADC_ConfigSampleModule(EADC, 1, EADC_ADINT0_TRIGGER, 8);//模块转换触发源为EADC_ADINT0_TRIGGER
EADC_CLR_INT_FLAG(EADC, EADC_STATUS2_ADIF0_Msk);
/* Enable the sample module 7 interrupt */
EADC_ENABLE_INT(EADC, BIT0);//Enable sample module A/D ADINT0 interrupt. 使能转换完成ADINT0 EOC中断 ADCIEN0=1
EADC_ENABLE_SAMPLE_MODULE_INT(EADC, 0, BIT0);//Enable sample module 0 interrupt.ADC0的模块0中断使能
NVIC_EnableIRQ(EADC00_IRQn);
EADC_START_CONV(EADC, BIT0);
配置是这样的 |