-
GD32F103ZET6内部ADC2有没有
使用官方的库函数,ADC2根本无法初始化dma_parameter_structdma_data_parameter;rcu_periph_clock_enable(RCU_GPIOF);rcu_periph_clock_enable(RCU_ADC2);rcu_periph_clock_enable(RCU_DMA1);/*配置PF*/gpio_init(GPIOF,GPIO_MODE_AIN,GPIO_OSPEED_50MHZ,GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10);/*ADCDMA_channelconfiguration*/dma_deinit(DMA1,DMA_CH4);/*initializeDMAsingledatamode*/dma_data_parameter.periph_addr=(uint32_t)(&ADC_RDATA(ADC2));dma_data_parameter.periph_inc=DMA_PERIPH_INCREASE_DISABLE;dma_data_parameter.memory_addr=(uint32_t)(&ADC2_ConvertedValue);dma_data_parameter.memory_inc=DMA_MEMORY_INCREASE_ENABLE;dma_data_parameter.periph_width=DMA_PERIPHERAL_WIDTH_16BIT;dma_data_parameter.memory_width=DMA_MEMORY_WIDTH_16BIT;dma_data_parameter.direction=DMA_PERIPHERAL_TO_MEMORY;dma_data_parameter.number=M1*N1;dma_data_parameter.priority=DMA_PRIORITY_HIGH;dma_init(DMA1,DMA_CH4,&dma_data_parameter);dma_circulation_enable(DMA1,DMA_CH4);/*enableDMAchannel*/dma_channel_enable(DMA1,DMA_CH4);/*ADC配置*/adc_deinit(ADC2);/*ADCmodeconfig*/adc_mode_config(ADC_MODE_FREE);/*ADCcontineousfunctionenable*/adc_special_function_config(ADC2,ADC_CONTINUOUS_MODE,ENABLE);/*ADCscanmodedisable*/adc_special_function_config(ADC2,ADC_SCAN_MODE,ENABLE);/*ADCdataalignmentconfig*/adc_data_alignment_config(ADC2,ADC_DATAALIGN_RIGHT);/*ADCchannellengthconfig*/adc_channel_length_config(ADC2,ADC_REGULAR_CHANNEL,M1);/*ADC0规则通道配置*/adc_regular_channel_config(ADC2,0,ADC_CHANNEL_7,ADC_SAMPLETIME_239POINT5);adc_regular_channel_config(ADC2,1,ADC_CHANNEL_8,ADC_SAMPLETIME_239POINT5);adc_regular_channel_config(ADC2,2,ADC_CHA
2024-06-25 5 -
有没有GD32 MCU技术支持吗?
我需要技术支持QQ459829634
2024-04-16 0 -
HC32L190 定时器中断不进入
使用华大单片机碰到一些问题,不知道有人能帮我解决吗?voidtime0_Init(void){uint16_tu16ArrValue;uint16_tu16CntValue;stc_bt_mode0_cfg_tstcBtBaseCfg;DDL_ZERO_STRUCT(stcBtBaseCfg);Sysctrl_SetPeripheralGate(SysctrlPeripheralBaseTim,TRUE);stcBtBaseCfg.enWorkMode=BtWorkMode0;stcBtBaseCfg.enCT=BtTimer;stcBtBaseCfg.enPRS=BtPCLKDiv16;stcBtBaseCfg.enCntMode=Bt16bitArrMode;stcBtBaseCfg.bEnTog=FALSE;stcBtBaseCfg.bEnGate=FALSE;stcBtBaseCfg.enGateP=BtGatePositive;Bt_Mode0_Init(TIM0,&stcBtBaseCfg);u16ArrValue=0x10000-1600;Bt_M0_ARRSet(TIM0,u16ArrValue);u16CntValue=0x10000-1600;Bt_M0_Cnt16Set(TIM0,u16CntValue);Bt_ClearIntFlag(TIM0,BtUevIrq);Bt_Mode0_EnableIrq(TIM0);EnableNvic(TIM0_IRQn,IrqLevel3,TRUE);}我开启定时中断,为什么不进入中断,而且我发现整个中断函数都不运行,不知道怎么回事,有人知道吗?还有就是我使用模拟IIC,来读取DS1307,读到的数据全是0voidDS1302_Init(void){stc_gpio_cfg_tstcGpioCfg;Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio,TRUE);stcGpioCfg.enDir=GpioDirOut;stcGpioCfg.enDrv=GpioDrvH;stcGpioCfg.enPu=GpioPuEnable;stcGpioCfg.enPd=GpioPdDisable;stcGpioCfg.enOD=GpioOdDisable;stcGpioCfg.enCtrlMode=GpioAHB;stcGpioCfg.bOutputVal=TRUE;Gpio_Init(GpioPortB,GpioPin3,&stcGpioCfg);Gpio_Init(GpioPortB,GpioPin4,&stcGpioCfg);if(Read_DS1302(0x08)!=0xF0){Write_DS1302(write_address[0],0x30);//ÃëWrite_DS1302(write_address[1],0x09);//·ÖWrite_DS1302(write_address[2],0x15);//ʱWrite_DS1302(write_address[3],0x29);//ÈÕWrite_DS1302(write_address[4],0x09);//ÔÂWrite_DS1302(write_address[5],0x03);//ÖÜWrite_DS1302(write_address[6],0x21);//ÄêWrite_DS1302(0x08,0xF0);}}这是什么原因
2021-10-30 3