stm32内部ad采样程序--运行通过(测量电压范围0~33v)(运行通过的arm.doc
还剩
27页未读,
继续阅读
下载文档到电脑,马上远离加班熬夜!
亲,很抱歉,此页已超出免费预览范围啦!
如果喜欢就下载吧,价低环保!
内容要点:
* Input : - file: pointer to the source file name* - line: assert error line source number* Output : None* Return : None**************************************{/* Select AHB clock(HCLK) as SysTick clock source */SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);/* Set SysTick Priority to 3 */NVIC_SystemHandlerPriorityConfig(SystemHandler_SysTick, 3, 0);/* Sys /* ADCCLK = PCLK2/4 */RCC_ADCCLKConfig(RCC_PCLK2_Div8); /* Flash 2 wait state */FLASH_SetLatency(FLASH_Latency_2);/* Enable Prefetch Buffer */FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);/ {for(j=0;j<20;j++){AD_value=ADC_GetConversionValue(ADC1);// Printf message with AD value to serial port every 1 second showdian(i,65-AD_value/63 ,0x03,255); delayms(100); } }LCD_Clear(255,0)cycles sample time*/ ADC_RegularChannelConfig(ADC1, ADC_Channel_13, 1, ADC_SampleTime_55Cycles5);/*上面的函数原形是:*//*void ADC_RegularChannelConfig(ADC_TypeDef* ADCx, u8 ADC_Channel, u8 Rank, u8 ADC_SampleT GPIO_Configuration();//printf("\r\n USART1 print AD_value -------------------------- \r\n"); /* DMA channel1 configuration ----------------------------------------------*//*DMA_DeInit(DMA1_Channel1) }}void showdian(unsigned char x,unsigned char y,unsigned char dcolor,unsigned char bgcolor){ addset(x,y,x+1,y+1); //设置区域 send(dcolor,1);send(bgcolor,1);}void delay_1ms(unsigned int ii)//1ms延时函} }temp++;}}//在指定位置显示一个字符串(8*12 大小)//dcolor为内容颜色,gbcolor 为背静颜色void showzifustr(unsigned char x,unsigned char y,unsigned char *str,unsigned char dcolor,unsigned char bgcolor) { unsign
发表评论
暂无评论,赶快抢占沙发吧。