-
GD32为什么用PA2代替key按键功能不成功
配置PA4ADC引脚,将PA2代替key功能,一脚接地一脚接PA2,想实现在另一key按键控制oled屏同时(使用了PA1),如果杜邦线连接了地与PA2,可以在oled屏幕上显示读取的ADC值程序如下运行无误但是PA2连接时无法实现预期功能,PA1正常运行请大佬解答~谢谢#include"gd32f30x.h"#include"systick.h"#include#include"oled.h"externuint8_tIntFlag;//进入中断服务程序标志,在EXTI1_IRQHandler()函数置位//定义一个变量来跟踪当前显示的行staticuint8_tcurrentLine=0;//定义一个数组来存储要显示的信息的索引或字符串指针staticconstuint8_tchineseMessages[][2]={{12,0},//{30,1},//{48,2},//{66,3},//{84,4},//{102,5}//};staticuint8_t*englishMessages[]={"HUZHOU","TEL:12345678"};uint16_tadc_value;uint16_tVol_Value;floatVol_Value1;voidadc_config(void){/*resetADC*/adc_deinit(ADC1);///*ADCmodeconfig*/adc_mode_config(ADC_MODE_FREE);/*ADCcontinousfunctionenable*/adc_special_function_config(ADC1,ADC_CONTINUOUS_MODE,ENABLE);/*ADCdataalignmentconfig*/adc_data_alignment_config(ADC1,ADC_DATAALIGN_RIGHT);/*ADCresolusion6B*///adc_resolution_config(ADC1,ADC_RESOLUTION_6B);/*ADCchannellengthconfig*/adc_channel_length_config(ADC1,ADC_REGULAR_CHANNEL,1);/*ADCregularchannelconfig*/adc_regular_channel_config(ADC1,0,ADC_CHANNEL_4,ADC_SAMPLETIME_55POINT5);/*ADCtriggerconfig*/adc_external_trigger_source_config(ADC1,ADC_REGULAR_CHANNEL,ADC0_1_2_EXTTRIG_REGULAR_NONE);adc_external_trigger_config(ADC1,ADC_REGULAR_CHANNEL,ENABLE);/*enableADCinterface*/adc_enable(ADC1);delay_1ms(1);/*ADCcalibrationandresetcalibration*/adc_calibration_enable(ADC1);/*enableADCinterface*///adc_software_trigger_enable(ADC0,ADC_REGULAR_CHANNEL);}intmain(void){rcu_ahb_clock_config(R
2024-07-25 18