#define LED_GPIO_PORT (GPIOB) #define LED_GPIO_PINS (GPIO_PIN_4) #define ADCch2_GPIO_PORT (GPIOC) #define ADCch2_GPIO_PINS (GPIO_PIN_5) u16 Conversion_Value; float V1; void Delay (uint16_t nCount); void ADC_Init(void); void main(void) { Delay(0xFFFF);Delay(0xFFFF); CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); /* Initialize I/Os in Output Mode */ GPIO_Init(LED_GPIO_PORT, (GPIO_Pin_TypeDef)LED_GPIO_PINS, GPIO_MODE_OUT_PP_LOW_FAST); GPIO_Init( ADCch2_GPIO_PORT,ADCch2_GPIO_PINS,GPIO_MODE_IN_FL_NO_IT ); //配置成float输入状态 ADC_Init(); //__enable_interrupt(); while (1) { /* Toggles LEDs */ GPIO_WriteReverse(LED_GPIO_PORT, (GPIO_Pin_TypeDef)LED_GPIO_PINS); Delay(0xFFFF); ADC1_StartConversion(); while(!ADC1_GetFlagStatus(ADC1_FLAG_EOC)); ADC1_ClearFlag(ADC1_FLAG_EOC); Conversion_Value = ADC1_GetConversionValue(); Delay(0xFFFF); V1=(Conversion_Value*3.3)/1024; Delay(0xFFFF); } } void ADC_Init(void) { ADC1_DeInit(); ADC1_Init(ADC1_CONVERSIONMODE_SINGLE, ADC1_CHANNEL_2, ADC1_PRESSEL_FCPU_D18,\ ADC1_EXTTRIG_TIM, DISABLE, ADC1_ALIGN_RIGHT, ADC1_SCHMITTTRIG_CHANNEL2,DISABLE); ADC1_Cmd(ENABLE); ADC1_StartConversion(); } 请教下各位,不知问题出在哪里 |
stm8s001j3.pdf
2019-10-10 17:19 上传
点击文件名下载附件
下载积分: ST金币 -11.56 MB, 下载次数: 20, 下载积分: ST金币 -1
就是这个 stvd的话在设置界面可以进行配置
看自己什么软件 找一找
评分
查看全部评分
评分
查看全部评分